NFS + Ubuntu + Mac OS X Clients = A Quickie

NFS is an old standby in the *nix world. It seems that it’s about as old as the hills and while it can be cranky at times, it’s pretty easy to setup, manage and use. Once it’s configured, you use it in a similar fashion as you do in Mac OS X Server. The client configuration is identical. To get started, let’s install the nfs-kernel-server, nfs-common and portmap packages on our Ubuntu 10.04 box:

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

Then let’s create a directory to share (aka export):

mkdir /Homes

Then we need to define the permissions for /Homes (ends up similar in functionality to the export to option in Server Admin for Mac OS X Server users):

chown nobody:nogroup /Homes

Now, let’s open up /etc/exports and allow access to Homes by configuring it as an export. To do so, paste this line in at the bottom:

/Homes        192.168.210.0/24 (rw,sync,no_subtree_check)

In the above line, we’re defining the path to the directory, followed by the address(es) that access the export. This could just be one IP address, or it could be a range of IP addresses. The above CIDR allows all IP addresses from 192.168.210.1 to 192.168.210.254 to access the export.

Now save and close the file and then run the exportfs command with the -a option (all) and you should be done with the server configuration portion:

exportfs -a

Next up, let’s port scan for nfs (port 2049) from Mac OS X using the stroke command:

/Applications/Utilities/Network Utility.app/Contents/Resources/stroke 192.168.210.254 2049 2049

Now, we need to verify that Mac OS X clients. From a client that can access the NFS server, open Disk Utility from /Applications/Utilities. Then, click on the File menu and select NFS Mounts… to bring up the NFS Mounts screen.

From the NFS Mounts screen, click on the plus sign (+) and you will see an overlay with fields for Remote NFS URL: and Mount Location:. The Remote NFS URL: field will be nfs:// followed by the name or IP of your server followed by the name of the mount you just created. The Mount Location is going to be where on the client computer that you would like the folder to be. For most scenarios, /Volumes/ followed by the name of the mount will suffice. You can see how these shake out in the following screen:

Click on Verify if it looks right and provided that the file system can be properly mounted then you’ll receive a message saying such. Then click on Save and you’re done: you should be able to browse and interact with it as needed.