碼迷,mamicode.com
首頁 > 系統相關 > 詳細

安裝VMWare tools,踩坑。記錄一下

時間:2019-02-28 13:21:19      閱讀:3320      評論:0      收藏:0      [點我收藏+]

標簽:reboot   命令   drive   script   first   distrib   mct   mpi   pil   

對于沒錢買服務器的小白,只能靠安裝虛擬機來勉強度日子。
最近比較閑,想實現一下docker的自動化部署,在制作java8鏡像時出了個問題。
就是怎么在虛擬機上實現與本機文件夾的共享。

坑了2天。記錄一下,環境 VMware® Workstation 12 Pro + CentOS 

1. 首先是 CD/DVD(SATA) 這里的話 選擇VMan安裝目錄的 linux.iso (C:\Program Files (x86)\VMware\VMware Workstation\linux.iso)

這里選擇這個 是因為這里包含了 一些工具包,(https://www.linuxidc.com/Linux/2016-04/130806.htm)

技術圖片

選好后 ,打開虛擬機。技術圖片

由于這里以及安裝過了,所以是 重新安裝。
點擊安裝后,會彈出一個框。

客戶機操作系統已將 CD-ROM 門鎖定,并且可能正在使用 CD-ROM,這可能會導致客戶機無法識別介質的更改。如果可能,請在斷開連接之前從客戶機內部彈出 CD-ROM。確實要斷開連接并覆蓋鎖定設置嗎?

這個可以無視,不過。點了后。連接的虛擬機就不能用了。

2. 輸入如下命令 
[[email protected] ~]# mkdir /mnt/cdrom --創建文件夾
輸入 注意空格 
[[email protected] ~]#mount /dev/cdrom /mnt/cdrom/  -- 通俗地理解為將iso文件 掛載到 /mnt/cdrom 文件夾下

3。進入/mnt/cdrom 會出現一堆文件。
[[email protected] ~]# cd /mnt/cdrom/  

[[email protected] cdrom]# ls

技術圖片

主要是那個紅色的文件。將氣拷貝至其他目錄路

cp VMWareTools-10.0.10-4301679.tar.gz /home/VMWareTools-10.0.10-4301679.tar.gz

4. 進入目錄/home,解壓VMWareTools-10.0.10-4301679.tar.gz,解壓后出現vmware-tools-distrib

  cd /home

  tar -zxf  VMWareTools-10.0.10-4301679.tar.gz

技術圖片

5.進入目錄vmware-tools-distrib,運行安裝文件./vmware-install.pl ,這里如果沒有編譯環境會報錯(bash: ./vmware-install.pl: /usr/bin/perl: bad interpreter: ......)。

則需要安裝  yum install perl gcc kernel-devel  安裝后。在運行安裝文件./vmware-install.pl

有[yes] 直接輸入yes, 沒有的直接回車。只到出現了一個重復的問題。以下是安裝日志。

open-vm-tools packages are available from the OS vendor and VMware recommends
using open-vm-tools packages. See http://kb.vmware.com/kb/2073803 for more
information.
Do you still want to proceed with this installation? [yes] yes

A previous installation of VMware Tools has been detected.

The previous installation was made by the tar installer (version 4).

Keeping the tar4 installer database format.

You have a version of VMware Tools installed. Continuing this install will
first uninstall the currently installed version. Do you wish to continue?
(yes/no) [yes] yes

Uninstalling the tar installation of VMware Tools.

ValueError: 未定義 /sbin/vmtoolsd 的文件上下文
semanageFcontext: unable to set SELinux fcontext - command: "semanage fcontext
-d /sbin/vmtoolsd"
There was an error removing the local SELinux security context for VMware
Tools. Please make certain SELinux is set up correctly.

Stopping services for VMware Tools

 

This program previously created the file
/lib/vmware-tools/lib64/libconf/etc/gtk-2.0/gdk-pixbuf.loaders, and was about
to remove it. Somebody else apparently did it already.

This program previously created the file
/lib/vmware-tools/lib64/libconf/etc/gtk-2.0/gtk.immodules, and was about to
remove it. Somebody else apparently did it already.

The removal of VMware Tools 10.1.6 build-5214329 for Linux completed
successfully.

Installing VMware Tools.

In which directory do you want to install the binary files?
[/vm-tools]

The path "/vm-tools" does not exist currently. This program is going to create
it, including needed parent directories. Is this what you want? [yes]

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc/rc.d]

What is the directory that contains the init scripts?
[/etc/rc.d/init.d]

In which directory do you want to install the daemon files?
[/sbin]

In which directory do you want to install the library files?
[/lib/vmware-tools]

The path "/lib/vmware-tools" does not exist currently. This program is going to
create it, including needed parent directories. Is this what you want?
[yes] yes

In which directory do you want to install the common agent library files?
[/lib]

In which directory do you want to install the common agent transient files?
[/var/lib]

In which directory do you want to install the documentation files?
[/doc/vmware-tools]

The path "/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

The installation of VMware Tools 10.1.6 build-5214329 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/vm-tools/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/vm-tools/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes] yes

Initializing...


Making sure services for VMware Tools are stopped.

 

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


Before you can compile modules, you need to have the following installed...

make
gcc
kernel headers of the running kernel


Searching for GCC...
Detected GCC binary at "/bin/gcc".
The path "/bin/gcc" appears to be a valid path to the gcc binary.
Would you like to change it? [no] no

Searching for a valid kernel header path... --這里要輸入剛剛安裝的repl 的include
The path "" is not a valid path to the 3.10.0-957.el7.x86_64 kernel headers.
Would you like to change it? [yes] yes

Enter the path to the kernel header files for the 3.10.0-957.el7.x86_64
kernel?

The path "" is not a valid path to the 3.10.0-957.el7.x86_64 kernel headers.
Would you like to change it? [yes] yes

Enter the path to the kernel header files for the 3.10.0-957.el7.x86_64
kernel? ""

Enter the path to the kernel header files for the 3.10.0-957.el7.x86_64
kernel? /usr/src/kernels/3.10.0-957.5.1.el7.x86_64/include

The path "/usr/src/kernels/3.10.0-957.5.1.el7.x86_64/include" is not a valid
path to the 3.10.0-957.el7.x86_64 kernel headers.


Would you like to change it? [yes] no

WARNING: This program cannot compile any modules for the following reason(s)...

- This program could not find a valid path to the kernel headers of the running
kernel. Please ensure that the header files for the running kernel are
installed on this sytem.

[ Press Enter key to continue ]


The filesystem driver (vmhgfs module) is used only for the shared folder
feature. The rest of the software provided by VMware Tools is designed to work
independently of this feature.

If you wish to have the shared folders feature, you can install the driver by
running vmware-config-tools.pl again after making sure that gcc, binutils, make
and the kernel sources for your running kernel are installed on your machine.
These packages are available on your distribution‘s installation CD.
[ Press Enter key to continue ] ...... 

后面yes 回車,輸入即可,只到。

技術圖片

這里就OK啦。然后重啟虛機。 reboot ;

設置共享文件夾。 虛擬機-》設置-》選項。

技術圖片

 

此時在linux中進入 /mnt/hgfs 文件夾,但發現共享的文件沒有顯示  繼續。

[[email protected] ~]$ vmware-hgfsclient
-bash: vmware-hgfsclient: 未找到命令
[[email protected] ~]$ mount -t vmhgfs .host:/vm-share /mnt/hgfs  
mount: 只有 root 用戶能使用“--types”選項
[[email protected] ~]$ sudo mount -t vmhgfs .host:/vm-share /mnt/hgfs (紅字是共享文件夾名稱)
[sudo] temp 的密碼:
Error: cannot mount filesystem: No such device(如提示該錯誤)
[[email protected] ~]$ sudo yum install open-vm-tools (安裝 yum install open-vm-tools)

完成后 。在執行 vmhgfs-fuse .host:/ /mnt/hgfs 

技術圖片

就有共享文件夾啦。

安裝VMWare tools,踩坑。記錄一下

標簽:reboot   命令   drive   script   first   distrib   mct   mpi   pil   

原文地址:https://www.cnblogs.com/yangcl-blogs/p/10449595.html

(0)
(0)
   
舉報
評論 一句話評論(0
登錄后才能評論!
? 2014 mamicode.com 版權所有 京ICP備13008772號-2
迷上了代碼!
河北十一选五基本走势