1.首先安裝nfs-kernel-server apt-get install nfs-kernel-server 2.然後創建一個目錄: mkdir -p /opt/share 並賦予許可權777: chmod -R 777 /opt/share 3.在/etc/exports文件中添加配置:(打開 ...
1.首先安裝nfs-kernel-server
apt-get install nfs-kernel-server
2.然後創建一個目錄:
mkdir -p /opt/share
並賦予許可權777:
chmod -R 777 /opt/share
3.在/etc/exports文件中添加配置:(打開文件的命令:cd /etc/exports)
/opt/share 10.112.18.0/255.255.255.0(rw,no_root_squash)
(說明:rw:掛接此目錄的客戶端對該共用目錄具有讀寫許可權,no_root_squash:root用戶具有對根目錄的完全管理訪問許可權。)
在/etc/hosts.allow中添加配置:
portmap:10.112.18.0/255.255.255.0
在/etc/hosts.deny中添加配置:
portmap:ALL
4.重新啟動兩個服務(重新啟動portmap和nfs-kernel-server兩個服務):
service portmap restart
service nfs-kernel-server restart
5.在另一臺Ubuntu上安裝nfs-common
apt-get install nfs-common
然後創建目錄test
mkdir ~/test
然後運行測試命令看一下:
# showmount -e 10.112.18.158
Export list for 10.112.18.158:
/opt/share 10.112.18.0/255.255.255.0
找到nfs server的掛載目錄了。現在手工掛載:
mount -t nfs4 10.112.18.158:/opt/share ~/test/