installing NFS server in centOS,redhat fedora

Pranaam to all bhai ji _/\_
Today we will go through one of nice protocol in linux OS known as NFS (Network file system).
it is distributed file system protocol i.e such protocol which allows a user to access files over a network(file stored on another machine).
This protocol let a user to mount file stored on a remote machine in network to the machine on which user is working.
NFS runs on port number 2049(default).
NFS is just for linux OS and if a user have windows OS , he cant access NFS shared file/folder
For NFS server we need packages nfs-utils,xinetd and rpcbind(portmap package)

Installation of NFS:-
we need to install nfs-utils,xinetd,rpcbind on server side for setting up NFS server
for installation of nfs-utils package , run command 
yum install nfs*

press y for installation confirmation of nfs-utils package and its dependencies

 after installation of nfs-utils, install rpcbind package
command is
yum install rpcbind

now install xinetd package  , command is 
yum install xinetd

type y and press enter for installation confirmation of xinetd package.

ok, now we need to configure NFS i.e which file/folder should be accessible by whom(client ip) and what should be the permissions on those shared file/folder.
configuration file for NFS server is /etc/exports 
open it with vi text editor(http://www.mannulinux.org/2013/08/vi-file-editor-in-linux.html) or nano text editor.
initially you will found this file as empty :P
yes it must be , because NFS server share file/folder mentioned in this file to an ip or ip range  
so, lets start ;)
format for sharing  file/folder to an ip or ip range with permissions in this file is

path_of_file/folder_on_server           ip/ip_range(permissions)

path_of_file/folder_on_server  is the path to that file/folder which you want to make accessible for other machine on network
ip/ip_range(permissions)  is the ip address or range of ips to which you want to let access shared file via NFS server . permisisons is the permission that you want to provide to client on NFS share
for example, if you want that client should have read-only permissions , you need to mention ro in permissions field 
for read-write , type rw .
lets have an example  
i am sharing a folder having name 'ica' which is under / directory, so full path to ica directory is /ica
now i am allowing ip to access this folder  via NFS protocol and providing permissions of read as well as write 
so format will be like this 

if you want to allow more then one ip or range of ip format will be like this 
path_of_file/folder_on_server           ip1(permission)   ip2(permission)   ip_range(permission)....
here ip1 is first ip 
ip2 is second ip 
ip_range is the range of ip to which NFS share is accessible 
i am allowing  ip with read-write permission 
and allowing  ip range from to with read only permission 
format will be like this 

once we have installed required packages for NFS server and configured accessible file/folder, we need to restart nfs.rpcbind and xinetd
commands will be
service nfs restart
service rpcbind restart
service xinetd restart

ok now run command exportfs -ra to read all share by NFS server

time to configure client machine and mount the NFS share on client machine
install nfs-utis,rpcbind and xinetd on client machine
restart them
now time to mount the share  on client machine
to mount NFS share command is
mount  remote_server_ip:/path_to_share     local_path_to_mount_NFS_share

remote_server_ip:/path_to_share   is the ip of the remote machine from which we want to access NFS share and path to that file/folder
 local_path_to_mount_NFS_share  is the location on client machine where we want to mount that share
i want to mount the share on /indishell folder
command is
mount   /indishell

now we can access the content of folder /ica on remote machine on client machine
this is short intro about NFS server :)

Thank you :)
Greetz to:-
  Zero Cool, Team INDISHELL Leads, Mannu, Viki,Hardeep bhai and AR AR bhai ji <3
Share this post


:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

© 2009 Start With Linux | Mannu Linux
Designed by cyb3r.gladiat0r
Posts RSSComments RSS
Back to top