Thursday, February 18, 2016

How to Setup Network File System (NFS) on Ubuntu 14.04

In this tutorial, I will cover how to setup Ubuntu 14.04 (either desktop or server edition) as a NFS server.

First, install nfs-kernel-server
$ sudo apt-get install -y nfs-kernel-server

Next, create a directory which will be used as a network file system. In this example, I will use /var/nfs folder
$ sudo mkdir /var/nfs

Change the owner of the directory
$ sudo chown nobody:nogroup /var/nfs

Change the permission of the directory if you want to allow the clients to have access to read/write
$ sudo chomod 777 /var/nfs

Modify the export config file to let it know which directory will be used as NFS
$ sudo vim /etc/exports

Add the following line to the /etc/exports file
/var/nfs 192.168.0.101(rw,sync,no_subtree_check)

Here, I am assuming that this directory will only be accessed by 192.168.0.101. You may want to change this address if you want. Also, make sure to set your DHCP to reserve this IP address to the desired client.

Create NFS table that holds exports
$ sudo exportfs -a

Finally, simply start up the server
$ sudo service nfs-kernel-server start

That's it. In the next post, I will discuss how to connect to NFS directory from the client side.

By the way, you may want to note the server's IP address
$ ifconfig

This IP address will be needed for a client to connect to, which will be discussed din the next post.

No comments:

Post a Comment