Time to Build a Virtual (Sand) Box - Install the Apache 2 Web Server

Welcome back to the VirtualBox series. In the first three days we learned how a virtual operating system can be a powerful tool, installed the basic software that would allow us to run a virtual operating system, setup a container for the guest operating system and then installed the guest operating system. Today we will install the Apache 2 web server so you will have a place to host your latest project.

To being, open VirtualBox, select the Ubuntu 10.10 Sandbox Server in the left menu and click the “Start” arrow in the toolbar.

Step 1 - It make take a minute or two for the virtual server to start. Once you get the login prompt, log into the virtual server. 

Note - Don’t let the command line scare you. The information that shows up includes the last time you logged in, what version of Linux you are using and the like.

Step 2 - The first thing we need to do is update the Ubuntu software. Although we used the latest Ubuntu server disk image, the software is being updated all the time to address application or security issues.

To start the update process, the server needs an updated list of the most recent changes. You do that by typing the following command:

sudo apt-get update

You will need to enter your password because you’re requesting to temporarily run a command as an administrator. Also remember that Linux is a case sensitive operating system, so most commands you will use will be in lower case.

Note - You will a information similar to the top part of the screen shot below as the system performs an inventory of installed software and checks for updates to each installed package.

This step may take a few minutes since it is the first time it has been performed.

Step 3 - Now that you have an updated list of changes it is time to actually apply the upgrades. You do that by typing the following command:

sudo apt-get upgrade

You may need to enter your password again depending how long the previous step took and if you went out for coffee while waiting.

Step 4 - The system will display a list of changes it is about to make and ask your permission to make the changes. Type “Y” so the updates can be applied. 

Note - You will a screen similar to the screen shot below as the system performs the updates and tells you all the details about the changes.

Step 5 - This is an optional house keeping step. To remove old versions of software that are not in use but taking up disk space, type the following command:

sudo apt-get auto-clean

Step 6 - Now we are ready to install the Apache 2 server package. Ubuntu already knows where to find the software so all you need to do is tell Ubuntu to install it. You do that by typing the following command:

sudo apt-get install apache2

You may need to enter your password again. When the system asks if you would like to continue, type “Y”.

Step 7 - Compared to the update, the last step was pretty quick. Let’s make sure something actually happened. To check, type the following command:


That will tell you the IP address of the virtual server. Enter that address in your web browser and check the results. You can see my results below. 

Step 8 - Now that we have Ubuntu up and running with Apache 2 web server, we are going to need a way to copy files over to the virtual server. We are going to install Secure Shell (SSH) to allow us to copy files over securely. 

To install SSH, type the following command:

sudo apt-get install ssh

You may need to enter your password again. If the system asks if you would like to continue, type “Y”.

Step 9 - Now we need to set the permissions on the web root folder so we can copy files to it.

This is the last and most important step in this process. Why? Because people forget to do it and when they are unable to copy their files over they spend lots of time checking everything but this. 

Trust me on this. I’ve done it.

To set the permissions, type the following command:

sudo chmod 777 /var/www

Day 4 is done! You have installed a web server. Some of these steps may look a little different depending on your selections but in general everything should look and work very similar.

Next Post: Configuring the Apache 2 web server

4kg's Official Site

External image

I thought you all would be interested to know I set up an “official site” for 4kg at It’s a short and simple URL just like the name. :)

The new site is hosted using GitHub Pages (free hosting = awesome, using Git = more awesome) and uses HTML5Boilerplate as a base. It also uses some HTML5 features like the new doctype, semantic elements, and CSS3 gradients and box shadows. (It also uses Humans.txt for a bit of fun.)

Obviously there will be a lot more there when the game releases. I just wanted to throw up a page to direct people to. :)

Update: I added a “Donate” button which uses the TipTheWeb service. It seems pretty neat. Err, the money would most likely be used on making ads for the game, or maybe some books… dunno. But it would definitely kick me in the pants to finish 4kg as soon as possible, that’s for sure!