How to Install Network File System (NFS) on Ubuntu Server 20.04

Network File System (NFS) is a distributed filesystem protocol that allows clients to access remote files and directories as if they are available on the local system. This allows client systems to leverage large centrally shared storage. Users can access the same data from any system across the network. A typical setup for NFS includes a server that runs the NFS daemon, nfsd, and lists (export) files and directories to be shared. A client system can mount these exported directories as their local file system.

You will need two Ubuntu systems: one as a central NFS server and another as a client. The following is an example IP address configuration for the Host and Client systems:

Host -
Client -

Installing the Network File System

Follow these steps to install NFS:

Step 1 : First, we need to install the NFS server

sudo apt-get update
sudo apt-get install nfs-kernel-server

Step 2 : Create the directories to be shared:

sudo mkdir /var/nfs

Step 3 : Add this directory to NFS exports under /etc/exports

sudo nano /etc/exports

Step 4 : Add the following line to /etc/exports

/var/nfs         *(rw,sync,no_subtree_check)

Step 5 : Save and close the exports file.

Step 6 : Now, restart the NFS service

sudo service nfs-kernel-server restart

Step 7 : Next, we need to configure the client system to access NFS shares.

Create a mount point for NFS shares

Step 1 : Install the nfs-common package on the client side

sudo apt-get install nfs-common
sudo mkdir -p /var/nfsshare
sudo chmod 777 /var/nfs

Step 2 : Mount the NFS shared directory on the newly-created mount point

sudo mount /var/nfsshare

Step 3 : Confirm the mounted share with the following command:

mount -t nfs

Step 4 : Now, change the directory to /var/nfsshare, and you are ready to use NFS

Add Comment