VMware——在CentOS中安装VMware Tools
摘要:本文主要记录了如何在VMware中的CentOS系统中,安装VMware Tools。
安装依赖
查看系统相关信息:
1 [root@localhost ~]# uname -r 2 3.10.0-327.el7.x86_64
查看已经安装的kernel版本:
1 [root@localhost ~]# rpm -qa | grep kernel 2 kernel-tools-libs-3.10.0-327.el7.x86_64 3 kernel-3.10.0-327.el7.x86_64 4 kernel-tools-3.10.0-327.el7.x86_64
如果结果列表中有同系统版本不相同的版本,即后缀不是“3.10.0-327.el7.x86_64”的版本,则需要手动卸载和系统版本不相同的版本:
1 [root@localhost ~]# yum remove kernel-3.10.0-1127.13.1.el7.x86_64
安装所需依赖:
1 [root@localhost ~]# yum -y install perl gcc gcc-c++ make cmake kernel kernel-headers kernel-devel net-tools
缺少的包可以下载:
https://buildlogs.centos.org/c7.1511.00/kernel
加载光驱
首先要将Vmware Tools加载到光驱里,点击菜单中的“虚拟机”,选择“安装 VMware Tools(T)...”:
挂载驱动
将加载的光驱挂载到设备目录,通常情况下都是将设备目录“/dev/cdrom”挂载到“/mnt/cdrom”目录。
先创建“/mnt/cdrom”目录:
1 [root@localhost ~]# mkdir /mnt/cdrom
然后进行挂载:
1 [root@localhost ~]# mount /dev/cdrom /mnt/cdrom 2 mount: /dev/sr0 写保护,将以只读方式挂载
拷贝安装包
查看挂载后的目录,并将安装包复制到安装目录:
1 [root@localhost ~]# ll /mnt/cdrom/ 2 总用量 55889 3 -r-xr-xr-x. 1 root root 1975 3月 22 2018 manifest.txt 4 -r-xr-xr-x. 1 root root 4393 3月 22 2018 run_upgrader.sh 5 -r--r--r--. 1 root root 55485539 3月 22 2018 VMwareTools-10.2.5-8068393.tar.gz 6 -r-xr-xr-x. 1 root root 843372 3月 22 2018 vmware-tools-upgrader-32 7 -r-xr-xr-x. 1 root root 893640 3月 22 2018 vmware-tools-upgrader-64 8 [root@localhost ~]# cp /mnt/cdrom/VMwareTools-10.2.5-8068393.tar.gz ~
解除挂载
既然已经复制了安装包,那么就可以解除挂载了:
1 [root@localhost ~]# umount /dev/cdrom
安装
解压并安装:
1 [root@localhost ~]# tar -zxvf VMwareTools-10.2.5-8068393.tar.gz 2 ... 3 vmware-tools-distrib/vmware-install.pl 4 [root@localhost ~]# ./vmware-tools-distrib/vmware-install.pl
安装过程如下:
1 [root@localhost ~]# ./vmware-tools-distrib/vmware-install.pl 2 open-vm-tools packages are available from the OS vendor and VMware recommends 3 using open-vm-tools packages. See http://kb.vmware.com/kb/2073803 for more 4 information. 5 Do you still want to proceed with this installation? [no] 6 7 INPUT: [no] default 8 9 [root@localhost ~]# ./vmware-tools-distrib/vmware-install.pl 10 open-vm-tools packages are available from the OS vendor and VMware recommends 11 using open-vm-tools packages. See http://kb.vmware.com/kb/2073803 for more 12 information. 13 Do you still want to proceed with this installation? [no] yes 14 15 INPUT: [yes] 16 17 Creating a new VMware Tools installer database using the tar4 format. 18 19 Installing VMware Tools. 20 21 In which directory do you want to install the binary files? 22 [/usr/bin] 23 24 INPUT: [/usr/bin] default 25 26 What is the directory that contains the init directories (rc0.d/ to rc6.d/)? 27 [/etc/rc.d] 28 29 INPUT: [/etc/rc.d] default 30 31 What is the directory that contains the init scripts? 32 [/etc/rc.d/init.d] 33 34 INPUT: [/etc/rc.d/init.d] default 35 36 In which directory do you want to install the daemon files? 37 [/usr/sbin] 38 39 INPUT: [/usr/sbin] default 40 41 In which directory do you want to install the library files? 42 [/usr/lib/vmware-tools] 43 44 INPUT: [/usr/lib/vmware-tools] default 45 46 The path "/usr/lib/vmware-tools" does not exist currently. This program is 47 going to create it, including needed parent directories. Is this what you want? 48 [yes] 49 50 INPUT: [yes] default 51 52 In which directory do you want to install the common agent library files? 53 [/usr/lib] 54 55 INPUT: [/usr/lib] default 56 57 In which directory do you want to install the common agent transient files? 58 [/var/lib] 59 60 INPUT: [/var/lib] default 61 62 In which directory do you want to install the documentation files? 63 [/usr/share/doc/vmware-tools] 64 65 INPUT: [/usr/share/doc/vmware-tools] default 66 67 The path "/usr/share/doc/vmware-tools" does not exist currently. This program 68 is going to create it, including needed parent directories. Is this what you 69 want? [yes] 70 71 INPUT: [yes] default 72 73 The installation of VMware Tools 10.2.5 build-8068393 for Linux completed 74 successfully. You can decide to remove this software from your system at any 75 time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl". 76 77 Before running VMware Tools for the first time, you need to configure it by 78 invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want 79 this program to invoke the command for you now? [yes] 80 81 INPUT: [yes] default 82 83 Initializing... 84 85 86 Making sure services for VMware Tools are stopped. 87 88 Stopping Thinprint services in the virtual machine: 89 Stopping Virtual Printing daemon: done 90 Stopping vmware-tools (via systemctl): [ 确定 ] 91 92 93 The module vmci has already been installed on this system by another installer 94 or package and will not be modified by this installer. 95 96 The module vsock has already been installed on this system by another installer 97 or package and will not be modified by this installer. 98 99 The module vmxnet3 has already been installed on this system by another 100 installer or package and will not be modified by this installer. 101 102 The module pvscsi has already been installed on this system by another 103 installer or package and will not be modified by this installer. 104 105 The module vmmemctl has already been installed on this system by another 106 installer or package and will not be modified by this installer. 107 108 The VMware Host-Guest Filesystem allows for shared folders between the host OS 109 and the guest OS in a Fusion or Workstation virtual environment. Do you wish 110 to enable this feature? [yes] 111 112 INPUT: [yes] default 113 114 115 Before you can compile modules, you need to have the following installed... 116 117 make 118 gcc 119 kernel headers of the running kernel 120 121 122 Searching for GCC... 123 Detected GCC binary at "/bin/gcc". 124 The path "/bin/gcc" appears to be a valid path to the gcc binary. 125 Would you like to change it? [no] 126 127 INPUT: [no] default 128 129 Searching for a valid kernel header path... 130 Detected the kernel headers at 131 "/lib/modules/3.10.0-327.el7.x86_64/build/include". 132 The path "/lib/modules/3.10.0-327.el7.x86_64/build/include" appears to be a 133 valid path to the 3.10.0-327.el7.x86_64 kernel headers. 134 Would you like to change it? [no] 135 136 INPUT: [no] default 137 138 Using kernel build system. 139 make: 进入目录“/tmp/modconfig-ZhY8Lb/vmhgfs-only” 140 /bin/make -C /lib/modules/3.10.0-327.el7.x86_64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. 141 MODULEBUILDDIR= modules 142 make[1]: 进入目录“/usr/src/kernels/3.10.0-327.el7.x86_64” 143 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/message.o 144 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/dir.o 145 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/request.o 146 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/filesystem.o 147 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/cpName.o 148 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/rpcout.o 149 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/stubs.o 150 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/hgfsUtil.o 151 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/hgfsEscape.o 152 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/link.o 153 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/transport.o 154 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/module.o 155 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/file.o 156 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/super.o 157 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/bdhandler.o 158 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/fsutil.o 159 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/cpNameLinux.o 160 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/hgfsBd.o 161 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/backdoorGcc64.o 162 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/page.o 163 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/backdoor.o 164 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/inode.o 165 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/dentry.o 166 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/cpNameLite.o 167 CC [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/kernelStubsLinux.o 168 LD [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/vmhgfs.o 169 Building modules, stage 2. 170 MODPOST 1 modules 171 CC /tmp/modconfig-ZhY8Lb/vmhgfs-only/vmhgfs.mod.o 172 LD [M] /tmp/modconfig-ZhY8Lb/vmhgfs-only/vmhgfs.ko 173 make[1]: 离开目录“/usr/src/kernels/3.10.0-327.el7.x86_64” 174 /bin/make -C $PWD SRCROOT=$PWD/. 175 MODULEBUILDDIR= postbuild 176 make[1]: 进入目录“/tmp/modconfig-ZhY8Lb/vmhgfs-only” 177 make[1]: “postbuild”是最新的。 178 make[1]: 离开目录“/tmp/modconfig-ZhY8Lb/vmhgfs-only” 179 cp -f vmhgfs.ko ./../vmhgfs.o 180 make: 离开目录“/tmp/modconfig-ZhY8Lb/vmhgfs-only” 181 182 The vmxnet driver is no longer supported on kernels 3.3 and greater. Please 183 upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e) 184 185 The vmblock enables dragging or copying files between host and guest in a 186 Fusion or Workstation virtual environment. Do you wish to enable this feature? 187 [yes] 188 189 INPUT: [yes] default 190 191 NOTICE: It appears your system does not have the required fuse packages 192 installed. The VMware blocking filesystem requires the fuse packages and its 193 libraries to function properly. Please install the fuse or fuse-utils package 194 using your systems package management utility and re-run this script in order 195 to enable the VMware blocking filesystem. 196 197 VMware automatic kernel modules enables automatic building and installation of 198 VMware kernel modules at boot that are not already present. This feature can 199 be enabled/disabled by re-running vmware-config-tools.pl. 200 201 Would you like to enable VMware automatic kernel modules? 202 [yes] 203 204 INPUT: [yes] default 205 206 Do you want to enable Guest Authentication (vgauth)? Enabling vgauth is needed 207 if you want to enable Common Agent (caf). [yes] 208 209 INPUT: [yes] default 210 211 Do you want to enable Common Agent (caf)? [no] 212 213 INPUT: [no] default 214 215 No X install found. 216 217 Creating a new initrd boot image for the kernel. 218 Generating the key and certificate files. 219 Successfully generated the key and certificate files. 220 manageSELinux install: The 'semanage' utility was not found. 221 There was an error configuring the SELinux security context for VMware Tools. 222 Please make certain that SELinux is configured correctly. 223 224 The configuration of VMware Tools 10.2.5 build-8068393 for Linux for this 225 running kernel completed successfully. 226 227 You must restart your X session before any mouse or graphics changes take 228 effect. 229 230 To enable advanced X features (e.g., guest resolution fit, drag and drop, and 231 file and text copy/paste), you will need to do one (or more) of the following: 232 1. Manually start /usr/bin/vmware-user 233 2. Log out and log back into your desktop session 234 3. Restart your X session. 235 236 Enjoy, 237 238 --the VMware team 239 240 [root@localhost ~]#