NFS Server2008/11/27 |
Build NFS Server to share any directories.
|
|
[1] | Configuration on the system you want to build NFS server. |
[root@ns ~]# 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@ns ~]# /etc/rc.d/init.d/rpcbind start Starting rpcbind: [ OK ] [root@ns ~]# /etc/rc.d/init.d/nfs start Starting nfs services: [ OK ] Starting nfs quotas: [ OK ] Starting nfs daemon: [ OK ] Starting nfs mountd: [ OK ] Starting nfs idmapd: [ OK ] [root@ns ~]# /etc/rc.d/init.d/nfslock start Starting NFS statd: [ OK ] [root@ns ~]# chkconfig nfs on [root@ns ~]# chkconfig nfslock on [root@ns ~]# 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 -m Filesystem 1M-blocks Used Available Use% Mounted on /dev/hda1 5040 382 4403 8% / tmpfs 257 0 257 0% /dev/shm /dev/hda5 1008 34 924 4% /tmp /dev/hda3 5040 1062 3723 23% /usr /dev/hda4 10080 205 9364 3% /var nfs.srv.world:/home 100794 188 95486 1% /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/hda1 / ext3 defaults 1 1 devpts /dev/pts devpts gid=5,mode=620 0 0 tmpfs /dev/shm tmpfs defaults 0 0 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 /dev/hda5 /tmp ext3 defaults 1 2 /dev/hda3 /usr ext3 defaults 1 2 /dev/hda4 /var ext3 defaults 1 2 /dev/hda2 swap swap defaults 0 0 nfs.srv.world:/home /home nfs defaults 1 2
|
|