Notes on codes, projects and everything

Development virtual machines on OS X using VirtualBox and Ubuntu

I have been following this excellent guide written by Benjamin Thomas to set up my virtual machine for development purpose. However, when I am starting to configure a Ubuntu Quantal alpha machine, parts of the guide became inapplicable. Hence, this post is written as a small revision to the previously mentioned guide.

Most people would have said Macports and homebrew would be a better choice but I still prefer using Ubuntu due to my reliance to the mighty apt-get for everything. Besides, the announcement of /usr merge sort made me curious how it would be implemented (did not make it in Quantal Alpha 3 as far as I know), so instead of doing this on Precise, I set up a Quantal installation instead.

Virtualbox 4.1.8 was used, and instead of using server edition, I used desktop edition instead (because sometimes I prefer clicking than typing commands, and I don’t mind if it slows down my system). The process of creating a virtual machine is pretty much explained in the previously mentioned guide so I am gonna skip this part.

Getting Guest additions to work

There seems to be no way of getting the guest additions to install in Quantal through the menu (Devices->Install Guest Additions) for now, so we would be installing the guest additions offered in one of the default repositories. Firstly, install dkms through terminal, as follows

$ sudo apt-get install dkms

Then the machine needs to be rebooted in order for the changes to take effect.

$ sudo /sbin/reboot

After rebooting, install guest additions as follows

$ sudo apt-get install virtualbox-guest-additions

In the past releases of Ubuntu, guest additions would be already activated by now, or after restarting X. However, for some reason, we would need another step here in Quantal. Open up software sources and switch to “Additional Drivers” tab to enable the drivers.

Finally, reboot again to see guest additions enabled, enjoy!

$ sudo /sbin/reboot

Accessing Shared Folder

Because there’s no UI for user group management for now, therefore a couple of commands are needed here. This part is based on the guide posted by Lori Kaufman for How-To Geek. First, the user who wishes to access the shared folders needs to be a member of vboxsf.

$ sudo usermod -a -G vboxsf $USER

The shared folders should be automatically mounted at /media. However, in order to access the content of the shared folders, we would have to re-login in order for the previous change to take effect.

Creating SymLinks in Shared Folder

For security reason symlinks creation in shared folder is disabled, just issue the following command before starting the virtual machine to enable it.

VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1

Replace VM_NAME and SHARE_NAME respectively.

Setting Up My Development Environment

Most of the applications I develop are web-applications written in PHP. Besides that, I use mercurial and vim as my primary tools for development. Therefore, to get everything installed, I first install tasksel and other relevant tools.

$ sudo apt-get install tasksel ssh mercurial vim-gnome

I tried installing mercurial-git, but for some reason, it was bugged, so I installed it by following this guide to get the latest revision. However, it would require python-dulwich to be installed, as follows

$ sudo apt-get install python-dulwich

Then install LAMP stack and PostgreSQL through tasksel

$ sudo tasksel

Basically that’s all

TL;DR

Install some packages

$ sudo apt-get install tasksel mercurial dkms ssh vim-gnome python-dulwich

Reboot

$ sudo /sbin/reboot

Install Guest Additions

$ sudo apt-get install virtualbox-guest-additions

Enable drivers from Software Sources, then reboot.

$ sudo /sbin/reboot

Setup hg-git, and then add users to vboxsf group to access shared folder.

$ sudo usermod -a -G vboxsf $USER

Logout, then login back to the system to access shared folders at /media.

Done.

leave your comment

name is required

email is required

have a blog?

This blog uses scripts to assist and automate comment moderation, and the author of this blog post does not hold responsibility in the content of posted comments. Please note that activities such as flaming, ungrounded accusations as well as spamming will not be entertained.

Pings

Click to change color scheme