Installing NFS
On your dedicated / cloud server install nfs-utils nfs-utils-lib by running the following command.

yum install nfs-utils nfs-utils-lib

Then we create the system startup links for the NFS server and start it:

chkconfig –levels 235 nfs on
/etc/init.d/nfs start

Exporting Directories On The Serve
Make a directory in /var call nfs.

mkdir /var/nfs

Then update the /etc/exports file and export it out. In example below, we are only sharing it out to 1 host (192.168.0.101).
You can change it to 192.168.0.0/24 if you like to share it out to the network.

/var/nfs 192.168.0.101(rw,sync,no_subtree_check)

Whenever we modify /etc/exports, we must run so the nfsd would reread the /etc/export file.

exportfs –a

Mounting The NFS Shares On The Client
First we create the directories where we want to mount the NFS shares. In the mount command below, 192.168.0.100 would be the IP of the NFS server.
mkdir -p /mnt/nfs/home
mkdir -p /mnt/nfs/var/nfs
Afterwards, we can mount them as follows:
mount 192.168.0.100:/home /mnt/nfs/home
mount 192.168.0.100:/var/nfs /mnt/nfs/var/nfs
You should now see the two NFS shares in the outputs of

[root@nfsclient ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.7G 1.7G 7.5G 18% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/sda1 504M 39M 440M 9% /boot
192.168.0.100:/home 9.7G 1.7G 7.5G 19% /mnt/nfs/home
192.168.0.100:/var/nfs
9.7G 1.7G 7.5G 19% /mnt/nfs/var/nfs
[root@nfsclient ~]#

Leave a Reply

Your email address will not be published. Required fields are marked *