Virtual Apache Development Server

If you are a web developer, you will need a virtual server to test and run your code. On Linux you can install the LAMP packet (Linux, Apache, MySQL, PHP). On Windows or Mac you may prefer XAMPP. The problem: sometimes you need more! If you think of things like memcache or other packages that are only available on real Linux machines. For this you may want to install and configure a real virtual Linux server system.

Installation

The installation is quite simple. First you need to download a Linux server system as image. Then you have to create a new virtual machine and install this system. You can find a how to here.

Configuration

For our needs a good solution is to use a highly configured virtual server which uses our source code that is situated on our host machine. So we do not need to copy files every time things changes and have also the current version running on our server. For this we can use shared folders. There may be problems for configuring the right user rights and correct setup. Also it may be difficult to set up shard folders on a text based server system. I found a good how to here. The steps are:

      • Installation of a virtuel machine
      • Update
      • install dkms. This is used for the installation of the GuestAdditions
      • install GuestAdditions. The GuestAdditions can be mounted a cd rom image. You can install these additions manually from console. For this you also have to mount the cd rom drive:
      • create shared folder. For this you can use the virtual box menu. You have to choose the folder of you web application of the host system. It is important to click ok and do not choose any of the checkboxes.
      • add your username to the vboxsf user group

        change this line

        to

        here you should set your username instead of USERNAME. The number 1001 may be different. Please do not change it to 1001. It is only an example.
      • find out which UID and GID the user has

        find a line that looks nearly as this line

        please do not change anything. At this example the UID is 1000 and the GID is also 1000. The first one after the x is the UID, the second one is the GID.
      • Now we need to mount the share folder. It would be a good idea to mount it to /var/www so that your application will be found at localhost root by default.

        again, replace the numbers with your UID and GID.
      • from now on, the Apache web server should show your application. You can proof this by entering the IP of your virtual server in a browser window on your host system.

Summary

It is really easy to set up a virtual server for special needs. You can for example test your source code on different server configurations without copying any file.

(Visited 110 times, 1 visits today)

Leave a Reply

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