NFS Server2009/06/14 |
Build NFS Server to share any directories.
|
|
[1] | Configuration on the system you want to build NFS server. |
[root@dlp ~]# vi /etc/exports # add the lines *note /home 192.168.0.0/24(rw,sync,no_root_squash) # *note /home ⇒ shared directory 192.168.0.0/24 ⇒ range of networks NFS permits accesses rw ⇒ possible to read and write sync ⇒ synchronize no_root_squash ⇒ enable root privilege [root@dlp ~]# /etc/rc.d/init.d/rpcbind start Starting rpcbind: [ 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 ] [root@dlp ~]# /etc/rc.d/init.d/nfslock start Starting NFS statd: [ OK ] [root@dlp ~]# chkconfig nfs on [root@dlp ~]# chkconfig nfslock on [root@dlp ~]# chkconfig rpcbind on
|
[2] | Configuration on NFS clients |
[root@www ~]# /etc/rc.d/init.d/rpcbind start Starting rpcbind: [ 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 nfslock on [root@www ~]# chkconfig rpcbind 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 |