The first thing that you will need to do is download Ubuntu Server. For my testing I have been using Ubuntu 10.10 but this should all work perfectly with Ubuntu 10.04 LTS if your corporate policy dictates you only use LTS releases. You will then need to install Ubuntu Server onto a machine of your choice. I won’t go into the actual installation here but a basic installation should do the trick. For my testing I was installing it into a virtual Machine on my Mac using Parallels with just 512Mb ram. If your setting up a system for a lot of developers then you may need a better machine then that.
Once Ubuntu is installed it will start up with a nice simple text login screen. Ubuntu Server does not have a graphical User Interface but if you need to use one a quick google will tell you how to use apt-get to install one. I prefer not having a GUI on a linux server as it just takes up too many system resources.
Log into your new server with the username and password that you specified during the install and you will be placed in your home directory. All the commands that are used in the setup procedure have been keyed around this directory so there is no need to change directory. This is going to be our working directory.
Lets start by making sure Ubuntu is up to date with all updates and security patches. Type the following commands and follow the prompts to update your system.
sudo apt-get update
sudo apt-get dist-upgrade
Once both these commands have completed it is time to start installing the software that we need to get our server fully up and running. This following command will use apt-get to install Apache, Mercurial, the Apache WSGI module, PHP and unzip. PHP and unzip are used in a later part of the series but there is no harm in installing them now.
sudo apt-get install apache2 libapache2-mod-wsgi php5 mercurial unzip
Once this command is complete all the software that we require has been downloaded and installed. We also need to grab a file from the Mercurial source so lets get that downloaded now. This is downloaded by using Mercurial using the ‘hg clone’ command.
hg clone http://selenic.com/repo/hg-stable
The Mercurial source has now been downloaded and put into a folder called hg-stable that has been created in our working directory.
Next we are going to create the folder structure that our Mercurial server will use to store its configuration and repositories and then change the ownership of the folder structure to www-data. This will allow the Apache web server to use the folder later when we tell it where the folder is.
sudo mkdir -p /var/hg/repos
sudo chown -R www-data:www-data /var/hg
In the next part I will show you how to set up the Mercurial WSGI script and configuration and I’ll link it to the Apache server so that you will be able to see the repositories in a web browser. Till then you can shut down your Ubuntu server using the command
sudo shutdown -h now