How to Install and Configure NFS and NFSv4 on Centos 6+

Here are the process how I install and Configure NFS/NFSv4

Configuring Server-Machine first

yum install nfs-utils nfs4-acl-tools portmap xinetd

Note: you might have problem installing portmap so downlaod rpm from here

Be sure there following rpm packages are installed

rpm -qa nfs*

rpm -qa portmap*

rpm -qa xinetd*

———————————————————————————————————-

Service portmap start

service xinetd start

chkconfig portmap on

chkconfig xinetd on

———————————————————————————————————-

For test purpose mk directory in the server machine

# mkdir /data

vi /etc/exports

/data        192.168.0.15/24(rw) ———-> Here Your Client IP with read and write permission and you can add other permissions

service nfs restart

chkconfig nfs on

exportfs -r

veryfy showmount by

# showmount -e Your-Client-IP

Edit # vi /etc/hosts.deny ————————> add portmap:ALL

and # vi /etc/hosts.allow ————————-> add portmap:Client-Server-IP/24

———————————————————————————————————-

Now go to Client-Machine

#mount -t nfs Your-Server-Machine-IP:/data /Client/Machine/dir

for NFSv4

#mount -t nfs4 Your-Server-Machine-IP:/data /Client/Machine/dir

———————————————————————————————————-

In this way you can use shared folder. But this share folder will be available till system is up. It will not be available afterreboot. To keep it available after reboot make its entry in fstab

# vi /etc/fstab

Your-Server-Machine-IP:/data     /Client/Machine/dir

# chkconfig netfs on

———————————————————————————————————-

NFSv4 Configuration

For Firewall Configuration Open TCP port # 2049 which is used by NFSv4

———————————————————————————————————-

How Do I See NFS Statistics

# nfsstat

# showmount -e
# showmount -d
# showmount -a server.ip