Wednesday, September 3, 2014

Linux Server : NFS Server

NFS Server

NFS Network File System is a server-client protocol used for sharing files on Unix, Linux systems. It allows sharing files from a central server allowing several users to access and modify the same files from different clients making all the changes on the files visible on all clients.


                            


NFS Server

In order to configure a node as NFS server the packages 'nfs-utils' and 'rpcbind' must be installed and running :

Port NO -     2049  (for nfs) - 111 port map
Package-     nfs-utils

Configuration and status files
*/etc/exports
*/var/lib/nfs/rmtab
*/var/lib/nfs/xtab
*/etc/hosts.allow
*/etc/hosts.deny

Daemons
*rpc.portmap
*rpc.mountd
*rpc.nfsd
*rpc.statd
*rpc.lockd
*rpc.rquotad

Scripts and commands
*/etc/rc.d/init.d/nfs
*nfstat
*showmount
*rpcinfo
*exportfs

Sever Side

To install packages
#rpm -ivh portmap-4.0-63.i386.rpm
#rpm -ivh nfs-utils-lib-devel-1.0.8.i386.rpm
                             Or
Yum install nfs* -y

To create directory.
# mkdir /share

To export directory.
#vim /etc/exports
/share *(rw,sync ,no_root_squash ,no_all_squash) 
/share  192.168.0.0/24(ro,sync)

rw                             – Writable permission to shared folder
ro                              -- Read-only permission to shared folder
sync                          – Synchronize shared directory
no_root_squash        – Enable root privilege
no_all_squash          – Enable user’s authority

#exportfs   -r  (Re exports the nfs share)

#service  nfs  restart
#chkconfig   nfs   on
#chkconfig   nfs   --list

For Verification on server
#exportfs   -v
#showmount  -a

On Clinet Side
#yum install showmount rpcbind
 
Create a Directory
#mkdir  -p  /mnt/data

For Checking on client side
#Showmount   -e  192.168.1.25

Mounting

#mount -t nfs remote machine ip:share_name   local_mount_point

#mount -t nfs    192.168.1.25:/share /mnt/data           (Temporary)

For permanent

#Vi /etc/fstab
192.168.1.25:/share     /mnt/data        nfs      defaults     0  0
:wq

#mount   -a    

Checking

#cd /mnt/data

ll

or 

ls
- See more at: http://www.linuxforfreshers.com/p/nfs-server.html#sthash.5iTza2ll.dpuf

No comments: