VulgarisOverIP

Handling Multiple Web Development Projects Using VMware

This morning a client that I’m currently developing for called me to inform me that they needed to use their web application immediately. I had to host it for them myself as they didn’t have their own server, but I was already working on another project that I was already hosting.

Normally this involves editting my httpd.conf file, adding a virtual server, messing with the firewall and restarting Apache. But today I decided to try something new: setup a VMware Workstation session running Ubuntu server and use the Shared Folders feature to link my project to the document root. I’ve been really pleased with the results and now, if I need to setup another server for a client, I can just clone my current session, share another project folder and it’s up in minutes.

For me, the biggest upside to doing it this way is that each application can assume they are running with default settings including standard HTTP/S ports. This means no fancy setup of name servers when you are trying to host multiple sites, each with SSL. Another nice thing is the added security between clients who are now partitioned into their own virtual servers and not having to restart Apache or MySQL for all your other projects. It’s real easy, here’s how I did it:

  1. Install VMware and get it running
    Go to , create a profile and get a VMware Workstation key, download the program and follow the instructions. Setting it up has never been a problem and is kind of beyond the scope of this article, just don’t forget to run vmware-config-tools.pl after installing it.
  2. Download Ubuntu Server and install it
    Head over to and follow the links to download the SERVER version of Ubuntu, the standard version has too much stuff we don’t need. Create a new VMware session (make sure to choose Linux, or specifically Ubuntu as the OS) and remove the sound and floppy hardware in the session settings. In the cdrom settings, make sure the device is pointed to the ISO you just downloaded. Boot up the machine and keep hitting enter until you’re done (you may to choose ‘yes’ instead of ‘no’ once during the partitioning sequence). I chose not to install the LAMP version because I’m going to download xampp to host the web site, but do whatever you’re more comfortable with. The whole installation process took about 10 minutes on my 2.6 GHz P4 dual-core with 2 gigs of RAM, but VMware’s cloning feature means you only have to go through this once. I suggest you update the system with a sudo apt-get upgrade upon logging on for the first time.
  3. Setup XAMPP (or roll your own LAMP)
    Over time I’ve found that downloading xampp, untarring it, and running sudo /opt/lampp/lampp start is a lot easier than setting up Apache, PHP and MySQL seperately. The easiest way to download xampp to the Ubuntu server session is to find a mirror from sourceforge and use wget. For example, here’s how I installed it from the command prompt:wget http://superb-west.dl.sourceforge.net/sourceforge/xampp/xampp-linux-1.5.4.tar.gz
    sudo tar xvfz xampp-linux-1.5.4.tar.gz -C /opt
    sudo /opt/lampp/lampp start
  4. Setup the shared folder for the document root
    Before you can install VMware tools and allow folders to be shared, you have to download the right tools. Enter this at the command prompt:sudo apt-get install make gcc linux-headers-`uname -r` build-essential xinetd Now, to install VMware tools, on the menu bar click ‘VM’ and then ‘Install VMware Tools…’. This will load the tools on a CD on your session. To actually instally the tools run these commands:

    sudo mount /dev/cdrom cd /tmp tar zxf /media/cdrom0/vmware-linux-tools.tar.gz umount /dev/cdrom cd vmware-tools-distrib sudo ./vmware-install.pl

    To share the folder find the menu bar, click on ‘VM’, click on ‘Settings…’, click on ‘Options’, click on ‘Shared folders’ and finally click ‘Add…’. Enter a name for the folder, find your project directory and hit ‘OK’. Your project directory will now be located in the Ubuntu session at: /mnt/hgfs/[your project directory]. If you are using xampp, you can point your htdocs directory here by typing the following:

    sudo rm -rf /opt/lampp/htdocs sudo ln -s /mnt/hgfs/[your project directory] /opt/lampp/htdocs
    That’s it! If you don’t want to go through all the hastle again, I suggest you clone your VMware session now and just keep cloning it everytime you want to make a new server. To view the web site, just point your browser to the server’s IP address. Let me know what you think, I’m off to create a new session to host my own WordPress blog.

Comments