Setup NFS server in 5 minutes

Assuming you are on an ubuntu Linux. All you need is the following packages:
sudo apt-get install nfs-kernel-server nfs-common portmap
When configuring portmap do =not= bind loopback. If you do you can either edit /etc/default/portmap by hand or run:
sudo dpkg-reconfigure portmap
sudo /etc/init.d/portmap restart

Edit /etc/exports to make your file look like:

stelios@pappous:~$ cat /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
#        to NFS clients.  See exports(5).
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)

All you need is the last line where you will need to add the subnet that you want to give access and leave the rest as it is.
Start the service:
sudo /etc/init.d/nfs-kernel-server restart

On the client all you need is:
sudo apt-get install portmap nfs-common

Then create a directory where you are going to mount the nfs share and type:
sudo mount -t nfs /media/steliosNFS/

In the above example we have already created on the client (the one with the IP) the directory steliosNFS (mkdir /media/steliosNFS).

That's all, you can start copying over files. In a future article we are going to discuss how you can clone your hard drive and send the backup over to the NFS server that you just did.

Posted on: 22/06/2010

If you want to leave a comment please Login or Register