标题ubuntu 16.04搭建nfs服务器
1. 下载和配置服务器
下载:$ apt-get install nfs-kernel-server
配置:$ sudo vi /etc/exports
在文档末尾添加
/root/rootfs *(rw,sync,no_root_squash,no_subtree_check)
其中:/root/rootfs是服务器与客户端之间共享文件的文件夹,需要自定义该目录
执行 $ chmod 777 -R /root/rootfs
// 重启 $ service nfs-kernel-server restart
验证 $ showmount -e
2.下载客户端
下载:$ sudo apt-get install nfs-common
3.启用
$ sudo /etc/init.d/nfs-kernel-server restart 重启 nfs 服务
4.挂载测试
$ mount -t nfs -o nolock localhost:/root/rootfs /mnt
执行后,进入/mnt 目录中,如果可以看到/root/rootfs 中的内容,则说明 nfs 搭建成功!
其中:localhost是指本地服务器端的IP地址,如:192.168.1.121