*NFS (Network File System)

NFS used for sharing files over network between

☼  Linux → Linux

☼  Linux ↔ Unix

☼   Unix → Unix

1-      Installing Packages: (nfs4, nfs-utils, rpcbind (On Server Machine)

  •  [root@server2 ~]# yum install nfs* -y  (install nfs4 + utilities + rpcbind. “-y= yes”)
  • [root@server2 ~]# rpm -qa |grep nfs (check nfs if installed successfully)
  • [root@server2 ~]# rpm -qa |grep rpcbind (check rpcbind if installed successfully)

2-      Restarting the services

  1.  [root@server2 ~]# service rpcbind restart
  2. [root@server2 ~]# service nfs restart
  3. [root@server2 ~]# service nfslock restart

3-      Turn on these Services permanently

  • [root@server2 ~]# chkconfig nfs on
  • [root@server2 ~]# chkconfig nfslock on
  •  [root@server2 ~]# chkconfig rpcbind on


4-      Create some folder to be shared or Share existing folder

♫ [root@server2 ~]# mkdir /nfs/resource -p

♪  [root@server2 ~]# mkdir /nfs/projects -p

[root@server2 ~]# mkdir /nfs/software –p

ü  [root@server2 ~]# mkdir /nfs/media –p


5-      Edit Export file “located at” /etc/exports

ý  vi /etc/exports (Don’t worry this is an Empty file, add folder name and folder path that you want to share with permission type) Example:

»        /nfs/software   *(rw,sync)

»        /nfs/resource,sync)

»        /nfs/projects   *, *,sync)

»        /nfs/media,sync)                (press “ESC” →:wq← =save and Exit

Note: *=Any user / rw=Read Write permission / ro=Read Only permission / sync=Synchronize / for all 254 node on this network /*, * Permission for all Member of and Permission for only this IP

6-      Restarting nfs service,→ check shared resources → re Export Shared resources (optional)

v   [root@server2 nfs]# service nfs restart

v   [root@server2 nfs]# showmount -e localhost            OR

v    [root@server2 nfs]# showmount -e    (*change to your own IP  “View All shared Resources)

v    [root@server2 nfs]# exportfs -ra       (Optional only for double Ensure “-ra”= Re Export All Shared directories)


7-      Configure Clint Machine

©    [root@clint ~]# yum install nfs* -y

©    [root@clint ~]#showmount -e    (Use Server Name or Server IP “View All shared Resources Server)

©     [root@clint ~]# mkdir /mnt/nfs -p     (optional create new folder )

©     [root@clint ~]# mount -t nfs /mnt/nfs       (Mount software folder “Server IP can be used instead of Sever name )

©     [root@clint ~]# echo $?          (if output “0” = mounted successfully, if output not “0”= there is a problem)

©     [root@clint ~]# cd /mnt/nfs

©     [root@clint nfs]# ls

©     [root@clint nfs]# vi /etc/fstab                        (permanent mount for shared folder’ “just add 1 line at the bottom of the fstab file)

»              /mnt/nfs         nfs       default             0          0


About Author


Leave A Reply

Powered by