1. Install NFS service:
Server side: sudo apt install nfs-kernel-server
Server side: sudo apt install portmap (if you install the previous one, you don’t need to perform this operation)
Client: sudo apt install nfs-common
2. Modify the NFS configuration file
1) Configure portmap
sudo vim /etc/default/portmap
-i 127.0.0.1
2) Configure /etc/hosts.allow
$ sudo vim /etc/hosts.allow
3. Configure /etc/exports
NFS mount directory and permissions are defined by the /etc/exports file.
$sudo vim /etc/exports For
example, if I want to share the /home/lin/NFSshare directory in my home directory with the IP of 192.168.66.*, add the following statement at the end of the file:
/home/lin/NFSshare 192.168.66.*(rw,sync,no_root_squash)
Then save and exit.
4. Restart the nfs service
$ sudo /etc/init.d/nfs-kernel-server restart