vmware安装VMware Tools,并设置共享目录
首先,在wmware15上安装好centos7系统后,wmware会提示我们安装wmware tools工具,可以直接点击安装即可,或者直接右键点击虚拟机,选择安装VMware Tools,看下图:
这是替换光盘的,可以先卸载原光盘umount /dev/cdrom
,点击是即可
此时,我们得挂载cdrom,可以先创建一个目录mkdir /media/cdrom
,然后挂载mount /dev/cdrom /media/cdrom
接下来,我们将/media/cdrom的VMwareTools-10.3.21-14772444.tar.gz复制到自己家目录下,并解压,然后执行vmware-install.pl
cp /media/cdrom/VMwareTools-10.3.21-14772444.tar.gz ~
tar -zxvf VMwareTools-10.3.21-14772444.tar.gz
cd vmware-tools-distrib/
./vmware-install.pl
接下来,会进入安装的交互式模式下,一步步说明:
Do you still want to proceed with this installation? [no] yes
In which directory do you want to install the binary files?
[/usr/bin] 直接回车就是选择默认的
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?
[/usr/sbin]
In which directory do you want to install the library files?
[/usr/lib/vmware-tools]
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?
[yes] yes
In which directory do you want to install the common agent library files?
[/usr/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?
[/usr/share/doc/vmware-tools]
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]
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
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
The path "/bin/gcc" appears to be a valid path to the gcc binary.
Would you like to change it? [no]
这里要注意,内核头文件路径为空
Searching for a valid kernel header path...
The path "" is not a valid path to the 3.10.0-1127.el7.x86_64 kernel headers.
Would you like to change it? [yes]
如何解决,可以参考这篇文章https://blog.csdn.net/w790634493/article/details/80525238
具体意思就让uname -r查询的内核版本,kernel-headers,kernel-devel的版本保持一致
然后reboot重启,继续之前的安装步骤,一路走下去,
Searching for a valid kernel header path...
Detected the kernel headers at
"/lib/modules/3.10.0-1127.19.1.el7.x86_64/build/include".
The path "/lib/modules/3.10.0-1127.19.1.el7.x86_64/build/include" appears to be
a valid path to the 3.10.0-1127.19.1.el7.x86_64 kernel headers.
Would you like to change it? [no] 回车
...
...
The vmblock enables dragging or copying files between host and guest in a
Fusion or Workstation virtual environment. Do you wish to enable this feature?
[yes]
Would you like to enable VMware automatic kernel modules?
[yes] no
Do you want to enable Guest Authentication (vgauth)? Enabling vgauth is needed
if you want to enable Common Agent (caf). [yes] no
到此,后面不出错的话,安装基本完成
现在,让我们配置虚拟机与主机的共享目录:
本地主机:C:\www\centos7-workerman
这个也可以启用起来,很有用
vmware tools虚拟机中共享的默认位置为/mnt/hgfs/,接下来,我们还得安装一下这个yum install open-vm-tools-devel -y
不然下面的挂载很可能会报错;
在/etc/fstab文件中,添加挂载点
vim /etc/fstab
...
.host:/centos7-workerman /www/wwwroot fuse.vmhgfs-fuse allow_other,uid=1000,gid=1000,umask=022 0 0
mkdir -p /www/wwwroot/
mount -a
其中的centos7-workerman就是上面本地主机目录的别名,/www/wwwroot就是虚拟机系统中的目录,allow_other,uid=1000,gid=1000,umask=022这个就是允许某用户访问权限的,可不写,换成defaults
mount -a 不出错,则检查共享同步情况
至此,本地主机和虚拟机系统之间的目录共享设置完毕
另外,对于安装时的英文,看不懂可以用翻译软件
本作品采用《CC 协议》,转载必须注明作者和本文链接