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:

  1. Update the system packages by running the command: sudo apt update.
  2. Install the NFS kernel server by running the command: sudo apt install nfs-kernel-server.
  3. Create a shared directory that you want to share with other machines, for example: sudo mkdir /var/nfs/general.
  4. Set directory permissions by running the command: sudo chown nobody:nogroup /var/nfs/general.
  5. Set file permissions by running the command: sudo chmod 777 /var/nfs/general.
  6. 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.
  7. 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.

Tags: