How to create NFS Server in Linux


NFS (Network File Server) is used for sharing files between linux to linux, unix to linux and vice versa.

Package: nfs-utils
By Default Port: 2049
Configuration File: /etc/exports

Step 1: Install nfs package

First install nfs-utils package using following command:

# yum -y install nfs-utils

Step 2: Configuration

Edit file idmapd.conf and add the line:

# vi /etc/idmapd.conf
Domain = tecdistro-server

Insert the folder/directory along with network that you want to share it with other unix/linux machines:

# mkdir /data
# chmod a+rwx /data
# vi /etc/exports
/data *(ro)

Step 3: Start Services

Start the services rpcbind, nfslock and nfs.

# service rpcbind start
Starting rpcbind:                         [  OK  ]
# service nfslock start
Starting NFS statd:                       [  OK  ]
# service nfs start
Starting NFS services:                    [  OK  ]
Starting NFS mountd:                      [  OK  ]
Starting NFS daemon:                      [  OK  ]
Starting RPC idmapd:                      [  OK  ]

The following command is equivalent to nfs restart

# exports -ar

Run the services at startup/booting time.

# chkconfig rpcbind on
# chkconfig nfslock on
# chkconfig nfs on

Step 4: On Client Side

Now at the NFS client end, we need to mount that directory in our server to access it locally. To do so, first we need to find out that shares available on the remote server or NFS Server.

# showmount -e

Export list for

Above command shows that a directory named “data” is available at “” to share with your server.
To mount the directory from NFS server to client server use the following command:

# mount /local
5 replies
  1. web page
    web page says:

    I haᴠe been surfing onlіne more than 4 hours toԀay, yet
    I never found any interesting article like yours.

    It’s pretty worth enough for mе. In my opinion, if all webmasters аnd bloցgеrs
    made good content as you did, the internet will
    ƅe a lot more – web page useful than ever before.|
    I couldn’t resist commenting. Very well written!|
    I wiⅼl rіght away grasp your rss feed as I can not to find your emаil
    subscription link or newsletter servіce. Do you have any?
    Kindly aⅼlow me recognise in order thɑt I may subѕcriƅe.


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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