NFS, better known as Network File System, is a service that allows its users to share and link directories across multiple devices on a single network. Network File System grants the user access to files present on different systems, provided they’re on the same network. This allows the user to treat the files on different systems as if they’re on the local device. Aside from those, NFS allows for better management of disk space, common directories, and equal rights of access to external storage devices. Features like this make NFS a must-have for those in the field of IT and networking. If you wish to learn how to install the NFS server on Ubuntu, then you’ve come to the right place! Just follow the steps in this guide, and you’ll have an NFS server installed and configured in no time. So without further ado, let’s begin!
Requirements for NFS.
Before we begin, it’s necessary to mention the prerequisites for NFS to ensure seamless installation and configuration. For this guide, we’ll be using Ubuntu 20.04 LTS. However, the method shouldn’t be any different from the previous versions of Ubuntu. Additionally, you’d need two or more devices or servers with root access on the same network to configure NFS. It should be noted that the device that’s going to act as the host should have Ubuntu installed. The other devices don’t have such restrictions so that they can use any Linux distribution. Now that we’ve covered the prerequisites, let’s learn how to install the NFS server on Ubuntu.
Step 1: Installing The NFS Kernel Server (Host System).
The first step is to install the NFS kernel on the host system. To install the server, we can make use of the Command Terminal. Follow these steps to install the NFS Kernel on your system: This will update your system packages and repositories to the latest available version. This will proceed to install the NFS kernel on your system. The process is automatic, so all that’s left is to wait for completion. With the installation finished, it’s time to configure NFS.
Step 2: Creating The NFS Directories.
The next step is to configure your NFS server. This involves the process of creating directories, providing access to client systems, and allowing clients access through your server firewall. Although the configuration process may seem daunting, you shouldn’t face any problems as long as you follow the steps. To set up directories, follow these steps: For example, This will create the mount directory. This will allow all clients to access the folder named “NFS_shared”
Step 3: Providing Clients Access To NFS Server.
The next step is to provide access to clients. This can be accomplished with the help of the NFS export file. To configure the export file, follow these steps: Although we use nano in this guide, the file can be opened on any text editor. For a single client, type: For multiple clients, type: Etc. For clients on the same subnet, type: With the steps followed correctly, the NFS server should now be configured according to your liking. With this, you can move on to the next step.
Step 4: Provide Client(s) Access Through Firewall.
With the Server configured properly, all that’s left is to provide the client systems access through the host firewall. For this purpose, you can type the following in the Command Terminal: To see the status of the IP, use the following command: This will display a table of ports and IPs that have access through the firewall.
Step 5: Installing And Configuring NFS (Client System).
With the NFS server now up and running, let’s take a look at how to configure NFS on the client systems. The process of installation and configuration is fairly simple. As long as you follow the steps correctly, you shouldn’t face any issues. Follow these steps to install and configure NFS on the client systems: This will install NFS (Client version) on your system. This will create a directory in the client system. To link it with the server folder type: For example, With the steps followed correctly, the client should be working as intended. This can be tested by trying to access the host file on the client system. While on the topic of network and server management, it’s necessary to discuss ways to protect your server. One of the best services for protecting your private server data is Fail2ban, which will ensure that your server is never under the threat of any data breaches. We hope this guide helped you learn how to install the NFS server on Ubuntu. If you have any questions or suggestions to make the guide better, let us know in the comment section below.