Tuesday, May 3, 2011

NFS SERVER

NFS
NFS -> NFS stand for Network File Sharing
Using NFS you can share file on Network.NFS server allow us to share file on client side and vice-versa.
Using NFS server we can easily access any file and directory on client side.

Note -> Disabled Firewall

Note -> For NFS rpm you must need a rhel 5 DVD OR Yum configure
On your system OR an active internet connection to download
NFS rpm.
If Yum is configure on your system then login as a
Root and type,
< Yum -y install nfs* >
If you have a rhel 5 DVD then mount the DVD on any
Directory. For e.g., I mount a DVD on /mnt directory. Now login
As a root and type,
< rpm -ivh /mnt/Server/nfs* >

Now NFS package is installed on your system.

NFS works on Port number 2049/tcp -- To check Port number file is "/etc/services"
---------------------------------------------------------------------------
Server Side Configuration
On Server Side the configuration file is
< /etc/exports >
Open the /etc/exports file in any Linux editor. I suggest you open it in
VIM.
VI /etc/exports
File is blank. Now write in the file you want to share on the network for
End-Users.
For eg. I am sharing a /var/ftp/pub directory and /home directory. Enter the
these lines in /etc/exports file.

/var/ftp/pub *(ro,sync)
/home 10.10.1.20(ro,sync)

Now save & exit from file.
------------------------------------------------------------------------------------------
Here, in the /etc/exports file we write the share directory /var/ftp/pub
And in the front of we write {*(ro, sync} this mean that,

Asterisk (*) mean that you can share the /var/ftp/pub directory on all the
PC connected in the same network.

(ro) means that you have read only permission on /var/ftp/pub. You can change
{ro} to {rw).{rw} mean that you have read and write permission on
/var/ftp/pub/ directory.

(sync) stand for synchronization mean that accuracy in time to matching data.
If you want share a directory on a particular IP address then write the IP
of particular machine corresponding to the share directory.For eg
/home 10.10.1.20(ro,sync)
-----------------------------------------------------------------------------------------
After, configure the /etc/exports file restart the NFS services
service portmap restart
service nfs restart
PORTMAP -> The portmap service can be used with TCP wrappers' hosts access files (/etc/hosts.allow and /etc/hosts.deny) to control which remote systems are permitted to use RPC-based services on the server.
If you want to permanent restart NFS services during next reboot Use
Chkconfig portmap on
Chkconfig nfs on
--------------------------------------------------------------------------------------------
Now, if you want to know what you are sharing on server side, you can see it in two ways.
1. Open the /etc/exports file
2. Showmount -e 10.10.10.254 here 10.10.10.254 is server ip address.
--------------------------------------------------------------------------------------------
On Clint Side
On client side if you want to know that what is sharing from server side
login as root and type
showmount -e 10.10.10.254 server ip address result is look like this
/var/ftp/pub *(ro,sync)
/home 10.10.10.20(ro,sync)

If server gives you write permission on any share directory the mount the directory and you can
edit it. For eg
mount -t nfs 10.10.10.254:/var/ftp/pub /mnt
ls /mnt

Read more: http://networkupd8.blogspot.com/2010/12/nfs-server-in-linux.html#ixzz1LHUdga00

No comments:

Post a Comment