Fedora

How to Setup NFS Server on Fedora Linux

NFS (Network File System) helps the administrators to store the files on a network and make them accessible to remote users. You can modify the permission for the remote users to prevent the files from unauthorized access on the NFS server. NFS facilitates the efficient collaboration and data sharing among connected devices.

Moreover, you can setup the firewalls in your NFS server to make the data private and highly secure. However, the beginners always look for simple ways to setup an NFS server in Linux distros like Fedora. In this guide, we will explain a brief method to install and setup an NFS server on Fedora Linux.

How to Install and Setup the NFS Server on Fedora Linux

Let’s divide this section into multiple parts to first explain the installation of the required packages and then setup the NFS server.

Additional Package Installation

First, update the system as per the latest updates available for Fedora Linux.

sudo dnf update

Now, you can install the NF utility by running the following command in the terminal:

sudo dnf install nfs-utils

Configure the NFS Server

It is time to create a directory which we will share over the network. Choose a location for your shared directory and create it using this command:

sudo mkdir /shared_directory

Now, you can edit the “/etc/exports” file to configure the NFS server.

sudo nano /etc/exports

In the editor, add an entry to specify the directory that you want to share. For example, to allow an access to the “/My_Directory” directory from all clients, add the following line:

/My_Directory *(rw,sync,no_root_squash)

In the previous command, “rw” stands for the read-write permission, and the no_root_squash allows the clients to use the root privileges. The asterisk (*) allows any client to access the shared directory.

You can also export the My_Directory to a specific client. For example, let’s provide an access to My_Directory to the client that has the 101.060.10.111 IP address.

/shared  101.060.10.111(rw,sync,no_root_squash)

Now, export the shared directory and then start and enable the NFS server.

sudo exportfs -a
sudo systemctl start nfs-server
sudo systemctl enable nfs-server
sudo systemctl status nfs-server

Adjust the firewall settings to allow the NFS traffic by executing the following commands:

sudo firewall-cmd --permanent --add-service=nfs

Finally, reload the firewall service to make sure that everything is running fine.

sudo firewall-cmd --reload

Conclusion

You successfully setup an NFS server on your Fedora Linux machine. NFS provides a convenient and efficient method for collaborative file sharing which allows for seamless data exchange among the connected devices. From the NFS server up, you can now enjoy the benefits of the centralized file management and enhanced productivity in your networked environment.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.