Virtual Machines, NFS and LinuxMint 15


Over the past 5 or so years I have been trying the new flavours of Ubuntu and Mint as they have been coming out. Bit by bit they have got better and better and now, with LinuxMint 15 I really feel it is a true competitor to big boys on top AKA Gates and Jobs.

Anyway, I arrived at Mint after Windows was blue screening after I was attempting to “map a network drive” from an NFS share on a virtual machine running Ubuntu 12.04 lts. NFS is far easier to setup than Samba and even runs faster.


Step 1 – Install VMware Player

sudo apt-get install build-essential linux-headers-$(uname -r)
sudo wget -c http://goo.gl/JXy7L -O VMware-Player-5.0.2-1031769.x86_64.bundle.tar
sudo tar -xvf VMware-Player-5.0.2-1031769.x86_64.bundle.tar

sudo chmod +x VMware-Player-5.0.2-1031769.x86_64.bundle
sudo sh VMware-Player-5.0.2-1031769.x86_64.bundle

Step 2 – Create a virtual machine running Ubuntu 12.04 lts
Download an ISO copy of the server, http://releases.ubuntu.com/precise/

Open your VMware Player

Click “Create a new virtual box”

Select “use ISO image” and browse to your freshly downloaded ISO, hit next.

Set the disk size and set to split virtual disk, hit next then finish.

If the ISO is the same bit architecture as your LinuxMint OS then VMware should flicker away and you box will be ready in a few minutes.


Step 3 – Map the IP to a local domain from Mint

Get the IP of the virtual box, just run this command from your virtual machine

ifconfig

Open a new terminal window in Mint and open the hosts file

sudo nano /etc/hosts

Enter a domain name against the IP, eg:

192.168.125.52    local.mywebsite.co.uk

You should now be able to access the webroot of you virtual box by entering your new domain name instead of the IP

Step 4 – Configuring your Ubuntu installation
When you have SSH installed on your VM you will be able to SSH into it from a Mint terminal window:

ssh username@local.mywebsite.co.uk

Now you wont have to use the VMware terminal, which is awefull.

This guide will show you how to set up Ubuntu: http://webconfiguration.blogspot.co.uk/2012/11/server-setting-up-ubuntu-1204-lts.html


Step 5 – Install NFS on your Ubuntu VM and share the webroot

Set the config file for NFS:

Add your share: 

These settings accomplish several tasks:
rw: This option allows the client server to both read and write within the shared directory
sync: Sync confirms requests to the shared directory only once the changes have been committed.
no_subtree_check: This option prevents the subtree checking. When a shared directory is the subdirectory of a larger filesystem, nfs performs scans of every directory above it, in order to verify its permissions and details. Disabling the subtree check may increase the reliability of NFS, but reduce security.
no_root_squash: This phrase allows root to connect to the designated directory

Once you have entered in the settings for each directory you want to share, run the following command to export them:

Step 6 – Mount the NFS from Ubuntu into Mint
https://www.digitalocean.com/community/articles/how-to-set-up-an-nfs-mount-on-ubuntu-12-04
With your VM running in the background, fire up a new terminal in Mint.

Now simply mount the NFS share