注意:在啓動任何一個NFS之前,必須做好端口和功能的對應映射工作,這個工作由rpcbind完成;
一、服務端環境搭建
1、nfs-utils:NFS服務主程序;
yum install -y nfs-utils
2、rpcbind服務;
yum install -y rpcbind3、啓動順序:先開啓rpcbind,再開啓nfs服務;
systemctl start rpcbind.service
systemctl start nfs-server.service
4、設置開機自啓動;
systemctl enable rpcbind.service
或者:
( ln -s /usr/lib/systemd/system/rpcbind.service /etc/systemd/system/multi-user.target.wants/rpcbind.service)
systemctl enable nfs-server.service
5、關閉防火牆並關閉開啓自啓動;
6、編輯/etc/exports,並平滑重啓nfs服務;
/data 192.168.1.0/24(rw,sync)
systemctl reload nfs-server.service
7、設置共享目錄屬主、權限;
二、客戶端環境搭建;
1、rpcbind服務;
yum install -y rpcbind
2、開啓rpcbind服務,並設置開機自啓動;
systemctl start rpcbind.service
systemctl enable rpcbind.service
3、關閉防火牆並關閉開機自啓動;
systemctl stop firewalld
systemctl disable firewalld
4、查看nfs共享,並掛載;
showmount -e nfs服務器IP:共享目錄
mount -t nfs nfs服務器IP:/data /mnt