sudo su
apt update
apt upgrade -y
apt install -y nfs-kernel-server
Create export directory (NFS directory).
sudo mkdir -p /mnt/nfs_dir
chown {{ your_user }}:{{ your_user_group }} /mnt/nfs_dir
chmod 777 /mnt/nfs_dir
Configuring NFS server.
vim /etc/exports
# Add the line follows
/mnt/nfs_dir 192.168.100.0/24(rw,sync,no_subtree_check)
Open port for NFS (TCP 2049)
ufw allow from 192.168.100/24 to any port nfs
Apply the cofiguration and start NFS.
exportfs -a
systemctl restart nfs-kernel-server
sudo apt update
sudo apt install -y nfs-common
sudo mkdir -p /mnt/nfs_dir
sudo mount `{{ your.nfs.server.com }}:/mnt/nfs_dir /mnt/nfs_dir
Done!!
If you create /mnt/nfs_dir/test.txt
on a server, it will shared with the other.