Vitual Box

What We Are Using

Host: OSX Lion

VirtualBox: 4.1.0

Guest: Ubuntu Server 11.04 (Natty Narwhal)

I'm assuming you have installed VirtualBox and the VirtualBox Extension Pack from here:

http://www.virtualbox.org/wiki/Downloads

Download Ubuntu Server 11.04 making sure you select 32 bit from the drop down:

http://www.ubuntu.com/download/server/download

Go ahead and install the VM into VirtualBox by select New and following the prompts, it will ask you for the location of the ISO you just downloaded to get started. After starting your new VM and following the prompts, make sure you install SSH server (checkbox) and write down the name of your VM, your username and password.

After creating the Ubuntu guest with SSH server installed, turn the guest OS completely off.

Go to terminal on your Mac (OSX) and type in the following replacing "Narwhal" with whatever you named your guest Ubuntu OS in VirtualBox.:

CODE:
  1. VBoxManage modifyvm "Narwhal" --natpf1 "guestssh,tcp,,2222,,22"

Start the Ubuntu guest OS.

Make sure your SSH service is running:

CODE:
  1. sudo /etc/init.d/ssh start

From your Mac (OSX) terminal SSH into your guest like this:

CODE:
  1. ssh -p 2222 deploy@127.0.0.1 (replace deploy with whatever username you created when installing Ubuntu)

Adding Shared Folders

From your Mac (OSX) terminal window that is SSH'd into your Guest Ubuntu VM run the following:

CODE:
  1. sudo apt-get install dkms build-essential linux-headers-generic

Go to the VirtualBox Devices menu and select "Install Guest Additions"

From your Mac (OSX) terminal window that is SSH'd into your Guest Ubuntu VM type the following:

CODE:
  1. sudo mount /dev/scd0 /media/cdrom
  2.  
  3. cd /media/cdrom
  4.  
  5. ls -la
  6.  
  7. sudo sh ./VBoxLinuxAdditions.run --nox11

Don't worry if you see something that says "Installing the Window System drivers …fail!". It fails because we aren't using a GUI.

Now shut down your Ubuntu VM like so:

CODE:
  1. sudo shutdown -h now

Go to VirtualBox and select your VM and go into its settings. Find the tab that says "Shared Folders" and click on the green folder icon with the plus sign. Click on the drop-down arrow and select some folder on your Mac you want to share. Select the auto-mount check box. Click OK twice and start up your Ubuntu VM. From your Mac (OSX) terminal ssh into your guest as before and type the following:

CODE:
  1. sudo -i
  2.  
  3. cd /media
  4.  
  5. ls -la
  6.  
  7. cd /media/sf_<your_share_name>
  8.  
  9. ls -la

See your files? Your done!

Tags: , , , , ,

This entry was posted on Thursday, August 25th, 2011 at 6:58 pm and is filed under Linux, Mac OSX, Technology, Ubuntu. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

One comment

 1 

Works great. Thx for sharing :)

January 11th, 2012 at 12:10 pm

Leave a reply

Name (*)
Mail (will not be published) (*)
URI
Comment