There’s an old saying that you can neither be too thin or have too much money. I’d like to add to that list – you can’t have too many web servers available on your PC. For the non-geeks amongst you, a web server is a program that runs on a computer to ‘serve up’ web pages. because I write web software for part of my living, I run my own web server on my PC. Actually, that’s not quite true…because there are two main web servers used today – Microsoft’s IIS and Apache – I have two. And today I decided that it would be really useful to have a web server and associated software on a USB stick that I could plug in to computers to demonstrate my web applications out on client sites.
I decided to use the MOWES installation – after all, it’s designed to run on USB sticks – and as well as the standard Apache, PHP and mySQL I decided to also install Mediawiki and WordPress. As well as being used for demonstrations, I decided that I’d also like to have a portable Wiki to use for note taking / book research when I’m on my travels, and run a demonstration instance of WordPress.
The simplest installation involves putting a package together on the MOWES website, downloading it to your PC and installing it. To get started with this, go to the MOWES Mixer page, click the ‘New Package’ radio button and select what you want to install. For my purposes I chose the full versions of Apache, mySQL 5 , PHP5, ImageMagick, Mediawiki, WordPress, and phpMyAdmin. This selection process is done by ticking the displayed checkboxes – if you DON’T get a list of checkboxes for the ‘New Package’ option, try the site again later – I have had this occasionally and it will eventually give you the ‘ticklist’ screen.
Tick the desired components and download the generated package.
Plug in your USB stick, and unzip and install the MOWES package as per their instructions. First thing to note here is that you may need to keep an eye on any requests from the computer for allowing components access to the firewall. The default settings will be Port 80 for the Apache web server and 3306 for mySQL. If these aren’t open / available – especially the mySQL one – then the automatic install of the packages by the MOWES program will fail miserably.
Once you have the files installed on your memory stick, then you can configure them.
If you never intend to run the installation on any PC that has a local Web Server or instance of mySQL, then you don’t need to do anything else in terms of configuration. You might like to take a look at ‘Tidying Up’ section below.
If you ARE going to use the USB Stick on PCs that may have other web servers or mySQL instances running, then it’s time to come up with a couple of ports to use for your USB stick that other folks won’t normally use on their machines. The precise values don’t matter too much – after all, the rest of the world won’t be trying to connect to your memory stick – but be sensible, and avoid ports used by other applications.
I eventually chose 87 for the Apache Web Server, and 4407 for mySQL – 87 fitted with my own laptop where I already have a web server at Port 80 and another one at Port 85, and I run mySQL at the standard port of 3306. NOTE that if you run the installation using an account with restricted privileges, you may not be able to open the new ports you use.
In order to configure the MOWES installation you’ll need a text editor of some sort – Windows Notepad will do at a push. You’ll be editing a couple of files on the USB stick, as follows:
Open this file up and look for a line starting with Listen. Change the number following it to the number you’ve chosen for your Apache Port – e.g. 87.
Now look for ‘ServerName’ – change the line to include the Port number – e.g. localhost:87
Open this file and find the line starting mysql.default_port. Change the port referenced in this to the Port you have chosen for your mySQL installation. E.g. mysql.default_port=4407
Open the file and look for two lines like port=3306. Change the port number to the one you have chosen – e.g. 4407 – port=4407. There will be two lines like this in the file, one in the [client] section and one in the [server] section.
This is the configuration file for the phpMyAdmin program that provides a graphical user interface on to the mySQL database. Look for a line that starts with : $cfg['Servers'][$i]['port'] and replace the port number in the line with (in this example) 4407.
And that, as they say, is that for the configuration files. You can now start up the MOWES server system by running the mowes.exe program. If all is working, after a few seconds your web browser will be started and will load the ‘home page’ of the MOWES installation. With the configuration carried out in this article, the browser will show the url http://localhost:87/start/ and the page displayed will show links to WordPress, Mediawiki and phpmyadmin.
The final stage of configuration is to make a change to WordPress that allows WordPress to run on a non-standard Apache port. This needs to be done via phpmyadmin, as it involves directly changing database entries. Open phpmyadmin, and then open the wordpress database from the left hand menu.
Now browse the wp_options table. Find the record where option_name is ‘siteurl’ and change the option_value field to (for using a port number of 86) http://localhost:86/wordpress. Now find teh record with option_name of ‘home’ and again change the option_value to http://localhost:86/wordpress.
You may like to put an autorun.inf file on the root of your memory stick, so that when it is plugged in to a machine it will automatically start the MOWES system (if the machine is so configured). The file can be created with a text editor and should contain the following:
label=Your Name for the Installation
And that’s that!