Redmine is a web based application for project management built on Ruby on Rails. It has become quite popular these days; even with those of us that did not drink that Ruby on Rails Kool Aid. While our VPS hosting packages are fine tuned for running PHP applications, RoR runs really smoothly on our machines and you can readily install a Rails app on your VPS without interfering with your PHP side of things. While this tutorial was tested on our VPS hosting packages, it’s generic enough that it should work on any other VPS or dedicated server out there.

Installing Redmine in a VPS that has no Rails is still quite easy. Here is a quick guide:

Install Ruby and Rails

This is done in a few simple steps, first download the Ruby source code, uncompress it and compile it:

  1. Download the source code.
  2. uncompress by running the command:
    tar zxvf ruby-1.8.7-p174.tar.gz
  3. go into the new directory and run:
    ./configure
    make install

Download RubyGems package manager. RubyGems is the Ruby standard for publishing and managing third party libraries.

  1. Download the package
  2. uncompress it with: tar zxvf rubygems-1.3.6.tgz
  3. go into the new directory and run:
    ruby setup.rb
  4. Install Rails by running:
    gem install rails

Install Passenger

Passenger in an Apache module to serve Rails applications.

Installation steps:

  • run:
    gem install passenger
  • run:
    passenger-install-apache2-module
  • Configure Passenger by creating a file /etc/httpd/conf.d/rails.conf and putting this inside:
    LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
    PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11
    PassengerRuby /usr/local/bin/ruby
  • Add a virtual host section for your application by adding a file /etc/httpd/conf.d/redmine.conf and putting inside:
    <VirtualHost *:80>
      ServerName redmine.example.com
      DocumentRoot /usr/local/redmine/public
      <Directory /usr/local/redmine/public>
        AllowOverride all
        Options -MultiViews
      </Directory>
    </VirtualHost>

And finally, Install Redmine

  1. Checkout the SVN repository:
    cd /usr/local/
    svn co http://redmine.rubyforge.org/svn/trunk redmine
  2. Configure MySQL, create the database and DB user:
    create database redmine character set utf8;
    create user 'redmine'@'localhost' identified by 'my_password';
    grant all privileges on redmine.* to 'redmine'@'localhost';
  3. Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for “production” environment. Example for a MySQL database:
    production:
      adapter: mysql
      database: redmine
      host: localhost
      username: redmine
      password: my_password
  4. Go into the redmine directory and generate the session store secret by running:
    rake generate_session_store
  5. Generate the DB structure by running:
    RAILS_ENV=production rake db:migrate
  6. Insert the DB default data by running:
    RAILS_ENV=production rake redmine:load_default_data
  7. Go into public and run:
    cp dispatch.rb.example dispatch.rb
    chmod a+x dispatch.rb
    mv .htaccess .htaccessbak

Testing your installation

When all these is complete, test your Apache configuration by running:

/etc/init.d/httpd configtest

If no errors were found, restart Apache:

/etc/init.d/httpd restart

Load your redmine installation and login with admin / admin.