How to Install and Configure an NFS Server on Ubuntu 20.04

One of the most used tools in business environments and internally is file sharing. For this, we have the possibility to use an NFS server on Ubuntu 20.04. So in this post I will help you to make it ready for use.

NFS is a client/server protocol that allows a computer user to view and optionally store and update files on a remote computer as if they were on the user’s own computer. This has many advantages because all other applications will treat this volume as if it were a local disk.

The mounted part of the file system can be accessed by clients with the privileges assigned to each file (read-only or read/write).

NFS was originally developed by Sun Microsystems in the 1980s, so we are talking about a secure, robust and experienced protocol. It continues to be supported and kept up to date.

So, it is a good idea to use NFS on Ubuntu 20.04 to manage some client space. Let’s go for it.

Install NFS on the Ubuntu Server

On the server, you have to install NFS. This is easy because it is in the official repositories of Ubuntu 20.04 So, in a few minutes run these commands to update the system.

sudo apt update
sudo apt upgrade

Then, install NFS

sudo apt install nfs-kernel-server

When the process finishes, you will be able to check the status of the service that has been created to manage NFS.

For example,

sudo systemctl status nfs-kernel-server

This way you will verify that the process is going well so far.

Configure a new folder to share with NFS

Now create a new folder that you want to share with the clients that will access it. For example,

mkdir -p /home/user/nfsshared

Set appropriate permissions on the folder. If you want it to have read and write permissions, then this command may work for you.

chmod 755 -R /home/user/nfsshared

To apply these changes, we have to set up a configuration on the system

So, you have to edit a configuration file.

sudo nano /etc/exports

And add the following configuration.

/home/user/nfsshared [client-IP-Address](rw,no_subtree_check)

You can add several IP addresses but each with different options. rw gives write and read permissions.

Close the editor after saving changes.

Now you have to restart the NFS service for these changes to take effect.

sudo systemctl restart nfs-kernel-server

FS works through port 2049 So, it has to be open on the firewall.

sudo ufw allow 2049

On the server side, we are done. Now it is time to work on the client.

Install and configure NFS on the Ubuntu Client

On the computer that will act as the client you have to install NFS but just install the installer.

sudo apt install nfs-common

Then, create a new folder where the remote volume will be mounted. For example,

sudo mkdir -p /var/nfsfolder

Now you only need to mount the folder remotely to the created folder

sudo mount host_ip:/home/user/nfsshared /var/nfsfolder

This way we will be able to use it without any problems.


NFS is an easy tool to configure and use in Linux. In addition to this it allows us to have many advantages to share folders, files and volumes.

So, help us to grow and share this post with your friends.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top