Install Gitorious on CentOS 5

Recently I had to install Gitorious on a CentOS machine. Instructions on how to do this are in a document inside the gitorious code base, but since I needed something repeatable and reliable, I’ve turned to my tool of choice – Puppet.

So I’ve created a Puppet recipe which installs Gitorious behind a Phusion Passenger/Apache setup. You can get it on GitHub, here. The steps you must follow to use this recipe are:

  1. Install the base OS. I’ve tested it on a bare-bones machine, installed via the CentOS-NetInstall iso disk. I then just picked the Base packages and started the install.
  2. Add the Epel repository in order to get rubygems working. There are other ways of doing this (from source, other 3rd party repos) but this is the way I did it.
  3. Install rubygems: yum -y install rubygems git
  4. Install puppet from gem repos: gem install --no-ri --no-rdoc facter puppet
  5. Clone the repo into /etc/puppet:
    sudo -i
    git clone git:// /etc/puppet
  6. Go into modules/gitorious/manifests/init.pp and change the value of $mail_server to match the SMTP server you want.
  7. Run the standalone puppet tool to apply the recipe on the local machine puppet /etc/puppet/manifests/site.pp

That’s it. Just point your browser to http://yourserver/ and you should be greeted by the Gitorious page.
Be aware though, that if you do not set a fully qualified domain name (e.g. server.domain) you won’t be able to login or perform other actions that require a valid session in Firefox.