后來發現在安裝centos7是直接在user creation里設置管理員權限就都解決了,它會自動安裝vmware tools。

1.移除CD驅動
右鍵虛擬機,找到安裝VMware Tools,但是桌面死活找不到安裝包,只有一個 Vmware Tools虛擬光驅。

查看原因是因為在安裝 CentOS的時候安裝完,就沒有修改cd驅動

將連接路徑改成vmware安裝路徑下的linux.iso文件,可將其復制到虛擬系統(zookeeper0)的安裝文件夾下

這時候,你在進入桌面,就可以看到安裝包了。

把VMwareTools-10.0.10-4301679.tar.gz拖到桌面並解壓(解壓后文件名叫vmware-tools-distrib)。但是我沒解壓,而是下面的方法。
2.安裝VMware Tools
1.更新CentOS軟件
為了預防安裝過程可能遇到的問題
諸如:頭部內核不匹配之類的
1 Searching for a valid kernel header path... 2 The path "" is not valid. 3 Would you like to change it? [yes]
先對服務器的軟件進行更新,執行語句順序如下:
1 yum -y update 2 yum install kernel-headers kernel-devel -y gcc
更新完成后,重啟服務器。
2.獲取VMwareTools安裝包
創建光驅掛載目錄
[root@zookeeper0 admin]# mkdir /mnt/cdrom
mkdir: 無法創建目錄"/mnt/cdrom": 文件已存在
之前選擇安裝VMware Tools時,VMware會將安裝包導入/dev/cdrom目錄
將光盤掛載到/mnt/cdrom目錄
[root@zookeeper0 admin]# mount /dev/cdrom /mnt/cdrom
mount: /dev/sr0 寫保護,將以只讀方式掛載
查看/mnt/cdrom該目錄下文件
[root@zookeeper0 admin]# ls /mnt/cdrom

復制VMware Tools安裝包到安裝目錄 ,事實證明這么復制根本不行,workspace打不開,內容也不是vmware壓縮包
[root@zookeeper0 admin]# cp /mnt/cdrom/VMwareTools-10.0.10-4301679.tar.gz /home/workspace
桌面打開vmware tools,將VMwareTools壓縮包拖拽至桌面

然后cd到桌面解壓縮,如果輸入不了漢字就在主機中復制過去
1 [root@zookeeper0 桌面]# cd /home/admin/桌面 2 [root@zookeeper0 桌面]# tar -zxvf VMwareTools-10.0.10-4301679.tar.gz
進入安裝目錄,如果安裝有問題請參考:https://www.cnblogs.com/LCharles/p/11263922.html
1 [root@zookeeper0 桌面]# cd vmware-tools-distrib 2 [root@zookeeper0 vmware-tools-distrib]# ./vmware-install.pl
1 下面的選項就按照默認值。一直回車就可以: 2 3 In which directory do you want to install the binary files? 4 [/usr/bin] 5 6 What is the directory that contains the init directories (rc0.d/ to rc6.d/)? 7 8 [/etc/rc.d] 9 10 What is the directory that contains the init scripts? 11 [/etc/rc.d/init.d] 12 13 In which directory do you want to install the daemon files? 14 [/usr/sbin] 15 16 In which directory do you want to install the library files? 17 [/usr/lib/vmware-tools] 18 19 The path “/usr/lib/vmware-tools” does not exist currently. This program is goingto create it, including needed parent directories. Is this what you want? 20 [yes] 21 22 In which directory do you want to install the documentation files? 23 [/usr/share/doc/vmware-tools] 24 25 The path “/usr/share/doc/vmware-tools” does not exist currently. This program isgoing to create it, including needed parent directories. Is this what you want? 26 [yes] 27 28 The installation of VMware Tools 5.5.1 build-19175 for Linux completed 29 successfully. You can decide to remove this software from your system at any 30 time by invoking the following command: “/usr/bin/vmware-uninstall-tools.pl”. 31 32 Before running VMware Tools for the first time, you need to configure it by 33 invoking the following command: “/usr/bin/vmware-config-tools.pl”. Do you want 34 this program to invoke the command for you now? [yes] 35 36 Stopping VMware Tools services in the virtual machine: 37 Guest operating system daemon: [ 確定 ] 38 Trying to find a suitable vmhgfs module for your running kernel. 39 40 The module bld-2.6.9-5.EL-i686-RHEL4 loads perfectly in the running kernel. 41 42 pcnet32 30153 0 43 Unloading pcnet32 module 44 45 Trying to find a suitable vmxnet module for your running kernel. 46 47 The module bld-2.6.9-5.EL-i686-RHEL4 loads perfectly in the running kernel. 48 49 Detected X.org version 6.8. 50 51 關閉控制台鼠標服務: [ 確定 ] 52 啟動控制台鼠標服務: [ 確定 ] 53 54 Please choose one of the following display sizes (1 – 13): 55 56 # 顯示分辨率,這里是以 1024×768 為例 57 58 # VMware Tools 安裝的時候,會自動修改 X server 的配置文件 59 60 [1] ”640×480″ 61 [2]< “800×600″ 62 [3] ”1024×768″ 63 [4] ”1152×864″ 64 [5] ”1280×800″ 65 [6] ”1152×900″ 66 [7] ”1280×1024″ 67 [8] ”1376×1032″ 68 [9] ”1400×1050″ 69 [10] ”1680×1050″ 70 [11] ”1600×1200″ 71 [12] ”1920×1200″ 72 [13] ”2364×1773″ 73 Please enter a number between 1 and 13: 74 75 [2] 3 76 77 X Window System Version 6.8.2 78 Release Date: 9 February 2005 79 X Protocol Version 11, Revision 0, Release 6.8.2 80 Build Operating System: Linux 2.6.9-34.EL i686 [ELF] 81 Current Operating System: Linux rd01.domain 2.6.9-34.EL #1 Wed Mar 8 00:07:35 CST 2006 i686 82 Build Date: 04 May 2006 83 Build Host: x8664-build.centos.org 84 85 Before reporting problems, check [url]http://wiki.X.Org[/url] 86 to make sure that you have the latest version. 87 Module Loader present 88 OS Kernel: Linux version 2.6.9-34.EL (buildcentos@build-i386) (gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)) #1 Wed Mar 8 00:07:35 CST 2006 P 89 Markers: (–) probed, (**) from config file, (==) default setting, 90 (++) from command line, (!!) notice, (II) informational, 91 (WW) warning, (EE) error, (NI) not implemented, (??) unknown. 92 (++) Log file: “/tmp/vmware-config0/XF86ConfigLog.3131″, Time: Mon Jun 12 20:57:34 2006 93 (++) Using config file: “/tmp/vmware-config0/XF86Config.3131″ 94 (WW) VMWARE(0): Failed to set up write-combining range (0xf0000000,0×1000000) 95 96 X is running fine with the new config file. 97 98 Starting VMware Tools services in the virtual machine: 99 Switching to guest configuration: [ 確定 ] 100 Guest filesystem driver: [ 確定 ] 101 DMA setup: [ 確定 ] 102 Guest operating system daemon: [ 確定 ] 103 104 The configuration of VMware Tools 5.5.1 build-19175 for Linux for this running 105 kernel completed successfully. 106 107 You must restart your X session before any mouse or graphics changes take 108 effect. 109 110 You can now run VMware Tools by invoking the following command: 111 “/usr/bin/vmware-toolbox” during an XFree86 session. 112 113 To use the vmxnet driver, restart networking using the following commands: 114 /etc/init.d/network stop 115 rmmod pcnet32 116 rmmod vmxnet 117 depmod -a 118 modprobe vmxnet 119 /etc/init.d/network start 120 121 Enjoy, 122 123 –the VMware team
最后,VMware-Tools安裝成功了,咱們重啟一下Linux系統,會發現VMware-Tools已經安裝成功了,此時不但可以直接在windows界面將需要的文件或者文件夾直接復制到虛擬機的Linux系統中,實際發現拷貝的壓縮包缺失,轉而使用文件共享來復制。
通過文件共享來與windows系統建立無縫銜接:

3.使用VMware Tools文件共享
設置共享文件

有可能有/mnt/hgfs但沒有共享文件。解決方法:
1 [root@zookeeper0 admin]# yum install open-vm-tools-devel -y 2 已加載插件:fastestmirror, langpacks 3 Loading mirror speeds from cached hostfile 4 * base: mirrors.163.com 5 * extras: mirrors.cn99.com 6 * updates: mirrors.cn99.com 7 正在解決依賴關系 8 --> 正在檢查事務 9 ---> 軟件包 open-vm-tools-devel.x86_64.0.10.2.5-3.el7 將被 安裝 10 --> 解決依賴關系完成 11 12 依賴關系解決 13 14 ================================================================================ 15 Package 架構 版本 源 大小 16 ================================================================================ 17 正在安裝: 18 open-vm-tools-devel x86_64 10.2.5-3.el7 base 157 k 19 20 事務概要 21 ================================================================================ 22 安裝 1 軟件包 23 24 總下載量:157 k 25 安裝大小:1.0 M 26 Downloading packages: 27 警告:/var/cache/yum/x86_64/7/base/packages/open-vm-tools-devel-10.2.5-3.el7.x86_64.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY 28 open-vm-tools-devel-10.2.5-3.el7.x86_64.rpm 的公鑰尚未安裝 29 open-vm-tools-devel-10.2.5-3.el7.x86_64.rpm | 157 kB 00:00 30 從 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 檢索密鑰 31 導入 GPG key 0xF4A80EB5: 32 用戶ID : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>" 33 指紋 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5 34 軟件包 : centos-release-7-6.1810.2.el7.centos.x86_64 (@anaconda) 35 來自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 36 Running transaction check 37 Running transaction test 38 Transaction test succeeded 39 Running transaction 40 正在安裝 : open-vm-tools-devel-10.2.5-3.el7.x86_64 1/1 41 驗證中 : open-vm-tools-devel-10.2.5-3.el7.x86_64 1/1 42 43 已安裝: 44 open-vm-tools-devel.x86_64 0:10.2.5-3.el7 45 46 完畢!
1 [root@zookeeper0 admin]# vmhgfs-fuse .host:/ /mnt/hgfs 2 [root@zookeeper0 admin]# cd /mnt/hgfs 3 [root@zookeeper0 hgfs]# cd /mnt/hgfs/solrcloud 4 [root@zookeeper0 solrcloud]# ll 5 總用量 50252 6 drwxrwxrwx. 1 root root 4096 7月 24 10:39 apache-tomcat-8.5.24 7 drwxrwxrwx. 1 root root 0 7月 24 10:39 solr6.6.3-8983 8 drwxrwxrwx. 1 root root 0 7月 25 11:04 solr6.6.3-8984 9 drwxrwxrwx. 1 root root 4096 7月 24 10:51 vmware 10 drwxrwxrwx. 1 root root 4096 7月 25 10:57 zookeeper-3.4.10 11 -rwxrwxrwx. 1 root root 35042811 12月 19 2018 zookeeper-3.4.10.tar.gz 12 -rwxrwxrwx. 1 root root 16402010 7月 23 16:22 zookeeper-3.4.5.tar.gz
復制壓縮包到指定文件
1 [root@zookeeper0 solrcloud]# cp zookeeper-3.4.10.tar.gz /data/zookeeper 2 [root@zookeeper0 solrcloud]# mkdir -p /data/zookeeper && cd /data/zookeeper 3 [root@zookeeper0 zookeeper]# tar -zxf zookeeper-3.4.10.tar.gz

