While I do mostly WEB development I sometimes need an Android environment to play around with. Moreover development is a hobby for me, so I have environments on my workplace, on my home desktop and even on my laptop, which is kind of tricky to support. Imagine what could cause you a single renstallation of the OS. Not to mention that your HDD gets shredded into several folders and sub-folders. It is not a rarity for you to need a second OS. As I am a Linux guy I feel more comfortable with Ubuntu, but as the other people using my home computer are not that familiar with Linux systems I needed both Linux and Windows at the same time.
So I figured out that moving a development environment on a virtual machine might be a solution. Thus I have both a normal intact simple OS for movies, browsing and games, and another one full of developers toys.
In general what I like for this way of work is:
- You can make a backup of the dev machine
- Single-machine for every environment that you need
- Easily set-up on a new hardware.
To the point…
For this task I chose VirtualBox . It is a lightweight, freely available and very easy to maintain virtual machine, supporting different host and guest OS. For a host OS I choose Win7, as everyone is familiar with it. This gave me the capability to easily close all my development apps in a matter of seconds and for example to go for a game or a movie. When I need to continue my work, it is a matter of seconds for the VirtualBox to resume its work, from the very point I left it, with all my windows and tools in the state I left them. Very nifty feature when you really need to stop for a while.
So, I installed VirtualBox and created a new machine. I gave it the recommended amount of video memory, about 1.5GB of RAM and about 80GB of HDD. I don’t think for PHP you might need any more space, because having 2-3GB for the OS and another 1GB for your Dev tools, leaves you with plenty amount of space, taking in account that all you’ve got is text files and images. But as you all know this is a matter of personal preference. A nice way of configuring the machine is to leave the created Hard Drive dynamic, so at the beginning the file, representing the drive would be just a couple of GB, instead of the full HDD capacity.
For the guest OS I choose Lubuntu. A pretty lightweight version of Ubuntu, with the LXDE integrated as Desktop Environment. If you prefer you can switch to one of those “window managers” that offer you verry basic X environment and that leave all to you. While lightweight, Lubuntu still has all the ubuntu configuration tools.
A vital thing is installing the VirtualBox tools. Generally you mount it as a usb drive via the machine’s menu and access it via command line. These tools install a virtual driver for the display and other stuff, that make the virtual machine go full screen and utilize the real hardware better. Without these drivers you go 1024×768 or so and with poor performance and integration options. My first attempt of installing it resulted in “Unsupported X window version” error or something like that. Apeared that I need the kernel module building tools (DKMS) so that the shell script, used to install drivers could build the modules. You will also need kernel sources and Gnu C compiler. For the later two there are console messages so no worries.
At this point you have a stable running Linux distribution. If from this point you’re going to create multiple different environments out of it, a good idea is to clone the HDD image so that you can easily start your second environment with the working OS as a start.
Some development environments are not that appropriate for deploying on a virtual machine, where you have intensive CPU utilization. A good thing would be if you have a quad-core CPU so that you can spare 3 out of the 4 cores for the virtual machine and leave 1 CPU core for the host OS. This will increase performance issues when you deal with JAVA for example.
For environments with smaller requirements, for example my PHP environment 1 out of 2 cores, 2GB RAM and 30MB video ram, with installed VB tools works flawlessly, without noticing if you are on a virtual machine or you’re running a guest OS.
My Android environment is still under fine-tuning but the same basic resources work for it good. As most of my PCs are with either P4 of Intel i3 CPU with 2 cores, I find a little lack of CPU power, but you can live with it. Only my notebook gets a little hot, but you can live with that.
As always, I would appreciate you sharing how you organize your working environment. Do you use virtual machines? What tools do you use?
Thanks a lot for reading,