Monday 12 March 2012

[ CentOS 5 ] NFS Server

NFS Server
Configure NFS Server to share any directories on your Network.

 
Step [1] It's the Configuration on the system you want to build NFS server.
[root@dlp ~]#
yum -y install nfs-utils
[root@dlp ~]#
vi /etc/idmapd.conf
# line 5: uncomment and change to your domain name

Domain =
server.world
[root@dlp ~]#
vi /etc/exports
# write like below *note

/home 10.0.0.0/24(rw,sync,no_root_squash,no_all_squash)
# *note
/home
⇒ shared directory

10.0.0.0/24
⇒ range of networks NFS permits accesses

rw
⇒ writable

sync
⇒ synchronize

no_root_squash
⇒ enable root privilege

no_all_squash
⇒ enable users' authority
[root@dlp ~]#
/etc/rc.d/init.d/portmap start

Starting portmap:
[ OK ]

[root@dlp ~]#
/etc/rc.d/init.d/nfslock start

Starting NFS statd:
[ OK ]

[root@dlp ~]#
/etc/rc.d/init.d/nfs start

Starting NFS services:
[ OK ]

Starting NFS quotas:
[ OK ]

Starting NFS daemon:
[ OK ]

Starting NFS mountd:
[ OK ]

Starting RPC idmapd:
[ OK ]

[root@dlp ~]#
chkconfig portmap on

[root@dlp ~]#
chkconfig nfslock on

[root@dlp ~]#
chkconfig nfs on

Step [2] Configuration on NFS clients
[root@www ~]#
yum -y install nfs-utils
[root@www ~]#
vi /etc/idmapd.conf
# line 5: uncomment and change to your domain nameƦ›´

Domain =
server.world
[root@www ~]#
/etc/rc.d/init.d/portmap start

Starting portmap:
[ OK ]

[root@www ~]#
/etc/rc.d/init.d/nfslock start

Starting NFS statd:
[ OK ]

[root@www ~]#
/etc/rc.d/init.d/netfs start

Mounting other filesystems:
[ OK ]

[root@www ~]#
chkconfig portmap on

[root@www ~]#
chkconfig nfslock on

[root@www ~]#
chkconfig netfs on

[root@www ~]#
mount -t nfs dlp.server.world:/home /home

[root@www ~]#
df -h

 Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_00-lv_00 26G 1.1G 23G 5% / /dev/sda1 99M 13M 82M 14% /boot tmpfs 1006M 0 1006M 0% /dev/shm dlp.server.world:/home 280G 1.3G 264G 1% /home 
# home directory on NFS is mounted
[root@www ~]#
vi /etc/fstab

# add at the lat line: change home directory this server mounts to the one on NFS

 /dev/vg_00/lv_00 / ext3 defaults 1 1 LABEL=/boot /boot ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 /dev/vg_00/lv_01 swap swap defaults 0 0 
 dlp.server.world:/home /home nfs defaults 1 1