NFS Server2011/03/16 |
Configure NFS Server to share any directories on your Network. |
|
[1] | It's the Configuration on the system you want to build NFS server. |
[root@master ~]# yum -y install nfs-utils # install [root@master ~]# vi /etc/idmapd.conf # line 5: uncomment and change to your domain name Domain = srv.world [root@master ~]# 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@master ~]# /etc/rc.d/init.d/rpcbind start Starting rpcbind: [ OK ] [root@master ~]# /etc/rc.d/init.d/nfslock start Starting NFS statd: [ OK ] [root@master ~]# /etc/rc.d/init.d/nfs start RPC: Registered udp transport module. RPC: Registered tcp transport module. RPC: Registered tcp NFSv4.1 backchannel transport module. Installing knfsd (copyright (C) 1996 okir@monad.swb.de). Starting NFS services: [ OK ] Starting NFS daemon: NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory NFSD: starting 90-second grace period [ OK ] Starting NFS mountd: [ OK ] [ OK ] Starting RPC idmapd: [ OK ] [ OK ] [root@master ~]# chkconfig rpcbind on [root@master ~]# chkconfig nfslock on [root@master ~]# chkconfig nfs on |
[2] | Configuration on NFS clients |
[root@www ~]# yum -y install nfs-utils # install [root@master ~]# vi /etc/idmapd.conf # line 5: uncomment and change to your domain name Domain = srv.world [root@www ~]# /etc/rc.d/init.d/rpcbind start Starting rpcbind: [ OK ] [root@www ~]# /etc/rc.d/init.d/rpcidmapd start Starting RPC idmapd: RPC: Registered udp transport module. RPC: Registered tcp transport module. RPC: Registered tcp NFSv4.1 backchannel transport module. [ 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 rpcbind on [root@www ~]# chkconfig rpcidmapd on [root@www ~]# chkconfig nfslock on [root@www ~]# chkconfig netfs on [root@www ~]# mount -t nfs master.srv.world:/home /home [root@www ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 18G 864M 16G 6% / tmpfs 499M 0 499M 0% /dev/shm /dev/vda1 485M 47M 413M 11% /boot master.srv.world:/home 18G 864M 16G 6% /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/mapper/VolGroup-lv_root / ext4 defaults 1 1 UUID=2078630e-e84a-49e7-af68-55f0bde8d6c3 /boot ext4 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 master.srv.world:/home
/home nfs defaults 1 1 |
|