Home > Linux, Linux 2.6, Testing > Setting Up an NFS Server in Ubuntu

Setting Up an NFS Server in Ubuntu

You may need to setup an NFS server on Ubuntu to run and debug your program on your target platform or simply to share media files on the network composed of Linux clients. If you are using Windows clients, you would usually use SAMBA/CIFS, although it is possible to setup an NFS server in Windows as well using Windows Services for UNIX 3.5.

Quick Guide to to setup an NFS server in Ubuntu without authentication.

Install the required packages:

# sudo apt-get install nfs-kernel-server nfs-common portmap

Reconfigure and restart portmap:

# sudo dpkg-reconfigure portmap
# sudo /etc/init.d/portmap restart

Edit /etc/exports:

# sudo vi /etc/exports

Add the directories to share with NFS and save the file, for example:

/nfs 192.168.1.0/24(rw,no_root_squash,async)

will give full read/write permissions to the nfs directory for computer in 192.168.1.0 subnet.

Restart the NFS server:

# sudo /etc/init.d/nfs-kernel-server restart

and reload the configuration:

# sudo exportfs -a

The installation is now complete.

To mount the NFS server (nfs directory) from another client (in /mnt/nfs), use the following command line:

# mount nfs_server_ip:/nfs /mnt/nfs

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Categories: Linux, Linux 2.6, Testing Tags: nfs, ubuntu
  1. October 2nd, 2011 at 11:34 | #1

    With the new version of nfs, you’ll also need to add no_subtree_check or subtree_check in /etc/exports or you’ll get the following warning:

    exportfs: /etc/exports [2]: Neither ‘subtree_check’ or ‘no_subtree_check’ specified for export “192.168.1.0/24:/home/jaufranc/edev/beagleboard/nfs”.
    Assuming default behaviour (‘no_subtree_check’).

  2. May 31st, 2012 at 14:00 | #2

    With Ubuntu 12.04, replace portmap by rpcbind, except for:
    sudo /etc/init.d/portmap restart

    Although the following command is now recommended:
    sudo service portmap restart

  1. January 26th, 2013 at 21:40 | #1