天天看點

NFS安裝配置

準備兩台機器,此處lsx02(192.168.1.12)服務端、lsx01(192.168.1.226/24)用戶端。

lsx02(192.168.1.12)服務端

yum install -y nfs-utils rpcbind //用戶端也需安裝nfs-utils包

lsx01(192.168.1.226/24)

yum install -y nfs-utils

服務端

vim /etc/exports //加入如下内容

/home/nfstestdir //分享的出去的目錄。比如A機器分享給BC機器,那分享的目錄要一樣

192.168.133.0/24(rw,sync,all_squash,anonuid=1000,anongid=1000) //定義分享給哪些機器及其選項。

[root@server ~]# systemctl reload nfs

儲存配置檔案後,執行如下準備操作

[root@lsx03 ~]# netstat -ltnp

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name 

tcp 0 0 127.0.0.1:25 0.0.0.0: LISTEN 2003/master 

tcp 0 0 0.0.0.0:111 0.0.0.0: LISTEN 1/systemd 

tcp 0 0 0.0.0.0:22 0.0.0.0: LISTEN 1155/sshd 

tcp6 0 0 ::1:25 ::: LISTEN 2003/master 

tcp6 0 0 :::111 :::* LISTEN 1/systemd

mkdir /home/nfstestdir

chmod 777 /home/nfstestdir

systemctl start rpcbind //(rpc已經啟動可以省略)

systemctl start nfs

systemctl enable rpcbind //開機啟動(用戶端省略)

systemctl enable nfs //開機啟動(用戶端省略)

systemctl disable nfs //取消開機啟動

本文轉自 蝦米的春天 51CTO部落格,原文連結:http://blog.51cto.com/lsxme/2054795,如需轉載請自行聯系原作者

繼續閱讀