Preface
- Two Ubuntu 20.04 servers, used as server and client respectively
- Main reference: https://www.tecmint.com/install-nfs-server-on-ubuntu/
NFS Server configuration
install software
sudo apt install nfs-kernel-server -y
Create a shared directory
sudo mkdir -p /mnt/nfs_share
Modify the owner and read and write permissions of the shared directory
sudo chown -R nobody:nogroup /mnt/nfs_share/ sudo chmod 777 /mnt/nfs_share/
Edit
/etc/exports
, modify the permissions of the shared directory to the client/mnt/nfs_share 192.168.1.222/32(rw,sync,no_subtree_check)
Restart the service for the configuration to take effect
sudo exportfs -a sudo systemctl restart nfs-kernel-server
NFS Client configuration
install software
sudo apt install nfs-common -y
Create mount point
sudo mkdir -p /mnt/nfs_share
Mount the shared directory
sudo mount 192.168.1.111:/mnt/nfs_share /mnt/nfs_share
Automatically mount at
/etc/fstab
, add in 060b732b862d2d192.168.1.111:/mnt/nfs_share /mnt/nfs_share nfs rw 0 0
verification
Create a file on the client
cd /mnt/nfs_share echo HaHaHa > h.txt
Go to the server to view
cd /mnt/nfs_share cat h.txt
This article is from qbit snap
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。