Network File System — NFS Installation & Configuration

In this tutorial, we will discuss about NFS installation & configuration.

It is used to share a directory between several Linux systems. It allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally on your system.

(Recommended Read: Learn to use Wget command with 12 examples)


Scenario Setup

To install & test shared folder, we require at least 2 machines :-

  • NFS Server
  • Client machine to test the mount

Server                                                                                                     Client

OS : Centos/RHEL 6 & 7                                                                                  OS : Centos/RHEL 6 & 7

Hostname :                                                                           Hostname :

IP Address :                                                                              IP Address :


Package Name : nfs-utils, nfs-utils-lib

Main Configuration File : /etc/exports

NFS Installation

Firstly we will install NFS, which is easy & can be installed using following command

yum install nfs* -y

now, we need to start our server

service nfs start
chkconfig nfs on


Now, we will share a directory, lets share our home (/home) directory.

Firstly open configuration file

vi /etc/exports

since its an empty file, we will the following lines to the file to share /home folder

/home (rw,sync)

S0, the above line means

/home is directory to be shared, will be the subnet range for which shard folder will be available, you can just mention a single IP here,

rw means client will have both read & write permissions. You can also use ro for read only.

Now, restart the service to implement changes to server ,

service nfs restart

Our shared folder is now ready to be used.

Note If we are giving rw (read,write) settings on nfs share, make sure the permissions on the folder are 777.

Testing shared folder

On Server, use following command to show shared folder

mountfs -V                                           

& on client side, use following command to see the shared folder

show mount -e

Client side configuration

On Client side, we will have to firstly install nfs

yum install nfs* -y

we will now mount shared folder to /mnt

mount /mnt

so the above command will mount the shared folder, which we can use like a regular partition. But this will only be a temporary mount i.e. when we restart our system, our mount will be lost.

Therfore in order to permanently mount shared folder, we need to make an entry in /etc/fstab

vi /etc/fstab

After opening fstab, make the following entry at the bottom of file, /mnt nfs defaults 0 0

& drive will remain mounted even after system reboot.

Important commands which might come handy,

  1. showmount -e : Shows the available shares on your local machine
  2. showmount -e <server-ip or hostname>: Lists the available shares at the remote server
  3. showmount -d : Lists all the sub directories
  4. exportfs -a : Exports all shares listed in /etc/exports, or given name
  5. exportfs -v : Displays a list of shares files and options on a server
  6. exportfs -r : Refresh the server’s list after modifying /etc/exports
  7. exportfs -u : Unexports all shares listed in /etc/exports, or given name

and in our future tutorials, we will also be discussing VSFTP (very secure FTP) server & Samba server.

So, if you have any questions/comments about this tutorial on NFS installation & configuration, please write them down below. I will surely address them. ADIOS!!!

If you think we have helped you or just want to support us, please consider these :-

Connect to us: Facebook | Twitter | Google Plus

Donate us some of you hard earned money:

Linux TechLab is thankful for your continued support.


Passionate about Linux & open source. Loves to learn, read & write about Linux as well as new technologies.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *