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

一、官网:https://www.virtualbox.org/php

 

而后呢,点击下载:html

开始安装virtualbox:前端

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

点击下一步:nginx

开始安装sql

选择本身的安装目录便可:shell

而后默认,下一步:apache

默认是。vim

默认安装:centos

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

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

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

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

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

 

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

 

而后等待必定的时间便可:

导入成功之后,而后点击启动:

点击启动,然额个人报错了:

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

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

设备里面共享粘贴板里面,勾选双向仍是很差使,感受这个软件垃圾的一笔啊。

 

 复制粘贴功能,还有安装加强功能尚未弄好,之后再弄吧,真费劲。先把网络调通。

因为连接的无线网络,因此这里配置了桥接模式,让网络互通。

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

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

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

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

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

四、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

 

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

 

 

待续......

相关文章
相关标签/搜索