NFS

SETUP

            NFS Server: 192.168.0.10

            NFS Client: 192.168.0.11

 

BOTH NODES

Install NFS Packages on both NFS server and NFS client  

# yum install nfs-utils nfs-utils-lib              

# yum install portmap (not required with NFSv4)

 

Start the service on both machines

               # /etc/init.d/portmap start

               # /etc/init.d/nfs start

               # chkconfig --level 35 portmap on

               # chkconfig --level 35 nfs on

 

Server

To share a directory with NFS, create one anywhere in the system

# mkdir /nfsshare

 

Now make entry in “/etc/exports” and restart the services

               # vim /etc/exports   

               /nfsshare 192.168.0.11(rw, sync, no_root_squash)

               :wq

               (We can also use hostname of client instead of IP address OR We can also use     

               network details.)

 

Client

Find out which shares available on server

               # showmount –e 192.168.0.10

 

Mount shared directory in client

               # mount -t nfs 192.168.0.10:/nfsshare /mnt/nfsshare

 

Make permanent entry in fstab, add following line

               # vim /etc/fstab

               192.168.0.10:/nfsshare /mnt /nfs defaults 0 0

 

TEST NFS

At server end

               # cat > /nfsshare/nfstest.txt

               This is a test file to test the working of NFS server setup

 

At client end

               # cat /mnt/nfsshare/nfstest.txt

               This is a test file to test the working of NFS server setup

 

Removing NFS Mount

At client end, unmount the directory

               # umount /mnt/nfsshare

               # df -h -F nfs


Comments