What NFS is
NFS (Network File System) lets one computer share a folder, and other computers use it as if it were on their own disk. People use it for shared storage, teamwork on files, central file management and easy growth of storage.
On the server
Update the system and install the NFS server
sudo apt update && sudo apt upgrade -y

sudo apt install nfs-kernel-server

Create the shared folder
sudo mkdir -p /var/nfs/share

-p makes the parent folders too, and does not complain if the folder exists.
Set the owner and permissions
sudo chown nobody:nogroup /var/nfs/share
sudo chmod 755 /var/nfs/share

(The original steps used chmod 777. That lets everyone write. Use 755 or a group-based setup unless you really need open access.)
Set the exports
Open the exports file:
sudo nano /etc/exports

Add one line. Replace the network with your own (or the IP address of the client):
/var/nfs/share 192.168.1.0/24(rw,sync,no_subtree_check)

rwallows reading and writing.syncwrites changes to disk before it answers.no_subtree_checkavoids some checks that slow down the server.
Apply the exports
sudo exportfs -a

Start and enable the service
sudo systemctl start nfs-server
sudo systemctl enable nfs-server
sudo systemctl status nfs-server

startruns it now,enableruns it at boot,statusshows if it works.
Open the firewall
Allow NFS only from your network:
sudo ufw allow from 192.168.1.0/24 to any port nfs
sudo ufw enable
sudo ufw status

On the client
Install the NFS client:
sudo apt install nfs-common

Mount the share (replace server_IP):
sudo mount server_IP:/var/nfs/share /mnt
To mount it at boot, add a line to /etc/fstab:
echo 'server_IP:/var/nfs/share /mnt nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0' | sudo tee -a /etc/fstab

Test it by writing a file in /mnt on the client and looking for it in /var/nfs/share on the server.
Why use NFS
- Collaboration. Teams share files on one place.
- Central management. One place to back up and control.
- Scalability. Add storage without changing the clients.
- Convenience. No manual copying between machines.
Quick recap
- Install
nfs-kernel-server, create a folder and add it to/etc/exports. - Run
exportfs -aand open the firewall for your network. - Mount it on clients with
mount server_IP:/path /mnt.