Making a NFS-server is done in two steps. Setting up the server and then starting it.
1.1 Configurating the server
The files to edit is placed in the /etc folder.We are going to edit the exports-, hosts.deny- and the hosts.allow-file.
/etc/exports
The /etc/exports contains information on what dirrectories you share and what permitions the clients have. Use an editor to edit the file and add a line with the following format:
directory mashine1(option11, option12) machine2(option21, option22)... |
A line could look like this:
/home 192.168.0.(ro,no_root_squash) 192.168.0.1(rw,no_root_squash)
|
/etc/hosts.deny
The /etc/hosts.deny contain information on which deamons the clients are denied to access. Insert a line which sais
ALL:ALL |
/etc/hosts.accept
The /etc/hosts.accept contain information on which deamons the clients are allowed to access. Insert the following lines:
portmap: [client-ip or name] lockd: [client-ip or name] rquotad: [client-ip or name] mountd: [client-ip or name] statd: [client-ip or name] |
1.2 Starting the server
Newer releases should start the NFS at startup. Check if it’s already running by running “# rpcinfo -p”. This should show something like this:program vers proto port 100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper 100011 1 udp 749 rquotad 100011 2 udp 749 rquotad 100005 1 udp 759 mountd 100005 1 tcp 761 mountd 100005 2 udp 764 mountd 100005 2 tcp 766 mountd 100005 3 udp 769 mountd 100005 3 tcp 771 mountd 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 300019 1 tcp 830 amd 300019 1 udp 831 amd 100024 1 udp 944 status 100024 1 tcp 946 status 100021 1 udp 1042 nlockmgr 100021 3 udp 1042 nlockmgr 100021 4 udp 1042 nlockmgr 100021 1 tcp 1629 nlockmgr 100021 3 tcp 1629 nlockmgr 100021 4 tcp 1629 nlockmgr |
Add the commands to /etc/rc.local to make them permanent.
This should start the correct deamons. Now run the “# rpcinfo -p” again and check the table.
Now export your filesystem by typing: “# exportfs -ra”, check it by runnning “# showmount -e [ip-adresse]“.
2. NFS-client
Simlply add the following line in /etc/fstab:# device mountpoint fs-type options dump fsckorder [hostip]:[folder] [folder] nfs rw,hard,intr 0 0 linux.uib.no:/home/ /home/linux/ nfs rw,hard,intr 0 0 |
Write “# mount -a” to remount all the lines in fstab. Now see if you can access the mount point. You should be able to access it at this point. For permanent mounting… Edit the /etc/rc.local. Add the following line:
mount -a |
Now your nfs should work!
For troubleshooting, FAQs and more detailed descripitons read theNFS-HOWTO here.
And remember to check your firewall!