NFS Server2010/05/29 |
Build NFS Server to share any directories. |
|
[1] | Configuration on the system you want to build NFS server |
[root@dlp ~]# yum -y install nfs-utils # install [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 ⇒ possible to read and write sync ⇒ synchronize no_root_squash ⇒ enable root privilege no_all_squash ⇒ enable users' authority
[root@dlp ~]# /etc/rc.d/init.d/rpcbind start Starting rpcbind: [ 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 daemon: [ OK ] Starting NFS mountd: [ OK ] [root@dlp ~]# chkconfig rpcbind on [root@dlp ~]# chkconfig nfslock on [root@dlp ~]# chkconfig nfs on |
[2] | Configuration on NFS clients |
[root@www ~]# yum -y install nfs-utils # install [root@www ~]# /etc/rc.d/init.d/rpcbind start Starting rpcbind: [ OK ] [root@www ~]# /etc/rc.d/init.d/rpcgssd start [root@www ~]# /etc/rc.d/init.d/rpcidmapd start [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 rpcgssd on [root@www ~]# chkconfig rpcidmapd on [root@www ~]# chkconfig nfslock on [root@www ~]# chkconfig netfs on [root@www ~]# mount -t nfs nfs.srv.world:/home /home [root@www ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 18G 810M 16G 5% / tmpfs 500M 0 500M 0% /dev/shm /dev/sda1 485M 44M 417M 10% /boot nfs.srv.world:/home 18G 843M 16G 6% /home # home directory on NFS is mounted [root@www ~]# vi /etc/fstab # add at the bottom: change home directory this server mounts to the one on NFS /dev/mapper/VolGroup-lv_root / ext4 defaults 1 1 UUID=27993c31-9468-495f-bff1-630c1cd02196 /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 nfs.srv.world:/home
/home nfs defaults 1 1 |
|