virtualbox的安装与使用、安装镜像创建虚拟机

1、官网:https://www.virtualbox.org/

 

然后呢,点击下载:

开始安装virtualbox:

双击安装。详细安装过程见:https://baijiahao.baidu.com/s?id=1617088883237334113&wfr=spider&for=pc

点击下一步:

开始安装

选择自己的安装目录即可:

然后默认,下一步:

默认是。

默认安装:

最后选择,完成就完成了安装。

安装好,打开以后是这个鸟样:

话说还是比较喜欢Vmware虚拟机。

至此,可以使用VirtualBox创建虚拟机并安装操作系统了。由于在学习基于SpringBoot的点餐系统,慕课网的一个系统,没办法,先安装一个试试玩呗。

2、开始创建一个虚拟机。刚才说了,学习慕课网的一个教程,直接使用他们的镜像(里面配置好了一些环境,比如Nginx,apache,mysql等等吧)。

 

然后就进入了导入镜像的设置了;

 

然后等待一定的时间即可:

导入成功以后,然后点击启动:

点击启动,然额我的报错了:

先说一下如何将鼠标退出virtualbox软件吧,有点让人绝望的事情。默认是按右Ctrl键(就是键盘右边的那个Ctrl键)就退出来了,很操蛋的操作啊。还是修改为Vmware的alt+ctrl键吧。如果要修改这个退出的按键,点击管理,点击全局。

然后主机和Virtualbox里面的虚拟机不能拷贝和粘贴,真心不好使啊,烦的一比。

设备里面共享粘贴板里面,勾选双向还是不好使,感觉这个软件垃圾的一笔啊。

 

 复制粘贴功能,还有安装增强功能还没有弄好,以后再弄吧,真费劲。先把网络调通。

由于链接的无线网络,所以这里配置了桥接模式,让网络互通。

 上面新增的虚拟网卡,就是默认的我也没有修改,之前使用Vmware习惯使用Nat8,但是VirtualBox是桥接模式,自己可以视情况而定吧。

互ping一下,看看网络情况。

 然后用自己最顺手的Xshell连上这个虚拟机,嗯,真舒服。用virtualbox真恶心。嗯,就这样子。

 3、链接:https://pan.baidu.com/s/1w14PLYKMM9Cb3Fo-OyA96w 密码:bvqd。下载自己所需的centos7.3.ova镜像。

因为这个里面已经安装好了一些软件,这样你学习Spring Boot企业微信点餐系统,时间成本较小些(当然对于没有花money来弄得小伙伴)。

4、Spring Boot企业微信点餐系统。

当你的买家商品信息查询出来的时候,廖老师说将和前端联合起来,这个时候就用到了上面所安装的虚拟机,tmd,搞了一天虚拟机,真的心累。

 一闪而过。跳转到了微信客户端,前端做了一层逻辑,如果Cookie少了openid的值,就进行了跳转。

查看Cookie的信息:

再次访问虚拟机地址即可:

修改一下Nginx的配置,完成将自己的商品信息查询出来的功能。

[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf

完整配置如下所示:

  1 [root@localhost ~]# cat /usr/local/nginx/conf/nginx.conf
  2 
  3 #user  nobody;
  4 worker_processes  1;
  5 
  6 #error_log  logs/error.log;
  7 #error_log  logs/error.log  notice;
  8 #error_log  logs/error.log  info;
  9 
 10 #pid        logs/nginx.pid;
 11 
 12 
 13 events {
 14     worker_connections  1024;
 15 }
 16 
 17 
 18 http {
 19     include       mime.types;
 20     default_type  application/octet-stream;
 21 
 22     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
 23     #                  '$status $body_bytes_sent "$http_referer" '
 24     #                  '"$http_user_agent" "$http_x_forwarded_for"';
 25 
 26     #access_log  logs/access.log  main;
 27 
 28     sendfile        on;
 29     #tcp_nopush     on;
 30 
 31     #keepalive_timeout  0;
 32     keepalive_timeout  65;
 33 
 34     #gzip  on;
 35     server {
 36         listen       80;
 37         server_name  localhost;
 38 
 39         #charset koi8-r;
 40 
 41         #access_log  logs/host.access.log  main;
 42 
 43         location / {
 44             root   /opt/data/wwwroot/sell;
 45             index  index.html index.htm;
 46         }
 47         location /sell/ {
 48             proxy_pass http://127.0.0.1:8080/sell/;
 49         }
 50 
 51         #error_page  404              /404.html;
 52 
 53         # redirect server error pages to the static page /50x.html
 54         #
 55         error_page   500 502 503 504  /50x.html;
 56         location = /50x.html {
 57             root   html;
 58         }
 59 
 60         # proxy the PHP scripts to Apache listening on 127.0.0.1:80
 61         #
 62         #location ~ \.php$ {
 63         #    proxy_pass   http://127.0.0.1;
 64         #}
 65 
 66         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 67         #
 68         #location ~ \.php$ {
 69         #    root           html;
 70         #    fastcgi_pass   127.0.0.1:9000;
 71         #    fastcgi_index  index.php;
 72         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
 73         #    include        fastcgi_params;
 74         #}
 75 
 76         # deny access to .htaccess files, if Apache's document root
 77         # concurs with nginx's one
 78         #
 79         #location ~ /\.ht {
 80         #    deny  all;
 81         #}
 82     }
 83 
 84 
 85     # another virtual host using mix of IP-, name-, and port-based configuration
 86     #
 87     #server {
 88     #    listen       8000;
 89     #    listen       somename:8080;
 90     #    server_name  somename  alias  another.alias;
 91 
 92     #    location / {
 93     #        root   html;
 94     #        index  index.html index.htm;
 95     #    }
 96     #}
 97 
 98 
 99     # HTTPS server
100     #
101     #server {
102     #    listen       443 ssl;
103     #    server_name  localhost;
104 
105     #    ssl_certificate      cert.pem;
106     #    ssl_certificate_key  cert.key;
107 
108     #    ssl_session_cache    shared:SSL:1m;
109     #    ssl_session_timeout  5m;
110 
111     #    ssl_ciphers  HIGH:!aNULL:!MD5;
112     #    ssl_prefer_server_ciphers  on;
113 
114     #    location / {
115     #        root   html;
116     #        index  index.html index.htm;
117     #    }
118     #}
119 
120 }

修改配置如下所示:
修改为自己电脑所在的ip地址即可。

修改完毕以后重启一下,[root@localhost ~]# nginx -s reload

如果你有内网,有外网,最好将外网的网络设置为手动的,不要使用动态ip,不让网段会发生改变,还是蛮麻烦的。

 

修改为域名访问,修改完毕以后进行刷新即可:

[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
[root@localhost ~]# nginx -s reload

将172.16.3.155 sell.com添加到C:\Windows\System32\drivers\etc

 

 然后又遇到一些奇葩问题,先搞到这里吧,有问题见下篇或者再记录吧。

 

 

待续......

posted on 2019-07-15 16:04  别先生  阅读(17915)  评论(2编辑  收藏  举报