CentOS7安装VMware Tools的具体操作步骤:(仅供参考)
部分截图转载于博主2:(竹jing)
一,准备工作
- 菜单栏》安装VMware Tools
点击VMware菜单栏【虚拟机】,选择【安装VMware Tools】;如果安装了早期版本的 VMware Tools,则菜单项为[更新 VMware Tools];如果是第一次安装,则会提示相关信息,点击是或者继续。
- 装载CD-ROM
查看【虚拟机>设置>硬件>CD/DVD】是否已加载CD虚拟驱动器,如下图
二,挂载目录
- 查看cdrom目录
在虚拟机中,以 root 身份登录客户机操作系统,打开终端窗口并运行ls /dev命令查看是否含有cdrom目录 - 创建/mnt/cdrom
- 挂载目录
使用命令mount -t iso9660 /dev/cdrom /mnt/cdrom将光盘挂载在/mnt/cdrom目录,并使用命令ls /mnt/cdrom查看是否挂载成功
三,拷贝安装包 - 拷贝安装包到家目录
将后缀名为tar.gz的文件拷贝到家目录下,使用命令cp /mnt/cdrom/ VMwareTools-9.9.3-2759765.tar.gz ~,并用命令ls ~查看是否复制成功 - 解除挂载
使用命令umount /dev/cdrom解除挂载 - 解压安装包
使用命令tar -zxvf VMwareTools-9.9.3-2759765.tar.gz(视自己的安装包而定) - 解压完成后使用命令ls ~查看是否解压成功
- 四,安装VMware Tools
- 进入源码文件目录
使用命令cd vmware-tools-distrib进入到解压后的源码文件目录 - 运行vmware-install.pl文件
**!!!**接下来的异常情况有的小伙伴可能会出现,不过本人的ifcfg-ens33中的情况是这样的,如下图所示,所以没有进行静态IP设置(也能联网,不过还是建议设置一下静态I)
- 配置后
- 可能出现的错误信息
出现错误“-bash: ./vmware-install.pl: /usr/bin/per: bad interpreter: No such file or directory”,表明未安装编译环境
接着安装编译环境
最好使用命令yum -y install perl gcc gcc-c++ make cmake kernel kernel-headers kernel-devel net-tools以避免后期网络问题
结果可能会报错“Couldn’t resolve host 'mirrorlist.centos.org”,表明无法解析mirrorlist.centos.org这个地址,没有正确配置网络
五,配置静态网络
也可以看原博主的文章。
博主1:(科皮子菊)
博主2(上面也提到过):
(竹jing)
5.1 背景
使用vmware或virtualbox安装了centos操作系统后,下一步要做的要做的就是设置网络。通常linux系统是用来做服务器的,也很少使用(安装)桌面版的系统。服务器通常是放在服务运营商那里,例如阿里,腾讯等,我们部署服务时也是使用远程工具控制服务器,对其配置,上传和下载相关文件,那么就需要设置一个固定的ip。学过计算机网络的都知道,dhcp协议自动分配的ip是有时间限制的。所以需要给一个服务器(虚拟机)设置一个固定的ip,也就是一个静态ip。
centos版本: centos7
虚拟机:VMware15.5
注意:全程使用的root用户
5.2 配置前的准备
在使用虚拟机安装centos时,选择的网络是NAT方式,为什么选择它可以看看博主1的这篇文章:Vmware虚拟机中桥接模式、NAT模式与仅主机模式的含义与区别 。本文介绍在使用命令行的方式设置静态ip,如果你安装了桌面的系统的话也可以是使用相关的操作进行配置,这里就不在介绍,因为其背后也是去修改配置文件的。
装好centos系统后,使用ping命令测试是否可以联网,这里以与百度交互进行测试:
[root@dajun ~]ping www.baidu.com
- 如果没有设置网络,就会是如下情况
- 这里我就不赘述了,直接看博主1的文章,多看几遍,直接说怎么配了。
5.3,静态ip的配置
5.3.1 记录相关的数据
查看vmware中关于网络的一些信息。操作如下:
接着如下图所示
根据上面的提示好的相关数据,开始配置。
5.3.2 修改网络配置文件
这里使用vi工具去编辑配置文件,使用vi后加空格 再加上刚才介绍的网络配置的文件的路径即可打开配置文件(只是打开,还不可编辑),如下:
vi /etc/sysconfig/network-scripts/ifcfg-ens33
配置文件内容如下
然后,键盘的输入法保持英文输入的状态,键入i
这个按键后,通过移动键盘的上下左右键到指定位置对配置文件进行编辑了(左下角会有一个insert的字样)。
需要修改的是:
- BOOTPROTO=static
- ONBOOT=yes
第一个就是要求使用静态的ip,不需要使用dhcp去分配了,第二个是指虚拟机开机的时候自动连接网络。
需要增加的内容就是: - IPADDR=172.27.168.11(静态IP地址)
- NETMASK=255.255.255.0
- GATEWAY=172.27.168.1(IP地址所在网关地址)
- DNS1=114.114.114.114
上面的一些缩写代表什么意思,有兴趣的可以百度一下,这里不过多介绍,其中IPADDR就是你要设置的目标ip,这个ip是对应的子网下的ip地址即可。
编辑完毕之后,在键盘上点击esc推荐编辑,(在英文的输入模式下)键入冒号(即:“shift+;”组合键) ,输入wq enter键保存退出,如上图:
注意
在这之后我还是把DNS1=114.114.114.114
然后添加了NETMASK=255.255.255.0
六,继续安装编译环境
最好使用命令yum -y install perl gcc gcc-c++ make cmake kernel kernel-headers kernel-devel net-tools以避免后期网络问题)开始安装,这里异常情况我就不赘述了,可浏览上面博主2的文章概述。
6.1,安装编译环境
6.2,查看kernel-headers是否安装成功
版本因人而异
使用命令rpm -aq | grep kernel-headers
使用命令rpm -ql kernel-headers-3.10.0-957.21.2.el7.x86_64|less查看安装目录,因安装目录太多故后面加less方便翻页查看
yum默认安装目录是/usr/src,故现为/usr/src里面的version.h创建软链接
使用命令ln -s /usr/src/kernels/3.10.0-514.21.2.el7.x86_64/include/generated/uapi/linux/version.h /usr/src/kernels/3.10.0-514.21.2.el7.x86_64/include/linux/version.h并使用命令reboot重启系统
重启后重新进入 vmware-tools-distrib 源码包目录进行再次重新安装 VMware Tools,这次没有报错直接安装成功了
!!!警告,接下来的操作不当,会导致无法查看共享文件夹
转载自
场景:
centos7 + vmware15
设置完共享文件夹后,查看 /mnt/ 下面发现不显示设置的共享文件夹
解决方案:
安装VMware tools,注意:一定要覆盖安装。
说明:由于 VMware tools 安装过程需要很多步确认,在选择是否覆盖的步骤时,默认是不覆盖的,
如果安装时一直使用默认,那么你安装完成后,还是不能解决根本问题。
所以,所有确认项目要都输入 yes。
具体安装过程:
共需要13步确认,其中 11 步和 12 步必须输入yes,不能使用默认
[root@bogon vmware-tools-distrib]# ./vmware-install.pl
The installer has detected an existing installation of open-vm-tools packages
on this system and will not attempt to remove and replace these user-space
applications. It is recommended to use the open-vm-tools packages provided by
the operating system. If you do not want to use the existing installation of
open-vm-tools packages and use VMware Tools, you must uninstall the
open-vm-tools packages and re-run this installer.
The packages that need to be removed are:
open-vm-tools
The installer will next check if there are any missing kernel drivers. Type yes
if you want to do this, otherwise type no [yes] yes 1.输入 yes
INPUT: [yes]
Creating a new VMware Tools installer database using the tar4 format.
Installing VMware Tools.
In which directory do you want to install the binary files? 2.这里回车默认
[/usr/bin]
INPUT: [/usr/bin] default
What is the directory that contains the init directories (rc0.d/ to rc6.d/)? 3.回车默认
[/etc/rc.d]
INPUT: [/etc/rc.d] default
What is the directory that contains the init scripts? 4.回车默认
[/etc/rc.d/init.d]
INPUT: [/etc/rc.d/init.d] default
In which directory do you want to install the daemon files? 5.回车默认
[/usr/sbin]
INPUT: [/usr/sbin] default
In which directory do you want to install the library files? 6.回车默认
[/usr/lib/vmware-tools]
INPUT: [/usr/lib/vmware-tools] default
The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want? 7.输入 yes
[yes] yes
INPUT: [yes]
In which directory do you want to install the documentation files? 8.回车默认
[/usr/share/doc/vmware-tools]
INPUT: [/usr/share/doc/vmware-tools] default
The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes] yes 9.输入 yes
INPUT: [yes]
The installation of VMware Tools 10.3.21 build-14772444 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".
Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes] yes 10.输入 yes
INPUT: [yes]
You have chosen to install VMware Tools on top of an open-vm-tools package.
You will now be given the option to replace some commands provided by
open-vm-tools. Please note that if you replace any commands at this time and
later remove VMware Tools, it may be necessary to re-install the open-vm-tools.
The file /usr/bin/vmware-hgfsclient that this program was about to install
already exists. Overwrite? [no] yes 11.!!!!!注意:这里必须输入 yes
INPUT: [yes]
The file /usr/bin/vmhgfs-fuse that this program was about to install already
exists. Overwrite? [no] yes 12.!!!!!!注意:这里必须输入 yes
INPUT: [yes]
Initializing...
Making sure services for VMware Tools are stopped.
Stopping vmware-tools (via systemctl): [ OK ]
The module vmci has already been installed on this system by another installer
or package and will not be modified by this installer.
The module vsock has already been installed on this system by another installer
or package and will not be modified by this installer.
The module vmxnet3 has already been installed on this system by another
installer or package and will not be modified by this installer.
The module pvscsi has already been installed on this system by another
installer or package and will not be modified by this installer.
The module vmmemctl has already been installed on this system by another
installer or package and will not be modified by this installer.
The VMware Host-Guest Filesystem allows for shared folders between the host OS
and the guest OS in a Fusion or Workstation virtual environment. Do you wish
to enable this feature? [yes] yes 13.输入 yes
INPUT: [yes]
The vmxnet driver is no longer supported on kernels 3.3 and greater. Please
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)
Skipping configuring automatic kernel modules as no drivers were installed by
this installer.
Skipping rebuilding initrd boot image for kernel as no drivers to be included
in boot image were installed by this installer.
The configuration of VMware Tools 10.3.21 build-14772444 for Linux for this
running kernel completed successfully.
Found VMware Tools CDROM mounted at /run/media/tys/VMware Tools. Ejecting
device /dev/sr0 ...
Enjoy,
--the VMware team
至此应该能给大家带来一些帮助