Ubuntu 18.04: Install nfs-common for NFS client

This article will describe installing nfs-common for NFS client.

1 Install nfs-common

Install nfs-common package.

$ sudo apt install -y nfs-common

2 Mount NFS with mount.nfs

Mount NFS with mount.nfs to /mnt directory.

$ NFS_SERVER=nfs-server.hiroom2.com
$ NFS_DIR=/srv/nfsshare
$ sudo mount -t nfs ${NFS_SERVER}:${NFS_DIR} /mnt

3 Mount NFS on boot

Add mount entry to /etc/fstab. For avoiding mounting NFS before network initialization, you need to add _netdev option. For making x-systemd.automount to mount NFS, you need to add x-systemd.automount to option.

$ cat <<EOF | sudo tee -a /etc/fstab
${NFS_SERVER}:${NFS_DIR}/nfsshare /mnt nfs _netdev,x-systemd.automount 0 0
EOF