setup your development environment on a virtual machine

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

vim /etc/network/interfaces

add this to the end of the file


iface eth1 inet static
address 192.168.56.10
netmask 255.255.255.0

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

http://debgen.simplylinux.ch/generate.php

after installing the sources.list file and added GPG keys, everything is ready, only need to


apt-get install bzip2 dkms
mount /media/cdrom
sh ./VBoxLinuxAdditions-x86.run

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!

6 comments on “setup your development environment on a virtual machine

  1. I have already been visiting your site for 3 days. really love your posts. by the way i’m conducting a research concerning this topic. do you happen to know other good sites or maybe online forums where I might get more information?

  2. Thanks for your contribution and I will use it for my work research that I am doing for this website. gume

  3. I consider, that you are not right. I am assured. Let’s discuss. Write to me in PM.

  4. Whoa. That was a great article. Please keep writing because I love your style.

  5. I am very interested in. May I ask to spoon feed the detail please?

  6. It’s truly an excellent and useful piece of info. It is satisfied that you shared this useful info with us. Please keep us up to date like this. Thanks for sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *