本来想通过软连接的方法来实现想要的功能,结果因为是类似快捷方式,所以网站文件系统无法显示里面的内容,硬链接又不能连接文件夹,只能选择NFS的方式进行了。
安装需要的包:
sudo apt install rpcbind sudo apt-get install nfs-kernel-server
然后重启服务:
sudo service rpcbind start sudo /etc/init.d/nfs-kernel-server restart
打开配置文件:
sudo gedit /etc/exports
文件内容:
# /etc/exports: the access control list for filesystems which may be exported # to NFS clients. See exports(5). # # Example for NFSv2 and NFSv3: # /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check) # # Example for NFSv4: # /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check) # /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check) # /home/mcj/bigdisk/anzhuangbao/share 172.25.*.*(rw,async,no_root_squash)
我这里是对share文件夹进行映射。
进行映射:
按照国际惯例,禁止伸手党:
查看映射:
showmount -e localhost #Export list for localhost: #/home/mcj/bigdisk/anzhuangbao/share (everyone)
停止映射:
umount 172.25.17.39:/home/mcj/bigdisk/anzhuangbao/share
Centos下:
本文最后更新于2021年9月23日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!