Ubuntu 16.04: Install nfs-kernel-server and run NFS server

This article will describe installing nfs-kernel-server and running NFS server.

 

1 System environment

IP Address of NFS server is 192.168.11.66.

Export directory to 192.168.11.0/24 network.

2 Install nfs-kernel-server

Install nfs-kernel-server with apt.

$ sudo apt-get install -y nfs-kernel-server

3 Export directory

Export /opt/nfs to 192.168.11.0/24 network.

$ sudo mkdir -p /opt/nfs
$ sudo su -c "echo '/opt/nfs 192.168.11.0/24(rw,sync,no_subtree_check,no_root_squash)'  \
>> /etc/exports" $ sudo exportfs -ra

4 Run nfs-kernel-server

Run nfs-kernel-server with systemd.

$ sudo systemctl enable nfs-kernel-server.service
$ sudo systemctl start nfs-kernel-server.service

5 Execution result

Access from 192.168.11.0/24 network machine to NFS server. If nfs mount on Ubuntu 16.04, nfs-common package is needed.

$ sudo apt-get install -y nfs-common
$ sudo mount -t nfs 192.168.11.66:/opt/nfs /mnt