1、VMware Workstation for Linux Download link:
https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-15.1.0-13591040.x86_64.bundle
2、将下载的VMware安装包放到Linux系统中,或者直接将在Linux系统中下载也可以,我装的Linux无图形化界面,所以先下载到Windows系统中,通过lrzsz工具传到Linux系统中
安装依赖环境
yum -y install perl gcc kernel-devel libX11 libXinerama libXcursor libXtst
3、安装VMware Workstation 15
需要给vmware安装包添加执行权限,否则无法安装
chmod +x VMware-Workstation-Full-15.1.0-13591040.x86_64.bundle
可用的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.1.0-13591040.x86_64.bundle --console --eulas-agreed --required -s vmware-workstation serialNumber YA18K-02Y8P-H85DY-L4NZG-X7RAD
安装成功后会自动启动,启动的进程有如下列表,也有不一样的情况,在服务器上安装如下,在主机上安装并没有这么多
[root@SDB1 vmware]# ps -aux | grep vmware
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
root 64862 0.0 0.0 111664 1644 ? Ss 16:19 0:00 /vmdisk/vmware_local/bin/vmware-usbarbitrator
root 65345 0.0 0.0 1597708 77776 ? Sl 16:19 0:03 /vmdisk/vmware_lib/vmware/bin/vmware-hostd -a /etc/vmware/hostd/config.xml
root 65666 0.0 0.0 346352 1436 ? Ssl 16:19 0:00 /vmdisk/vmware_lib/vmware/bin/vmware-vmblock-fuse -o subtype=vmware-vmblock,default_permissions,allow_other /var/run/vmblock-fuse
root 65714 0.0 0.0 103544 576 ? Ss 16:19 0:00 /vmdisk/vmware_local/bin/vmnet-bridge -s 6 -d /var/run/vmnet-bridge-0.pid -n 0
root 65723 0.0 0.0 103516 300 ? Ss 16:19 0:00 /vmdisk/vmware_local/bin/vmnet-netifup -s 6 -d /var/run/vmnet-netifup-vmnet1.pid /dev/vmnet1 vmnet1
root 65733 0.0 0.0 115700 5788 ? Ss 16:19 0:00 /vmdisk/vmware_local/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 65737 0.0 0.0 110548 1448 ? S 16:19 0:00 /vmdisk/vmware_local/bin/vmnet-natd -s 6 -m /etc/vmware/vmnet8/nat.mac -c /etc/vmware/vmnet8/nat/nat.conf
root 65753 0.0 0.0 103516 304 ? Ss 16:19 0:00 /vmdisk/vmware_local/bin/vmnet-netifup -s 6 -d /var/run/vmnet-netifup-vmnet8.pid /dev/vmnet8 vmnet8
root 65759 0.0 0.0 115700 5788 ? Ss 16:19 0:00 /vmdisk/vmware_local/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 65805 0.0 0.0 113368 928 ? Ss 16:19 0:00 /vmdisk/vmware_local/sbin/vmware-authdlauncher
root 70871 0.0 0.0 103252 852 pts/1 S+ 18:28 0:00 grep vmware
You have new mail in /var/spool/mail/root
如果CentOS系统重启后,VMware无法连接网络,在虚拟机的设置network adapter中一直显示“正在加载虚拟网络”,则有可能是vmnet-dhcpd和vmnet-natd服务没有启动,请手动启动即可。
4、在VMware中安装系统
在Windows主机上安装Windows 版本的VMware Workstation
在“主页”中选择“连接远程服务器”,在弹出框中输入CentOS7服务器的ip、用户名和密码然后点击连接,连接上后会在左边栏显示,接下来就可以正常安装系统了,如下图:
5、常用命令
# 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
问题:
1、Linux版本VMware安装时,默认共享虚拟机目录为 /var/lib/vmware/Shared VMs ,我在服务器上安装时发现服务器扩展过硬盘,根目录/ 空间比较小,虚拟机也只识别根目录下的空间,扩展的硬盘识别不到。
解决办法:把扩展的硬盘空间挂载到 /var/lib/vmware 目录下,图形化界面安装时就可以选择更改路径。
2、在测试主机上安装时发现纯字符界面安装完,通过Windows 的VMware无法连接,查看并没有生成虚拟vmnet网卡,但安装了图形化界面的测试主机,图形化界面安装时就正常,有待继续测试。
参考文章:
在Linux主机上安装 Workstation Pro
VMware Workstation 15共享虚拟机目录