Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Sunday 22 May 2016

How To Configure NFS Server With Client on RHEL/Contos 6x

How To Configure NFS Server With Client on RHEL/Contos 6x

Q. What is NFS?

-- NFS stands for Network File System, a file system developed by Sun Microsystems, Inc. It is a client/server system that allows users to access files across a network and treat them as if they resided in a local file directory. For example, if you were using a computer linked to a second computer via NFS, you could access files on the second computer as if they resided in a directory on the first computer.

Scenario :

192.168.100.220    ser1.domain.com    (NFS Server)
192.168.100.221    ser2.domain.com    (NFS Client)

Used Ports :

TCP: 111, 2049
UDP: 111, 32806

Here :
/assets and /var/www/html/domain.com/assets

These two are the directory, which are going to be share via NFS.

Step: 1. Install NFS Server ( On Server) :

# yum -y install nfs-utils rpcbind

Step: 2. Configure NFS Server :

# vi /etc/exports

# Access For All :
/assets      *(rw,async)
/var/www/html/domain.com/assets     *(rw,async)

OR

# Access For Particular Network :
/assets      192.168.100.0/24(rw,async)
/var/www/html/domain.com/assets     192.168.100.0/24(rw,async)

-- Save & Quit (:wq)

Important Note :
============



Step: 3. To Exexute the Changes made on /etc/exports :
   
# exportfs -ar

Step: 4. Restart the NFS Service :
   
# service rpcbind restart
# service nfs restart
# service nfslock restart

# chkconfig rpcbind on
# chkconfig nfs on
# chkconfig nfslock on

Step: 5. Install NFS on Client Machine :

# yum -y install nfs-utils rpcbind

Step: 6. Configure NFS Client :

# showmount -e NFS_Server_IP_Address

Export list for 192.168.100.220:
/assets 192.168.100.221
/var/www/html/domain.com/assets 192.168.100.221


Step: 7. Create a new Directory on your Client & Mount the NFS Export to the Directory :
   
# mkdir /assets
# mkdir -p /var/www/html/domain.com/assets
# mount -t nfs 192.168.100.220:/assets /assets
# mount -t nfs 192.168.100.220:/var/www/html/domain.com/assets /var/www/html/domain.com/assets

Step: 8. Restart the NFS Service :

# service rpcbind restart
# service nfs restart
# service nfslock restart

# chkconfig rpcbind on
# chkconfig nfs on
# chkconfig nfslock on

Step: 9. Finally, Mount NFS Directory Permanently on your System across the Reboots :

# vi /etc/fstab

192.168.100.220:/assets    /assets       defaults 0 0
192.168.100.220:/var/www/html/domain.com/assets   /var/www/html/domain.com/assets  nfs defaults 0 0

-- Save & Quit (:wq)

Step: 10. After any subsequent Server reboots, You can use a Single Command to mount Directories specified in the fstab file :

# mount -a

Step: 11. Now You can check the Mounted Directories :

# df -h -F nfs

Important commands for NFS :
  1. showmount -e : Shows the available shares on your local machine
  2. showmount -e <server-ip or hostname>: Lists the available shares at the remote server
  3. showmount -d : Lists all the sub directories
  4. exportfs -v : Displays a list of shares files and options on a server
  5. exportfs -a : Exports all shares listed in /etc/exports, or given name
  6. exportfs -u : Unexports all shares listed in /etc/exports, or given name
  7. exportfs -r : Refresh the server’s list after modifying /etc/exports
Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

0 comments:

Post a Comment

Copyright © 2016 Kousik Chatterjee's Blog