What is NFS (Network File System)? How to Configure NFS Server and User?

It is a Unix / Linux file sharing service developed by Sun Microsystems and is a stable technology that enables file sharing between Linux systems.

We need to get into configuration and use it right away. We will work with the Server and Client model in the environment. In other words, we have to configure both the server-side, there are settings that we should not make for the client to use. We will create these applications on the virtual machine.

nfs_server
nfs_server

The IP information of ours NFS Server is as follows.

IP information for NFS Client is as follows.

First of all, it is necessary to install NFS packages because the servers are usually installed minimally.

NOTE: You must install these packages on both the server and the client. You can do this with the following command.

Then check the status of the service with the command below and see if the service is either not running or disabled.

Now run the service with the command below.

Then, pull to the enabled state.

Now let’s look at the final situation and see if this part is completed correctly.

* Server – Server-side

Now let’s start configuring on the server. Of course, here you have to plan according to your environment. In other words, you can specify the space you will allocate for NFS and use a separate disk and storage for this, which is always healthier. I create a directory called MeShareNFS to the disk space that I set on the server-side.

I am creating the MeShareNFS folder with the mkdir command. Then I enter the cd command and create files and folders for testing.

We will do the sharing configuration with the help of the “/etc/exports” config file. The MeShareNFS folder that we created and entered with the help of any editor is for everyone (i * ”means that anyone can connect and use it; if you are going to do it for certain machines, you must enter the machine’s IP instead of *). Then restart the NFS service.

With the command fs “exportfs” we can list all of our shares on the server.

Let’s run a “showmount -e localhost”  command and observe the shares from here.

* Client – User side

Now let’s start configuring on the client-side. We will mount the shared space on the side that will use sharing. Mount is a destination, so let’s create a folder. I am creating a folder named NFSUse.

Now let’s mount the server with IP (192.168.2.250) value as follows.

You can observe the situation with the direct mount command. We also see that the NFS service is version 4.

Let’s observe with df -h command.

Let’s list the share point with ls -l, see if we can use the data. This information is actually on the server.

Finally, run “showmount -e 192.168.2.250 (Server ip info)” command to check and observe the change.

We’re not done yet. Because when this user machine reboots, mount information will be lost and the NFS share will not be able to use it. We will write the mount point to the file“/etc/fstab” to make it fixed and make it available to the user even though the machine is a reboot. Let’s enter this configuration file with the help of any editor and configure it as follows (spaces are created with tab key), save and exit.

 

I hope it has been a useful article.