安装 NFS 服务器所需的软件包
服务器 10.44.154.200
安装nfs:yum -y install nfs-utils rpcbind
编辑exports文件
编辑/etc/exports,增加一行
/mnt/files/stone 10.170.184.39(rw,no_root_squash,no_all_squash,sync)
生效 exportfs -r
如图xian'shi没问题
查看 exportfs
为rpcbind和nfs做开机启动
systemctl enable rpcbind.service
systemctl enable nfs-server.service
手动启动
命令:service rpcbind start
service nfs start
查看已共享的目录,命令:
本机:showmount -e
其他:showmount -e IP
![image](http://upload-images.jianshu.io/upload_images/6734341-9533376b568efeba?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
安装NFS 客户端
客户端机器 10.170.184.39
systemctl enable rpcbind.service
systemctl start rpcbind.service
挂载远程目录
mount -t nfs -o nolock,nfsvers=3,vers=3 -o proto=tcp 10.44.154.200:/mnt/files/stone /home/mnt/files/stone
查看结果
设置开机挂载,编辑/etc/fstab
vi /etc/fstab
加上
10.44.154.200:/mnt/files/stone /home/mnt/files/stone:/ /data nfs4 ro,hard,intr,proto=tcp,port=2049,noauto 0 0