Friday, 20 February 2009

NFS Installation & configuration in fedora & RHEL-5

Server Side-
set repository ( if you are using RHEL-5)

# yum install nfs*
# yum install nfslock
# yum install portmap*

now restart all services
# /etc/init.d/nfs restart
# /etc/init.d/portmap restart
# /etc/init.d/nfslock restart

# chkconfig nfs on
# chkconfig portmap on

Make directory for share in network.
# mkdir /data
give permission as per your user management.
# chmod -R 777 /data (full permission)
Open /etc/exportfs file & edit this file.

# vim /etc/exportfs
/data *.,sync)

file save in exit.

ro: The directory is shared read only; the client machine will not be able to write it. This is the default.
rw: The client machine will have read and write access to the directory.
sync: By default, all but the most recent version (version 1.11) of the exportfs command will use async behaviour.

# /etc/init.d/iptables start
open vim /etc/sysconfig/nfs & add following line for set port for nfs in iptables running mode.

save & exit file.
# iptables -I INPUT -s -p tcp --dport 111 -j ACCEPT
# iptables -I INPUT -s -p tcp --dport 2049 -j ACCEPT
# iptables -I INPUT -s -p tcp --dport 4002 -j ACCEPT
# iptables -I INPUT -s -p tcp --dport 4003 -j ACCEPT
# iptables -I INPUT -s -p tcp --dport 4004-j ACCEPT
# iptables -I INPUT -s -p udp --dport 111 -j ACCEPT
# iptables -I INPUT -s -p udp --dport 4002 -j ACCEPT
# iptables -I INPUT -s -p udp --dport 4003 -j ACCEPT
# iptables -I INPUT -s -p udp --dport 4004 -j ACCEPT
# iptables -I INPUT -s -p udp --dport 2049 -j ACCEPT

# /etc/init.d/iptables save
# /etc/init.d/iptables restart
# /etc/init.d/nfs/restart
# showmount -e
It will be display share directory.
(note - nfs configuration server ip )

Client Side-:
start portmap or nfs services.
/etc/init.d/portmap restart

Mount nfs share directory temparly
mount -t nfs /mnt

if you want to mount permanatly then open file vim /etc/fstab file & add this line.

# vim /etc/fstab /mnt nfs defaults 0 0

Then file save & exit

# umount -a
# mount -a
# df -kh
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 73G 5.9G 63G 9% /
tmpfs 248M 124K 248M 1% /dev/shm
gvfs-fuse-daemon 73G 5.9G 63G 9% /root/.gvfs
97G 77G 21G 80% /mnt

No comments:

Post a Comment