Ubuntu – NFS quick and simple

I found a few tutorials which went into depth on various aspects of NFS (Linux file sharing) and finally used this method. There is no security and I currently have clients set to manually mount shared drives after reboot. I may work on that later.

On the Server:
install NFS files from a terminal:
sudo apt-get install nfs-kernel-server nfs-common portmap

You can create a folder to house your shares or use an existing one.
create an export file which will define what folders will be shared using your favorite editor edit /etc/exports (using sudo). I have added a few lines like these:

/exports 192.168.1.1/24(rw,no_root_squash,async)
/exports/anotherfolder 192.168.1.1/24(rw,no_root_squash,no_subtree_check,async)

The first part (/exports) is the location of the folder can be anything.

The second part (192.168.1.1/24) is the ip addresses allowed to access this can be a single address or a subnet like this example.

The third part ((rw,no_root_squash,no_subtree_check,async)) defines the permissions.  These are read/write.

Last you have to edit /etc/default/nfs-common change the following lines to reflect these settings:

# Do you want to start the idmapd daemon? It is only needed for NFSv4.
NEED_IDMAPD=yes
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=no

After editing this file you have to restart the nfs using:

sudo exportfs -a

On the Client:

Install the necessary files:

sudo apt-get install nfs-common portmap

On the client you have to edit /etc/default/nfs-common to match the server:

# Do you want to start the idmapd daemon? It is only needed for NFSv4.
NEED_IDMAPD=yes
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=no

Next create a folder where you want to have the shared file exist:

mkdir ~/sharedfiles

now simply mount the shared drive to the directory (let’s assume that the server ip is 192.168.1.10):

sudo mount 192.168.1.10:/export/anotherfolder ~/sharedfiles

That should do it.

Next I’ll try and figure out how to remount these files after reboot on the client.  You will have to re-run the mount command above if you reboot your client.

Other Links:

http://www.ubuntugeek.com/nfs-server-and-client-configuration-in-ubuntu.html

https://help.ubuntu.com/community/NFSv4Howto

http://www.ubuntugeek.com/mount-network-file-systems-nfssamba-in-ubuntu.html

 

Leave a Comment

Filed under Ubuntu

Leave a Reply