How to Install NFS on Debian 11 Server Tutorial (Step by Step)

How to Install NFS on Debian 11 Server. In this article we will introduce what NFS server with its pros and benefits, as well as NFS Server versions and next move into installation phase. Let’s get started.  

What is NFS

NFS, also known as Network File System and it is a client/server application, which is a protocol built in 1984 by Sun Microsystem on the principle of sharing. This protocol allows users to access files on client computers. It means that it is a distributed file system that helps businesses in sharing files over a network.

It enables you to access remote data or files from any remote computers or devices linked to the network you are using. This way, all people working within your network will be accessing similar files, thereby making the efforts of file sharing easier.

Since its launch, it has evolved tremendously, and it is still continuously changing today. It is because it is an open standard solution where anyone within your network reach can implement this protocol on every operating system and make necessary adjustments accordingly.

NFS utilizes a fundamental system in which the “mount” command induces the server to link with multiple clients. This way, it allows the clients to have access to the identical files on the server via appropriate platforms. However, it also uses security protocol to control the access of specific files to produce a simplified and safe way of working.

It also uses a file locking system that can be used to share files among multiple clients. It manages several applications and assesses threads for operations by using various hosts.

NFS features

You can enjoy the following benefits with NFS server:

  • It has low cost solution for NFS network file sharing.
  • You can share data with your client effortlessly.
  • It is user friendly as it allows to access files on remote hosts.
  • Supports Directory Services for better access control like LDAP and Microsoft Active Directory.
  • Provides security by protecting the server in which the data is stored.
  • Provides name mapping between Windows and UNIX users and groups.
  • It uses existing Internet Protocol infrastructure and is easy to install.
  • It supports a file locking system.
  • Provides centralized management.

How NFS Works

The way NFS works depends upon the version you are using. As of today, there are a total of three NFS versions, and each of them constitutes different standards for its operations.

NFS versions

NFS version 2 (NFSv2)

This version is one of the oldest and the most widely used format of NFS. It employs User Datagram Protocol (UDP) via an IP network that provides a solid network connection. It has convenient features that make the connection effortless and work in no time. However, UDP clients continuously send requests to the server even if the connection is not working.

NFS version 3 (NFSv3)

This version is designed to support non contemporaneous writing. It allows servers to organize data by helping them in employing appropriate policies. Here, the data is synchronized before creating a command to manage the data. The design creates a better buffer than NFSv2. It is also capable of handling any errors or mistakes and managing massive files precisely.

NFS version 4 (NFSv4)

NFS version 4 is the latest version of this protocol, which can not only work on the internet but on the firewall as well. Moreover, since it does not require any rpcbind service, you can effortlessly run this protocol in multiple places.

Transmission Control Protocol, or TCP works with NFS form. It links the application and IP protocol. This way, they keep tabs on the data and only receive frames that are lost in the TCP set while sending something for the second time.

This server also accepts TCP port 2049 commands that are widely used to eliminate the need for interactions with daemons like rpcbind and lockd options.

To summarize, NFS is the most essential protocol as it helps in sharing the file with people within your network. However, look at the version and ensure it’s working to make both your network and file content visible to everyone in your business. Implement NFS daemon to access data stored on another device immediately and efficiently.

Follow the next steps about how to install the NFS on Debian 11 server.

How to Install NFS on Debian 11 Server

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

					apt-get install nfs-kernel-server -y

After installing the NFS server, start the NFS service and enable it to start at system reboot:

					systemctl start nfs-server
systemctl enable nfs-server

You can verify the status of the NFS service 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 Thu 2022-04-04 12:09:06 UTC; 5s ago
   Main PID: 4198 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 2353)
     Memory: 0B
     CGroup: /system.slice/nfs-server.service

April 04 12:09:05 debian11 systemd[1]: Starting NFS server and services...
April 04 12:09:06 debian11 systemd[1]: Finished NFS server and services.


Create an NFS Share

Next step in this article about How to Install NFS on Debian 11 Server, you will need to create a directory on the NFS serve that you want to share with the client systems. Let’s create a directory named /data using the following command:

					mkdir /data

Following that, assign proper ownership and permissions to the /data directory so it can be accessible from the client machines.

					chown nobody:nogroup /data
chmod -R 777 /data

Configure an NFS Exports

After creating the NFS directory, you will need to allow client systems to access the NFS share. You can do it by editing the /etc/exports file.

					nano /etc/exports

Add the following line:


Save and close the file when you are finished.

The above configuration will allow all clients in the network to access the NFS share.


  • rw – Assign read and write
  • sync – Write changes to disk before applying them
  • no_subtree_check – Avoid subtree checking

Next, run the following command to export the shared directory and make it available to all client systems.

					export -a
systemctl restart nfs-server

Allow NFS Through UFW Firewall

If you have configured UFW firewall on your server. Then, you will need to allow NFS service to the client network. You can allow it by running the following command:

					ufw allow from to any port nfs

Next is to reload the UFW firewall to apply the changes.

					ufw reload

Install NFS Client

At this point, the NFS server is installed and configured. Now, you will need to install the NFS client package on the client system. You can install it by running the following command:

					apt-get install nfs-common -y

Once the NFS client package is installed, you can proceed to the next step.

Mount NFS Share on Client System

Firstly, you will need to create a directory on the client system on which you want to mount the NFS share from the server.

Let’s create a directory named nfs_mount inside /opt directory:

					mkdir /opt/nfs_mount

Now, mount the NFS share directory to the client directory using the following command:

					mount -t nfs -o nfsvers=3 /opt/nfs_mount

Where: is the IP address of the NFS server.

Following step is to verify that the NFS share directory is mounted using the following command:

					df -h

You should see your mounted share in the last line of the following output:

					Filesystem                Size  Used Avail Use% Mounted on
udev                      981M     0  981M   0% /dev
tmpfs                     199M  588K  199M   1% /run
/dev/sda1                  50G  1.8G   46G   4% /
tmpfs                     994M     0  994M   0% /dev/shm
tmpfs                     5.0M     0  5.0M   0% /run/lock
tmpfs                     994M     0  994M   0% /sys/fs/cgroup
tmpfs                     199M     0  199M   0% /run/user/0   50G  2.0G   46G   5% /opt/nfs_mount


The above command will mount the remote NFS share temporarily. To make the mounts permanent on reboot, open the /etc/fstab file:

					nano /etc/fstab

Add the following lines:

 /opt/nfs_mount   nfs   defaults,timeo=900,retrans=5,_netdev	0 0

Save and close the file then, run the following command to apply the changes.

					mount -a

Verify NFS Share

To verify the NFS share, let’s create some files and directories on the NFS server.

					mkdir /data/directory1 /data/directory2 /data/directory3
touch /data/file1.txt /data/file2.txt

Now, go back to your client system and verify all files and directories in your mounted directory:

					ls -l /opt/nfs_mount

You will get the following output:

					drwxr-xr-x 2 root root 4096 April  4 09:04 directory1
drwxr-xr-x 2 root root 4096 April  4 09:04 directory2
drwxr-xr-x 2 root root 4096 April  4 09:04 directory3
-rw-r--r-- 1 root root    0 April  4 09:04 file1.txt
-rw-r--r-- 1 root root    0 April  4 09:04 file2.txt

Great effort you have followed all the steps to Install NFS on Debian 11 Server. 

How to Install NFS on Debian 11 Server Conclusion

In the above post, you learned how to install the NFS server and client on Debian 11. You also learned how to share a directory through NFS and mount it on the client machine.


NFS is a solution for remote file sharing between the servers, by using the existing internet protocol infrastructure. NFSv3 is the most popular server and some of the interesting protocol features are caching, security support, shared file locking and in NFS server, remote server management is used.


I hope this article will assist you in file sharing using NFS on your internal network.

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x