Setting up NFS on Ubuntu 16.04

Make sure userid’s and groupid’s match between the systems

  • e.g. usermod -u 1001 -g 504 -c "Andrew Fountain" andrewf

Set up the server

  • set up the fully qualified domain name, e.g. server.example.org
vi /etc/hosts         # ensure it contains the line: 127.0.1.1 server.example.org
vi /etc/idmapd.conf   # ensure it contains the line: Domain = example.org (not the name of the server but the domain)
hostnamectl set-hostname server.example.org
#pre sytemed edit /etc/hostname manually, and also run hostname server.example.org
  • install the software
apt install nfs-kernel-server
vi /etc/exports
  • create a line for each directory to be exported
    sharediry client-ip-range(share_options1,...)
  • e.g.:
/home         192.168.1.0/24(rw,sync,no_subtree_check,fsid=0,no_root_squash)
/home/andrewf 192.168.4.0/24(rw,sync,no_subtree_check,no_root_squash)
ufw status #see if firewall turned on. If so, will need to run: ufw allow ...
systemctl restart nfs-kernel-server
#for 14.04:
exportfs -a
service nfs-kernel-server start

Set up the client

  • make sure /etc/idmapd.conf contains Domain = FQDN
apt install nfs-common
sv3:/   /home/andrewsv3    nfs noatime,actimeo=1800,rsize=8192,wsize=8192 0 0
david:/ /home/andrew/d  nfs noatime,actimeo=1800,rsize=8192,wsize=8192,nolock,nfsvers=4 0 0

Problems

Resources