NFS Server and client configuration Centos

NFS Server side configuration

Create directory which you want to share

mkdir -p /nfsshare

yum install nfs-utils rpcbind nfs-utils-lib

chkconfig rpcbind on

chkconfig nfs on

chkconfig nfslock on

service rpcbind start

service nfs start

or

/etc/init.d/nfs start

service nfslock start

define allowed IPs on server

lets suppose

Server IP : a.a.a.a

Client IP : b.b.b.b

vi /etc/hosts.allow

mountd: 127.0.0.1 b.b.b.b

mkdir -p /nfsshare

chown -R nfsnobody.nfsnobody /nfsshare

chmod -R 750 /nfsshare

or

chown -R 65534:65534 /nfsshare

chmod -R 755 /nfsshare

vi /etc/exports

/nfsshare           b.b.b.b(rw,sync,no_root_squash,no_subtree_check)

or

/nfsshare   b.b.b.b/255.255.255.255(rw,sync,no_wdelay,all_squash)

exportfs -a

service nfs restart

 

(The no_root_squash option