Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Configure NFS Client

NFS

After deploying an NFS server, to mount NFS shares as a client, you need to run the following command to install the relevant packages:

sudo apt-get install nfs-common -y

Mount the NFS by adding a line to your /etc/fstab file like below:

$NFS_HOST_IP:$HOST_EXPORT_DIR_PATH $LOCAL_DIR nfs auto 0 0
The last 0 indicates that we should never perform filesystem checks for this on boot (fsck).

Now run the following command to mount everything in your fstab.

sudo mount -a

If you just want to mount once, and not automatically on startup, then instead of adding to your fstab and calling mount -a, simply run this instead:

sudo mount $NFS_HOST_IP:$HOST_EXPORT_DIR_PATH $LOCAL_DIR

References

Last updated: 16th August 2018
First published: 16th August 2018