[176b211] | 1 | <sect2>
|
---|
| 2 | <title>Configuring nfs-utils</title>
|
---|
| 3 |
|
---|
[a945d40] | 4 | <sect3><title>Server Configutation</title>
|
---|
| 5 |
|
---|
| 6 | <para><filename>/etc/exports</filename> contains the exported directories on NFS servers.
|
---|
| 7 | Refer to the exports manual page for the syntax of this file. Also refer to the
|
---|
| 8 | NFS HowTo available at <ulink url="http://nfs.sourceforge.net/nfs-howto/"/> on how to
|
---|
| 9 | configure the servers and clients in a secure manner. For example, for sharing the
|
---|
| 10 | <filename>/home</filename> directory over the local network, the following line may
|
---|
| 11 | be added:</para>
|
---|
| 12 |
|
---|
| 13 | <screen><userinput>/home 192.168.0.0/255.255.0.0(rw)</userinput></screen>
|
---|
| 14 |
|
---|
| 15 | <para>Create the nfs-server script to start the server at boot:</para>
|
---|
| 16 |
|
---|
[bde0436] | 17 | <screen><userinput><command>cat > /etc/rc.d/init.d/nfs-server << EOF</command>
|
---|
[a945d40] | 18 | #!/bin/sh
|
---|
| 19 | # Begin $rc_base/init.d/nfs-server
|
---|
| 20 |
|
---|
| 21 | # Based on sysklogd script from LFS-3.1 and earlier.
|
---|
| 22 | # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
|
---|
| 23 |
|
---|
| 24 | . /etc/sysconfig/rc
|
---|
| 25 | . $rc_functions
|
---|
| 26 |
|
---|
| 27 | case "$1" in
|
---|
| 28 | start)
|
---|
| 29 | echo "Starting NFS Server..."
|
---|
| 30 | loadproc /usr/sbin/rpc.mountd
|
---|
| 31 | loadproc /usr/sbin/rpc.nfsd 8
|
---|
| 32 | loadproc /usr/sbin/rpc.statd
|
---|
| 33 | ;;
|
---|
| 34 |
|
---|
| 35 | stop)
|
---|
| 36 | echo "Stopping NFS Server..."
|
---|
| 37 | killproc /usr/sbin/rpc.nfsd
|
---|
| 38 | killproc /usr/sbin/rpc.mountd
|
---|
| 39 | ;;
|
---|
| 40 |
|
---|
| 41 | reload)
|
---|
| 42 | echo "Reloading NFS Server..."
|
---|
| 43 | /usr/sbin/exportfs -ra
|
---|
| 44 | ;;
|
---|
| 45 |
|
---|
| 46 | restart)
|
---|
| 47 | $0 stop
|
---|
| 48 | sleep 1
|
---|
| 49 | $0 start
|
---|
| 50 | ;;
|
---|
| 51 |
|
---|
| 52 | status)
|
---|
| 53 | statusproc /usr/sbin/rpc.mountd
|
---|
| 54 | statusproc /usr/sbin/rpc.nfsd
|
---|
| 55 | ;;
|
---|
| 56 |
|
---|
| 57 | *)
|
---|
| 58 | echo "Usage: $0 {start|stop|reload|restart|status}"
|
---|
| 59 | exit 1
|
---|
| 60 | ;;
|
---|
| 61 | esac
|
---|
| 62 |
|
---|
| 63 | # End $rc_base/init.d/nfs-server
|
---|
| 64 | <command>EOF
|
---|
| 65 | chmod 755 /etc/rc.d/init.d/nfs-server &&
|
---|
| 66 | ln -s /etc/rc.d/init.d/nfs-server /etc/rc.d/rc0.d/K48nfs-server &&
|
---|
| 67 | ln -s /etc/rc.d/init.d/nfs-server /etc/rc.d/rc1.d/K48nfs-server &&
|
---|
| 68 | ln -s /etc/rc.d/init.d/nfs-server /etc/rc.d/rc2.d/K48nfs-server &&
|
---|
| 69 | ln -s /etc/rc.d/init.d/nfs-server /etc/rc.d/rc3.d/S24nfs-server &&
|
---|
| 70 | ln -s /etc/rc.d/init.d/nfs-server /etc/rc.d/rc4.d/S24nfs-server &&
|
---|
| 71 | ln -s /etc/rc.d/init.d/nfs-server /etc/rc.d/rc5.d/S24nfs-server &&
|
---|
| 72 | ln -s /etc/rc.d/init.d/nfs-server /etc/rc.d/rc6.d/K48nfs-server</command></userinput></screen>
|
---|
| 73 |
|
---|
[176b211] | 74 | </sect3>
|
---|
| 75 |
|
---|
[a945d40] | 76 | <sect3><title>Client Configutation</title>
|
---|
| 77 |
|
---|
| 78 | <para><filename>/etc/fstab</filename> contains the directories that are to be mounted
|
---|
| 79 | on the client. Alternately the partitions can be mounted by using the
|
---|
| 80 | <command>mount</command> command with the proper options. To mount the <filename>/home</filename>
|
---|
| 81 | partition, add the following to the <filename>/etc/fstab</filename>:</para>
|
---|
| 82 |
|
---|
| 83 | <screen><userinput><server-name>:/home /home nfs rw 0 0</userinput></screen>
|
---|
| 84 |
|
---|
| 85 | <para>Create the nfs-client script to mount the partitions at boot:</para>
|
---|
| 86 |
|
---|
[bde0436] | 87 | <screen><userinput><command>cat > /etc/rc.d/init.d/nfs-client << EOF</command>
|
---|
[a945d40] | 88 | #!/bin/sh
|
---|
| 89 | # Begin $rc_base/init.d/nfs-client
|
---|
| 90 |
|
---|
| 91 | # Based on sysklogd script from LFS-3.1 and earlier.
|
---|
| 92 | # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
|
---|
| 93 |
|
---|
| 94 | . /etc/sysconfig/rc
|
---|
| 95 | . $rc_functions
|
---|
| 96 |
|
---|
| 97 | case "$1" in
|
---|
| 98 | start)
|
---|
| 99 | echo "Mounting NFS Partitions..."
|
---|
| 100 | loadproc /usr/sbin/rpc.statd
|
---|
| 101 | loadproc /usr/sbin/rpc.lockd
|
---|
| 102 | mount -a -t nfs
|
---|
| 103 | ;;
|
---|
| 104 |
|
---|
| 105 | stop)
|
---|
| 106 | echo "Unmounting NFS Partitions..."
|
---|
| 107 | umount -a -t nfs
|
---|
| 108 | killproc /usr/sbin/rpc.lockd
|
---|
| 109 | killproc /usr/sbin/rpc.statd
|
---|
| 110 | ;;
|
---|
| 111 |
|
---|
| 112 | restart)
|
---|
| 113 | $0 stop
|
---|
| 114 | sleep 1
|
---|
| 115 | $0 start
|
---|
| 116 | ;;
|
---|
| 117 |
|
---|
| 118 | status)
|
---|
| 119 | statusproc /usr/sbin/rpc.statd
|
---|
| 120 | statusproc /usr/sbin/rpc.lockd
|
---|
| 121 | ;;
|
---|
| 122 |
|
---|
| 123 | *)
|
---|
| 124 | echo "Usage: $0 {start|stop|restart|status}"
|
---|
| 125 | exit 1
|
---|
| 126 | ;;
|
---|
| 127 | esac
|
---|
| 128 |
|
---|
| 129 | # End $rc_base/init.d/nfs-client
|
---|
| 130 | <command>EOF
|
---|
| 131 | chmod 755 /etc/rc.d/init.d/nfs-client &&
|
---|
| 132 | ln -s /etc/rc.d/init.d/nfs-client /etc/rc.d/rc0.d/K48nfs-client &&
|
---|
| 133 | ln -s /etc/rc.d/init.d/nfs-client /etc/rc.d/rc1.d/K48nfs-client &&
|
---|
| 134 | ln -s /etc/rc.d/init.d/nfs-client /etc/rc.d/rc2.d/K48nfs-client &&
|
---|
| 135 | ln -s /etc/rc.d/init.d/nfs-client /etc/rc.d/rc3.d/S24nfs-client &&
|
---|
| 136 | ln -s /etc/rc.d/init.d/nfs-client /etc/rc.d/rc4.d/S24nfs-client &&
|
---|
| 137 | ln -s /etc/rc.d/init.d/nfs-client /etc/rc.d/rc5.d/S24nfs-client &&
|
---|
| 138 | ln -s /etc/rc.d/init.d/nfs-client /etc/rc.d/rc6.d/K48nfs-client</command></userinput></screen>
|
---|
[176b211] | 139 |
|
---|
| 140 | </sect3>
|
---|
| 141 |
|
---|
| 142 | </sect2>
|
---|
| 143 |
|
---|