Install NFS Server in Ubuntu
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 using the following
sudo vi /etc/default/portmap
or use the following command
sudo dpkg-reconfigure portmap
Restart Portmap using the following command
sudo /etc/init.d/portmap restart
NFS Server Configuration
NFS exports from a server are controlled by the file /etc/exports. Each line begins with the absolute path of a directory to be exported, followed by a space-seperated list of allowed clients.
You need to edit the exports file using the following command
sudo vi /etc/exports
Here are some quick examples of what you could add to your /etc/exports
For Full Read Write Permissions allowing any computer from 192.168.1.1 through 192.168.1.255
/files 192.168.1.1/24(rw,no_root_squash,async)
Or for Read Only from a single machine
/files 192.168.1.2 (ro,async)
save this file and exit
A client can be specified either by name or IP address. Wildcards (*) are allowed in names, as are netmasks (e.g. /24) following IP addresses, but should usually be avoided for security reasons.
A client specification may be followed by a set of options, in parenthesis. It is important not to leave any space between the last client specification character and the opening parenthesis, since spaces are intrepreted as client seperators.
Now you need to restart NFS server using the following command
sudo /etc/init.d/nfs-kernel-server restart
If you make changes to /etc/exports on a running NFS server, you can make these changes effective by issuing the command
sudo exportfs -a