Monday 7 October 2013

Step by Step NFS Configuration


       The Network File System is certainly one of the most widely used network services. NFS is used to share the directory among other linux systems. It allows the client to auto mount and therefore, transparently access the remote file systems on the network. NFS is not a single program. It is a suite of related programs, which work together. In this artical we will export the file system from the source.com (IP address 192.168.0.11) host and mount it on target.com (IP address 192.168.0.12).

Prerequisites:

1) RPM Check:

#rpm -qa | grep nfs*
#rpm -qa | grep portmap*

2) Install the packages (if not installed)

#rpm -ivh nfs*
#rpm -ivh portmap*

To check if NFS is functioning use following “rpcinfo” command.

#rpcinfo -p
We should get a response/output

Create a source to be shared:

#mkdir /oracle
for better troubleshoting make some test files in "oracle" directory
#touch test1 test2 test3

Now make an entry of the folder to be shared into /etc/exports file:
#vi /etc/exports

and add the following line
/oracle *(ro,sync)

If you use * it means any one can access your shared directory.
If you want to share it with particular machine then just use IP address of that machine instead of * eg
/oracle 192.168.0.12(ro,sync)

Start the NFS service:
Once we edited /etc/exports file, we need to restart NFS service to apply changes in the /etc/exports file.

#service nfs restart
#service portmap restart

To check the NFS shared directory:
#showmount -e

Now "oracle" folder can be accessd by client

NFS Client Configuration

First we need to create a mount point:
# mkdir /nfs_local

To check what has been shared by source.com
#showmount -e 192.168.0.11

To mount shared directory at the client side
#mount 192.168.0.11:/oracle /nfs_local

here we mounted /oracle from 192.168.0.11 to local machine

To make this mount point completely transparent to end users, we can auto mount the NFS file system every time a user boots a PC, In this situation we need to edit /etc/fstab to mount system automatically during a system boot. We can use vi editor and create new line like this:  

192.168.0.11:/oracle /nfs_local nfs defaults 0 0
in /etc/fstab



You have successfully configured NFS
Got to
#cd /nfs_local
#ls
you will see three files.
test1 test2 test3











No comments:

Post a Comment

Ask your Questions....