我们可以通过VMWare来安装,但是通过VMWare安装大家经常会碰到网络ip连接问题,为了减少额外的环境因素影响,以下介绍通过VirtualBox结合Vagrant来安装虚拟机
VirtualBox官网:Oracle VM VirtualBox
Vagrant官网:Vagrant by HashiCorp
Vagrant镜像仓库:HashiCorp Cloud Platform
安装VirtualBox和Vagrant,傻瓜式安装。安装完成后需要重启计算机。
在cmd命令窗口输入 vagrant
命令弹出如下内容表示 vagrant
安装成功

通过Vagrant安装虚拟机:
-
创建一个空的目录,cmd切换到该目录中,然后执行
vagrant init centos/7
会创建Vagrantfile文件 -
执行
vagrant up
第一次执行的时候会远程下相关的镜像文件,并启动虚拟机。 -
连接虚拟机通过
vagrant ssh
连接 -
-
网络配置:
找到对应的Vagrantfile文件,在你创建的文件下下面
-
查看当前主机给虚拟机分配的网关的网段:
-
网段是56
重启vagrant reload

此处xshell登录,默认安装用户名为vagrant,密码在之前创建的文件目录下


结束,是不是贼简单