# Configuring NFS Server on Linux

# on Server

NFS Server
~$ sudo apt install nfs-kernel-server
~$ sudo mkdir /nfs
~$ sudo chmod a+w /nfs
~$ sudo cat >>/etc/exports <<EOF
/nfs  10.10.10.222/24(rw,sync,no_subtree_check)
EOF
~$ sudo systemctl enable nfs-kernel-server
~$ sudo ufw allow from 10.10.10.1/24 to any port nfs
~$ showmount -e localhost

# on Client

NFS Client
~]$ showmount -e 192.168.184.148
Export list for 192.168.184.148:
/nfs *
~]# mkdir /backup
~]# mount 192.168.184.148:/nfs /backup
~]# df -hT | grep nfs
192.168.184.148:/nfs        nfs4       47G  6.1G   41G  13% /backup

# /etc/exports - NFS server export table

A line for an exported file system has the following structure:

<export> <host1>(<options>)

There should be no space between "host" and "(option)", otherwise there will be permission issues. Like touch: cannot touch ‘1’: Read-only file system

Edited on