This is a little note on how to configure NFS (Network File System) server and mount it in Ubuntu. The server is Debian Squeeze and Client is Ubuntu 10.04. Here is how to get it done.
Step-1: Installing NFS packages.
# apt-get install nfs-common portmap nfs-kernel-server
Step-2: Configuring file system to export
Through NFS, you can export a file system or a directory to clients. The /etc/exports file defines the stuff to be exported for other system. The syntax is like,
<path of file system> <client machine-1>(options) <client machine-2>(options) …..
In the below example, I am exporting the /home/nas/torrents directory in server to client machine with IP address of 192.168.0.100 in Read-only mode.
Step-3: Updating the NFS server with new exported file system configuration
This can be done either through below command,
# exportfs -a
or by restarting the NFS service as shown below in Debian.
# /etc/init.d/nfs-common restart
Step-1: Install the NFS package from command line as shown below.
$ sudo apt-get install nfs-common
Step-2: Client machine can access NFS exports by having an entry in /etc/fstab file as shown below. In this case the server IP address is 192.168.0.103.
192.168.0.103:/home/nas/torrents /mnt/torrents nfs defaults 0 0
Another ways to access through command line is as shown below.
# mount -t nfs 192.168.0.103:/home/nas/torrents /mnt/torrents