一、安装环境
CentOS 7
二、安装VMware
到官方网站下载VMware workstation pro 15 下面是几个可用的Key
YG5H2-ANZ0H-M8ERY-TXZZZ-YKRV8
UG5J2-0ME12-M89WY-NPWXX-WQH88
UA5DR-2ZD4H-089FY-6YQ5T-YPRX6
GA590-86Y05-4806Y-X4PEE-ZV8E0
ZF582-0NW5N-H8D2P-0XZEE-Z22VA
YA18K-0WY8P-H85DY-L4NZG-X7RAD
下载完成后执行下面命令安装
./VMware-Workstation-Full-15.0.0-10134415.x86_64.bundle --console --eulas-agreed --required -s vmware-workstation serialNumber YG5H2-ANZ0H-M8ERY-TXZZZ-YKRV8
安装成功后会自动启动,启动的进程有如下列表,
[root@localhost local]# ps -aux|grep vmware
root 3104 0.0 0.0 24440 1732 ? Ss 23:07 0:00 /usr/bin/vmware-usbarbitrator
root 3468 2.8 1.6 1314140 63868 ? Sl 23:08 0:02 /usr/lib/vmware/bin/vmware-hostd -a /etc/vmware/hostd/config.xml
root 3733 0.0 0.0 104212 1176 ? Ssl 23:09 0:00 /usr/lib/vmware/bin/vmware-vmblock-fuse -o subtype=vmware-vmblock,default_permissions,allow_other /var/run/vmblock-fuse
root 3795 0.0 0.1 21208 5636 ? Ss 23:09 0:00 /usr/bin/vmnet-dhcpd -s 6 -cf /etc/vmware/vmnet1/dhcpd/dhcpd.conf -lf /etc/vmware/vmnet1/dhcpd/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet1.pid vmnet1
root 3798 0.0 0.0 13948 1376 ? S 23:09 0:00 /usr/bin/vmnet-natd -s 6 -m /etc/vmware/vmnet8/nat.mac -c /etc/vmware/vmnet8/nat/nat.conf
root 3806 0.0 0.1 21208 5636 ? Ss 23:09 0:00 /usr/bin/vmnet-dhcpd -s 6 -cf /etc/vmware/vmnet8/dhcpd/dhcpd.conf -lf /etc/vmware/vmnet8/dhcpd/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid vmnet8
root 3821 0.0 0.0 16780 856 ? Ss 23:09 0:00 /usr/sbin/vmware-authdlauncher
如果CentOS系统重启后,VMware无法连接网络,在虚拟机的设置network adapter中一直显示“正在加载虚拟网络”,则有可能是vmnet-dhcpd和vmnet-natd服务没有启动,请手动启动即可。
三、在VMware中安装系统
因为VMware是在服务器版本CentOS 7中安装的,所以这里安装系统需要通过远程来完成,我们可以通过windows中安装VMware来远程安装系统,打开windows中的VMware,如下图所示:
在“主页”中选择“连接远程服务器”,在弹出框中输入CentOS7服务器的ip、用户名和密码然后点击连接,连接上后会在左边栏显示,接下来就可以正常安装系统了,如下图:
注:如果连接失败请关闭防火墙,命令如下:
systemctl stop firewalld
安装系统过程这里就不介绍了,不知道的请自行搜索
四、常用命令
# vmrun -T ws start "/var/lib/vmware/Shared VMs/CentOS7/CentOS7.vmx" nogui #启动无图形界面虚拟机 (-T是区分宿主机的类型,ws|server|server1|fusion|esx|vc|player,可能比较常用的是ws、esx和player,不过没有加-T在Workstation也能正常运行,
可能esx和server就需要了)
# vmrun start "/var/lib/vmware/Shared VMs/CentOS7/CentOS7.vmx" gui启动带图形界面虚拟机
# vmrun stop "/var/lib/vmware/Shared VMs/CentOS7/CentOS7.vmx" hard | soft强制关闭虚拟机(相当于直接关电源) | 正常关闭虚拟机
# vmrun reset "/var/lib/vmware/Shared VMs/CentOS7/CentOS7.vmx" hard | soft冷重启虚拟机 | 热重启虚拟机
# vmrun suspend "/var/lib/vmware/Shared VMs/CentOS7/CentOS7.vmx" hard | soft挂起虚拟机(可能相当于休眠)
# vmrun pause "/var/lib/vmware/Shared VMs/CentOS7/CentOS7.vmx"暂停虚拟机
# vmrun unpause "/var/lib/vmware/Shared VMs/CentOS7/CentOS7.vmx"停止暂停虚拟机
# vmrun list 列出正在运行的虚拟机
# ps aux | grep vmx 另一种查看正在运行虚拟机的方法
# vmrun -T ws snapshot "/var/lib/vmware/Shared VMs/CentOS7/CentOS7.vmx" snapshotName创建一个快照
# vmrun -T ws reverToSnapshot "/var/lib/vmware/Shared VMs/CentOS7/CentOS7.vmx" snapshotName 从一个快照中恢复虚拟机
# vmrun -T ws listSnapshots "/var/lib/vmware/Shared VMs/CentOS7/CentOS7.vmx" 列出虚拟机快照数量及名称
# vmrun -T ws deleteSnapshot "/var/lib/vmware/Shared VMs/CentOS7/CentOS7.vmx" snapshotName 删除一个快照
有了上面的命令后就不需要每次启动虚拟机都要在windows中打开VMware来远程启动了,可以在命令行下用命令启动:
vmrun -T ws start "/var/lib/vmware/Shared VMs/CentOS7/CentOS7.vmx" nogui
至此安装完成