1.在VMware中设置共享文件夹
2.在Linux中安装vm-tools:
yum install -y open-vm-tools open-vm-tools-desktop
3.挂载:
查看共享的目录
vmware-hgfsclient
运行结果会出现你设置共享的目录
执行命令挂载目录
mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other,nonempty
修改数据令系统启动时自动挂载
vim /etc/fstab# 在末尾另起一行 添加:.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other 0 0# :wq保存退出
再次挂载目录
vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other,nonempty
查看是否成功
ls /mnt/hgfs
运行结果检查是否正常,出现共享目录即成功
4.软连接至网站根目录:
ln -s /mnt/hgfs/html /var/www
访问网页时Fobidden的解决方法:关闭SELinux:
查看SELinux状态:
方法1:
/usr/sbin/sestatus -v
方法2:
getenforce
关闭SELinux:
方法1:临时关闭(设置为permissive模式,不用重启):
setenforce 0 # 1:设置为enforcing模式(开启)
方法2:修改配置文件(需要重启):
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled