一、服务器端安装
yum install rpcbind nfs-utils
立即启动,配置开机自动启动
systemctl start rpcbind && systemctl enable rpcbind systemctl start nfs-server && systemctl enable nfs-server
修改/etc/exports,添加如下内容
/root/nfs/share *(rw,sync,insecure,no_subtree_check,no_root_squash)
更新配置并显示详情
exportfs -rv
禁用防火墙,或放行相关端口
firewall-cmd --add-port=111/tcp –permanent firewall-cmd --add-port=892/tcp –permanent firewall-cmd --add-port=2049/tcp –permanent
二、客户端安装
yum install nfs-utils
测试是否成功连接服务器
showmount -e 192.168.137.31
文件夹映射挂载
mkdir testshare mount -t nfs 192.168.137.31:/root/nfs/share /root/testshare
三、客户端测试
echo "test">>a.txt
服务器结果
修改/etc/fstab
增加以下内容,否则重启后需重新挂载
192.168.137.31:/root/nfs/share /root/testshare nfs defauts 0 0
标签:rpcbind,firewall,nfs,systemctl,NFS,服务器,root,搭建 From: https://www.cnblogs.com/heho/p/16925570.html