linux的nfs檔案共享

2021-07-04 08:56:49 字數 765 閱讀 7130

a. 安裝nfs服務

#apt-get install nfs-common nfs-kernel-server portmap

其中portmap可能被替換了,會提示selecting 'rpcbind' instead of 'portmap'

所以你檢查有沒安裝rpcbind,不用安裝portmap了。

b. 配置nfs服務

#vim /etc/exports

在最後新增上

/nfs/ 192.168.1.*(rw,sync,no_root_squash)

/nfs : 共享目錄

192.168.1.* : 可以訪問這個伺服器共享目錄的機器

rw,sync,no_root_squash:代表各種屬性

c. 重啟服務

# /etc/init.d/nfs-kernel-server restart

要先開啟portmap服務

d. 使用nfs服務

mount -t nfs -o nolock 192.168.1.100:/a/ /b/

-t vfstype 指定檔案系統的型別,通常不必指定。mount 會自動選擇正確的型別。

-o nolock。參考

df -h可以檢視有掛載成功,

也可以umount a/看會不會提示沒有掛載到,因為沒掛載怎麼解除安裝

開發板和虛擬機器不通時,例如mount時連線失敗,先讓2臺機器ping通一下,再mount

參考:

Linux 檔案共享 NFS

需求 要實現網路中檔案的共享,用samba比較麻煩,就用nfs nfs是network file system的縮寫,即網路檔案系統。nfs是由sun開發並發展起來的一項用於在不同機器,不同作業系統之間通過網路互相分享各自的檔案。nfs server也可以看作是乙個file server,用於在un...

nfs檔案共享(Linux)

將 192.168.1.171 root share 共享,掛載到 192.168.1.172 的目錄 root share 服務端和客服端都安裝 nfs yum y install nfs utils rpcbind chkconfig rpcbind on chkconfig nfs on se...

Linux安裝nfs共享檔案

yum install y nfs utils rpcbind或者 yum install y nfs utils yum install y rpcbindyum install y nfs utils設定開機自啟動 systemctl enable nfs systemctl enable rp...