1.NFS軟件的安裝
NFS服務有兩個必須的軟件包①nfs-utils,NFS主程序②rpcbind,RPC主程序;
查看NFS軟件包
[root@NFS ~] # rpm -qa | egrep "nfs|rpcbind"
yum源配置好後,直接用yum安裝
[root@NFS ~] # yum list | grep nfs-utils #查看安裝包是否存在
[root@NFS ~] # yum list | grep rpcbind
[root@NFS ~] # yum install nfs-utils rpcbind #安裝
2.啓動NFS服務
啓動NFS服務之前先需要先啓動rpcbind服務
[root@NFS ~] # systemctl restart rpcbind #重啓服務
[root@NFS ~] # netstat -tlunp |grep rpcbind #查看端口
[root@NFS ~] # systemctl start nfs #啓動nfs服務
[root@NFS ~] # systemctl enable nfs #設置nfs服務開機自啓
3.配置NFS服務
修改配置文件/etc/exports
[root@NFS ~] # vi /etc/exports
/nfs 192.168.100.0/24(rw,sync,all_squash) #讀寫權限rw,同步更新sync,壓縮來訪賬號all_squash,
#[共享目錄] [客戶端地址1(權限)] [客戶端地址2(權限)]
[root@NFS ~] # /etc/init.d/nfs reload #重新讀取配置文件
4.客戶端掛載
[root@NFS ~] # mount -t nfs 192.168.100.1:/nfs /nfsdisk
[root@NFS ~] # df -h #查看掛載情況