Since I swapped my loved Linux machine for a nice Macbook been having some issues to have all my environment working they way I want it, so I decided to have the best of both worlds and setup all my development environment (or most of it) inside a virtual machine, in my case i decided to use VirtualBox mostly because I already know how to work with this technology. This has one BIG added value, I can setup different VM to fulfill the needs of different projects without having to reconfigure my own machine.
These are the steps I took to make everything work altogether
Install VirtualBox, get it from wherever you want, but have it working before start
Download your favorite linux distribution iso image, in my case I choose Debian, because I am really comfortable working with that distro.
Setup a new machine, with a new hard disk, then setup the cd of the virtual machine to load the linux distro (for install purposes only), setup a second network adapter, one should be attached to NAT (so your vm can access to internet, to load and upgrade the software) and the other should be a host only adapter, to serve the websites to the host machine.
Also, you need to setup a shared folder, so the vm can access the sources from the host machine, I setup the shared folder to be my workspace, so I can access anything I need from inside the VM.
Then launch the VM and follow the steps through install process.
For my own purposes, the default system with the added web server and database server options are enough, I will reconfigure it to my needs later anyways.
Configuring the host machine:
The only extra config I needed to do was to modify the /etc/hosts file so my vm special domain vm.informalthinkers.com pointed to the vm IP address, but that’s because I prefer to use a domain name instead of an IP
Configuring the guest machine:
after the install process is finished these are the config changes I made
add this to the end of the file
iface eth1 inet static
the installed the ssh server with
apt-get install openssh-server
and then install the virtualbox guest additions, so you can access the shared folder. I had to install bzip2 package (I would have swear that this came with debian, but no) also the dkms kernel modules are mandatory, that are not in the main debian repositories, so I used this tool to generate the sources.list
after installing the sources.list file and added GPG keys, everything is ready, only need to
apt-get install bzip2 dkms
reboot, check that the machine is working properly and the shared folder is accesible, if everything looks good that’s it, take a snapshot of the system now that is clean and working, you could also export the appliance so you can have it as a quick start for the next project that needs something different.
Have fun and enjoy working!