Redmine on CentOS

If you listened to that last audioboo, you’ll maybe recognise that I like the idea that being in control of your destiny is connected to how much you know about your life. The podcast was talking about organisations but my life at the moment is not unlike an organisation, with projects, finance and time management all being features. I have been using a number of tools to track all of this activity and frankly they’re not good enough, so I thought I’d give Redmine a try, after a couple of strong recommendations. Here’s I how I set it up on my CentOS VPS (Virtual Private Server).

Install ruby

First, check that ruby isn’t already installed:

[root@server ~]# ruby -v
-bash: ruby: command not found

Next, get it over ftp, dropping it into a suitable folder:

[root@server ~]# mkdir Downloads
[root@server ~]# cd Downloads/
[root@server Downloads]# ftp

Login with username Anonymous (no password), find and download the current version (2.1.1 in my case):

ftp> cd /pub/ruby/stable
ftp> get ruby-2.1.1.tar.gz
ftp> bye

Unpack and compile it on your local system (but see below about issues with openssl before doing this):

[root@server Downloads]# tar xzvf ruby-2.1.1.tar.gz
[root@server Downloads]# cd ruby-2.1.1
[root@server ruby-2.1.1]# ./configure 
[root@server ruby-2.1.1]# make
[root@server ruby-2.1.1]# make install

Now check it’s there and the package manager for ruby (gem):

[root@server ruby-2.1.1]# ruby -v
[root@server ruby-2.1.1]# gem -v

This all worked for me, so I coule move to the next step. If you’re following this and hit problems, check out the Redmine install guide, which is what I have been following. Gem reports version 2.2.2 on my system at this point.

The application server module for Ruby in Apache is called passenger. Install it and restart Apache:

[root@server ruby-2.1.1]# rpm --import
[root@server ruby-2.1.1]# yum install
[root@server ruby-2.1.1]# yum install mod_passenger
[root@server ruby-2.1.1]# service httpd restart

Quick fix: gem openssl problem

There is a widely-reported problem with gem’s ability to work properly. It complains, when attempting an install, thus:

Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

To take the latter hint (I already have openssl installed and don’t have time to chase down the problem), you just need to add the http source and remove the https source:

gem source -a
gem source -r

Install Redmine

Now we have ruby installed, it’s just a matter of getting the code suite and setting up a database in a similar way to setting up a wordpress install. I got the source from RubyForge:

[root@server www]# wget

Untarring as before and moving the folder to the web-side, it’s now just a matter of setting up a new database and user and editing the configuration file to point it at the right database. There will some gem dependencies to resolve and this was a pain to do but not difficult. Google is your friend – there’s a lot of help out there on the forums. Give yourself an hour at the terminal to work through them, following the screen messages. The process involves editing the Gemfile and running bundler:

[root@system redmine]# bundle install --without development test

Those switches exclude the development and test environment dependencies as we’re only interested in running a production version here.

Openssl problem, again

The persistence of the availability of openssl and the appropriate inclusion within the Ruby installation eventually forced me to dig deeper. There’s no avoiding recompiling ruby from source with the right switches set. Begin by finding the openssl folder within the ruby source and executing this (yum only needed if you don’t have openssl already):

# yum install openssl-devel.i686 openssl.i686
# cd /path/to/ruby_install_package/ext/openssl/
# ruby extconf.rb --with--openssl=/usr/bin/openssl --with--openssl-lib=/usr/lib/openssl

There was a problem in the Makefile, however, so I had to add in a pointer to a missing header file, finding it first:

# sudo find / -name thread_native.h

Then adding it just after the “topfile = ” line in Makefile:

top_srcdir = /root/Downloads/ruby-2.1.1

Then run make and make install.


A few more things to run now. First, a secret key generator for session storage:

# rake generate_secret_token

Create the database structure (at the command line) and populate the database with default configuration data:

# RAILS_ENV=production rake db:migrate
# RAILS_ENV=production rake redmine:load_default_data

Create working directories and set permissions such that the application can write to them. Your installation will depend on how you configure your server but there is some help on the Redmine wiki here (look for “File System Permissions”).

Testing is quite easy: ruby has a built-in web server which will respond to a command line invocation:

[root@server redmine]# ruby script/rails server webrick -e production

If all is hunky dory so far, you can visit port 3000 on your server in your favourite browser and see a Redmine homepage.

Too many rubies

You might find that you run into difficulty when you switch from the test webserver (webrick above) to running your ruby on rails application on apache. This for me was where most of the installation time went as I tried to figure out which ruby, which gems, which passenger: where to set the configuration was complex due to the numerous packages and applications are involved in this setup.

It has been a learning process for me but I got there in the end by paying close attention to error logs and keeping track of which settings I was making. It allowed me to diagnose where the issues were and resolve them. The last hurdle was overcome by removing a version of ruby I had installed with the yum package manager on my Centos server and reconfiguring the passenger module again:


The Phusion Passenger installation guide was particularly helpful in sorting it out. I needed some final tweaks to the Apache configuration file to point at the right version of ruby and gem, and set up passenger. Once this was done, all I had to do was run the Centos virtual server reconfiguration script and restart the web server and Robert, apparently, is my mother’s brother: