My virtual development environment

After reading Juozas Kaziukėnas blog post about “Virtual Machines for Web Development, I decided to create one for my development environment.

As Juozas suggested I would use VirtualBox on Ubuntu 11.04 host, and would install Ubuntu 11.04 server as guest OS. But this should work and for other host operating systems like MS Windows or Mac OS X or any othe *nix type OS.

I believe it is not necessary to describe how to install VirtualBox, just download and install with default configuration. After successful installation launch VirtualBox and create new virtual machine. Select Ubuntu Linux as operating system, select RAM and disc capacity (I used default values 512 RAM and 8GB HDD).

After virtual machine was created mount guest os install ISO to virtual device and start virtual machine. Install Ubuntu server with SSH server and LAMP server options or you can choose any other options to suite your needs. After you successful installation you need setup port forwarding to access your guest OS from host OS via SSH or browser. With VirtualBox 4.x this is quite easy just open virtual machine settings select Network group in Adapter 1 tab click Advanced and then click Port forwarding button while protecting the network with an endpoint device from https://www.fortinet.com/solutions/enterprise-midsize-business/endpoint-and-device-protection. I created port forwarding for SSH and Apache:

Now it is possible to access server via ssh from host OS terminal just type to connect:

ssh 127.0.0.1 -p 2222

Enter your credentials and you successful connected to guest OS from host OS.

Next I recommend to install guest additions to have ability to access your host OS shared folders via guest OS. I had some issues installing additions, but post “Installing VirtualBox Guest Additions on Ubuntu Server 10.04” helped me a lot. Net from virtual machine menu select Shared folders and add host OS folders witch you want access from guest OS. After you created shared folders all of them should be available in guest OS /media folder with prefix sf_.

Next I want that apache would be able to access these folders, just type in guest OS via terminal or SSH:

sudo gpasswd -a www-data vboxsf

Now apache user can access and execute web applications in all your shared folders but first virtual hosts should be created.

I know there are many other solutions like Vagrant, but I like do things in my way.

0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
This entry was posted in Server and tagged , , , , . Bookmark the permalink.

2 Responses to My virtual development environment

  1. lfx says:

    ..or you can install samba to access your virtual env directories.

    How much ram your virtual env use (with virtual box)?

    I tried vm fusion and Parallels. Parallels uses only 140-200mb versus fusion ~500mb.

  2. irmantas says:

    Samba is a option, but I prepare shared folders.
    VirtualBox uses a little bit more than 300MB of RAM

Leave a Reply

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