How to install the NFS server on Ubuntu?
Published on Aug. 22, 2023, 12:20 p.m.
To install the NFS server on Ubuntu, you can follow these steps:
- Update the system packages by running the command:
sudo apt update
. - Install the NFS kernel server by running the command:
sudo apt install nfs-kernel-server
. - Create a shared directory that you want to share with other machines, for example:
sudo mkdir /var/nfs/general
. - Set directory permissions by running the command:
sudo chown nobody:nogroup /var/nfs/general
. - Set file permissions by running the command:
sudo chmod 777 /var/nfs/general
. - Configure NFS export by editing the
/etc/exports
file. Add the following line to the end of the file:/var/nfs/general *(rw,sync,no_subtree_check)
. This line indicates that the directory/var/nfs/general
is being shared with all machines with read and write permissions. - Restart the NFS server by running the command:
sudo systemctl restart nfs-kernel-server
.
After completing these steps, you should have a working NFS server that is sharing the /var/nfs/general
directory with other machines on your network.