NFS Server & Client Setup on CentOS 6.4

Install NFS on the server

sudo su
yum install nfs-utils nfs-utils-lib
chkconfig nfs on
service rpcbind start
service nfs start

Edit /etc/exports on the server

/directory/to/share 10.0.0.2(rw,sync,no_root_squash,no_subtree_check)
/directory/to/share 10.0.0.3(rw,sync,no_root_squash,no_subtree_check)
/directory/to/share 10.0.0.4(rw,sync,no_root_squash,no_subtree_check)
/another/shared/dir 10.0.0.2(rw,sync,no_root_squash,no_subtree_check)
/another/shared/dir 10.0.0.3(rw,sync,no_root_squash,no_subtree_check)
/another/shared/dir 10.0.0.4(rw,sync,no_root_squash,no_subtree_check)

Export the shares from bash

exportfs -a

Install NFS on the client(s)

sudo su
yum install nfs-utils nfs-utils-lib
chkconfig nfs on
service rpcbind start
service nfs start
mkdir -p /directory/to/share
mount 10.0.0.1:/directory/to/share /directory/to/share
mount 10.0.0.1:/another/shared/dir/ /another/shared/dir

If there are no errors, check to see if your mount is active on the client with:

df -h

Test the NFS Mount from the client

touch /directory/to/share/somefile.txt

And now that file should be on both server and client. All Done!

Leave a Reply