Sunday, November 11, 2012

NFS Server


NFS Server
NFS ,the network file system used by Linux/unix and network storage devices to allow multiple clients to share the files over the network .
It is used to allow users to access their files from different clients in the same group.
NFS Server Configuration
Service profile
Service:  nfs
Package: nfs.utils
Port no:2049/TCP
Configuration file: /etc/exports
Script file: /etc/init.d/nfs
Daemons: nfsd, statd, lockd(used for file locking)
               mountd (used to mount the sharing directory)
               rquatod (to assign users and groups on a particular directory)
Step:1
Instal the package through yum

[root@nfs~]#yum install nfs* -y

Step:2
 Create any folders to be shared
[root@nfs!]#mkdir /var/raju

Give the permissions so user can do read /write
[root@nfs~]#chmod 777  /var/raju

Create files and directories inside a folder that we want to share
[root@raju]#touch file[1..10]
[root@raju]#mkdir -p dir1 dir2 dir3 

Step:3
Add the folders to be shared to /etc/exports file
[root@nfs~]vi /etc/exports
 /var/raju     192.168.0.0/24(ro,sync)       #exports the director /var/raju to all the hosts on the 
network with   read-only permission

:wq!

# /var/raju  = shared directory.
# 192.162.0.0/24  = Range of the network
# rw = Read and write access.
# ro = Read only access.
# sync = synchronize
# no_root_squash  = enables root access and privilege.
# no_all_squash   = enables user access.

[root@nfs~]# chkconfig nfs on
[root@nfs~]# service nfs restart
[root@nfs~]# exports -r # run this  to apply the changes to the /etc/exports file 
[root@nfs~]# exports -v  #to display all exports

Client side configuration
[root@client~]# ssh 192.168.0.X
 where X is any client number
To see the list of shared files from nfs server
[root@nfs~]# showmount -e 192.168.0.x
 where X is NFS server number
 To mount an NFS file system on a cilent
create an empty directory for mount point it it doesnot exist already
[root@client]#mkdir /var/raj
[root@client]#mount -t nfs 192.168.0.X:/var/raj   # temporary mount
 for permanent mount add the below line in ./etc/fstab
192.168.0.X    /raj         nfs       defaults        0 0
:wq!
 [root@client]#mount –a

Stay Connected With Free Updates!

Subscribe via Email

Follow me!

Leave Your Comment Below If You Like This Post

0 comments: