This small guide will show you how to install and configure nfs server in Ubuntu 20.04.Since nfs v4 depends on KDC ,we use nfs v3 here.

1.Install nfs server package

sudo apt update
sudo apt install nfs-kernel-server

2.Create a directory which we will export

sudo mkdir -p /share/dir01

3.Edit /etc/exports ,add below line

/share/dir01       *(rw,sync,no_subtree_check)

4.Restart nfs server or run command “exportfs -ra”

sudo systemctl restart nfs-server

OR

sudo exportfs -ra

run command exportfs to verify

j@ubuntu:~$ sudo exportfs
/share/dir01  	<world>
j@ubuntu:~$

5.Test nfs server from client

sudo mkdir /mountp1
sudo mount nfs-servernameorip:/share/dir01 /mountp1

For more inforation regarding /etc/exports , just “man exports”