安裝nfs-kernel-server
sudo apt-get install nfs-kernel-server -y
匯出資料夾
sudo mkdir /mnt/sharedfolder
cat /etc/exports
/mnt /sharedfolder 192.168.1.0/24(rw,no_root_squash,no_subtree_check)
sudo chown -R nobody:nogroup /mnt/sharedfolder
sudo chmod 777 /mnt/sharedfolder
sudo exportfs -ra
掛載NFS
在客戶端
sudo mkdir /mnt/nfs_sharedfolder
sudo apt-get install nfs-common -y
sudo mount -t nfs 192.168.1.100:/mnt/sharedfolder /mnt/nfs_sharedfolder
(伺服器假設在192.168.1.100)
若要開機自動掛載,在客戶端/etc/fstab下,加入下列一句﹕
192.168.1.100:/mnt/sharedfolder /mnt/nfs_sharedfolder nfs rw,x-gvfs-show,user
從新啟動客戶端便自動掛載﹗