The Summer Server Project – Part Two: VM Setup

Recap and Introduction

In the last article, I introduced what I plan to be a summer long project – writing a basic web server with the intention of learning more about networking. In this article, I outline what I’ve done in the last few days which, although small, gives a sense of where I’m going with the testing process.


The first thing to do for any long term project is to set everything up. For this project, we require two categories of services and software set up for building and testing: the development environment and the VMs. First though, before I explain what is needed of each VM, note that we will be using Python 2 for this project, not Python 3. At some point in the future, we might upgrade but for now, make sure to install Python 2.

Virtual Machines
I’ve gone with the following set of virtual machines for testing:

  1. Ubuntu Server 15.04 – it is easy, free and well supported. The most recent release of Debian was also a candidate but I went with Ubuntu (for no other reason than familiarity).
  2. Windows Server 2012 R2 – I have a licence obtained through Microsoft’s DreamSpark program so I put it to good use here as part of this learning project.

Windows was the hardest of the three operating systems to setup (I’m including OS X here). Hardest though isn’t really all that fair of an adjective to use here as it belies the ease with which setting up a test environment really is.

Windows, unlike OS X and most Linux distributions, does not come with Python pre-installed. Installing it though is easy as Python comes in an installer package like most other Windows apps. Configuring Python, however, required some work (again, “some” may be overstating things). The major hurdle to resolve (jump over if you will) is the lack of awareness of Python that PowerShell, the powerful command line interface included with Windows (I’m not using the traditional cmd application as PowerShell is more Unix like and the more I can keep my experience consistent across platforms, the better). If you don’t tell PowerShell where Python is after you’ve installed it, you’ll get errors when you try to execute a Python script. The solution, as it is on OS X and Linux (which isn’t an issue here since this is already done for you on these platforms in most cases), is to set the PATH to include the directory that Python is installed to. The PATH is basically a list of directories that get searched for binaries when you try to execute a command without providing the full path and in this case, we need the directory that contains the Python binary. This is a two step process:

  1. Find out where Python is installed. Often, it’s installed to C:\PythonXX (where XX is the version of Python installed without the period so, for example, Python 2.7 is installed to C:\Python27).
  2. Add it to the PATH.

Once you’ve found out where Python is installed, head over to Control Panel => System and Security => System. Click on Advanced system settings and then Advanced. Once you open this, click on the Environment Variables… button. Head over to the user variable section and then double click the PATH variable. At the end, add the directory of Python after a semicolon. Mine looks like the following (yours will likely look different but pay attention to the underlined part at the end):


Once you set this, quit PowerShell (if it’s open) and re-open it. Once you do this, you should be good to go.

This isn’t said very often but setting up Linux is easier. Since most Linux distributions come pre-installed with Python, everything is ready to go out of the box. If you are using one of the rare distributions that doesn’t have Python pre-installed, consult the documentation for your distribution about installing packages.

OS X is ready to go out of the box. That said, Python doesn’t have the same kind of important role that it does on Linux distributions so your version may be out of date. Open up a terminal window and execute the following:

python -v

Compare that against the version available on the Python website and update accordingly.

This is all you need to have setup. Everything else is optional including choice of editor. I like cross-platform options but, as with any coding, all editors are a personal choice. I’ve recently begun playing with Visual Studio Code but there are numerous options that may better suit your needs.