Atlantic.Net Blog

How to Install and Configure NFS Server on Debian 11

NFS, also called “Network File System,” is a network file sharing protocol that allows us to share and mount a remote file system over the network. It works in a client-server architecture and allows multiple systems or users to access the same shared folder or file. With NFS, you can share a common application among multiple users, eliminating the need for local disk space and reducing storage costs.

In this post, we will show you how to install and configure an NFS server on Debian 11.


  • A server running Debian 11 on the Atlantic.Net Cloud Platform
  • A root password is configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Debian 11 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your server, run the following command to update your base system with the latest available packages.

apt-get update -y

Step 2 – Install NFS Server

By default, the NFS package is included in the Debian 11 default repository. You can install it by just running the following command:

apt-get install nfs-kernel-server -y

Once the NFS server has been installed, you can proceed to the next step.

Also Read

How to Install FTP Server with ProFTPD on Oracle Linux 8

Step 3 – Create the Export Directory

Next, you will need to create a directory that you want to share with the client machine. You can create it with the following command:

mkdir /nfsshare

Next, create some files inside the shared directory:

touch /nfsshare/file1.txt
touch /nfsshare/file2.txt

Next, set proper permissions on the created directory:

chown nobody:nogroup /nfsshare
chmod 755 /nfsshare

Also Read

How to Use chown (Change Ownership) Command in Linux

Step 4 – Configure the Export Directory

Next, you will need to edit the NFS server main configuration file and define the path of the directory that you want to share. You can do it with the following command:

nano /etc/exports

Add the following line:

/nfsshare    nfs-client-ip(rw,sync,no_subtree_check)


  • rw – Provide read and write access on the shared directory.
  • sync – Reply to requests only after the changes have been committed to stable storage.
  • no_subtree_check – Disables subtree checking.

Save and close the file when you are finished. Finally, restart the NFS service to apply the changes:

systemctl restart nfs-server

You can check the status of NFS using the following command:

systemctl status nfs-server

You will get the following output:

‚óŹ nfs-server.service - NFS server and services
     Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor preset: enabled)
     Active: active (exited) since Sat 2022-01-29 05:50:54 UTC; 6s ago
    Process: 2117 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
    Process: 2118 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
   Main PID: 2118 (code=exited, status=0/SUCCESS)
        CPU: 7ms

Jan 29 05:50:53 nfsserver systemd[1]: Starting NFS server and services...
Jan 29 05:50:54 nfsserver systemd[1]: Finished NFS server and services.

Step 5 – Install and Configure NFS Client

Next, you will need to install the NFS client package on the remote system and access the NFS share.

Run the following command to install the NFS client package:

apt-get install nfs-common -y

Now, mount the remote shared directory on the /mnt directory using the following command:

mount nfs-server-ip:/nfsshare /mnt

Next, verify the NFS mount using the following command:

df -h

You should see the NFS mount in the following output:

Filesystem             Size  Used Avail Use% Mounted on
udev                   976M     0  976M   0% /dev
tmpfs                  199M  388K  198M   1% /run
/dev/sda1               50G  1.5G   46G   4% /
tmpfs                  992M     0  992M   0% /dev/shm
tmpfs                  5.0M     0  5.0M   0% /run/lock
tmpfs                  199M     0  199M   0% /run/user/0   50G  1.5G   46G   4% /mnt

You can also list all files inside the shared directory using the following command:

ls -l /mnt

You will get the following output:

-rw-r--r-- 1 root root 0 Jan 29 05:49 file1.txt
-rw-r--r-- 1 root root 0 Jan 29 05:50 file2.txt


In the above guide, we explained how to set up an NFS server on Debian 11. We also explained how to access the NFS share from the client machine. Create a file server for your organization on dedicated hosts from Atlantic.Net!

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year