How to install Redmine in Ubuntu

Redmine is a web based project management application written in Ruby, and is based on the Ruby on Rails (RoR) framework. It has a very clean user interface and comes with a good list of features. It is probably the easiest to use and the most complete web based (software) project management tools available.

Redmine package is available in Ubuntu, which makes installation easy. It is however not very straightforward, and this tutorial will guide you step-by-step in installing Redmine in your Ubuntu machine.

This tutorial is based on Ubuntu 10.10, though it might be compatible with other release as well. The steps below details the installation. It assumes you are to use and to do a fresh installation of Apache and MySQL. A screencast of the whole installation and configuration process is also available at the end of this article.

Install packages

Redmine package is available in default Ubuntu repository. Run the following command at the terminal to install Redmine and it's related packages.

sudo apt-get install redmine redmine-mysql subversion apache2 mysql-server libapache2-mod-passenger

Configure MySQL

When installing the MySQL server package, you'll be required to set the root password.

Key in your desired password and press Enter

You'll then need to type in the password again for confirmation.

Re-enter password and press Enter

Configure Redmine database

During Redmine package installation, you'll come to these configuration windows.

Select Yes to configure it with dbconfig-common

Select database backend

You'll then be presented with the a list of supported and available database backend.

Select MySQL and press enter.

Provide MySQL root access

You'll be asked to enter login credential to your MySQL database.

Enter MySQL root password and press enter.

Set Redmine database password

You'll need to configure the password for your Redmine installation.

Enter desired password for your Redmine's database and press enter.

Don't use the random password feature (leave password blank) as it doesn't work

Confirm password

Confirm that the password you entered is correct.

Re-enter Redmine's database password and press enter.

Configure dispatcher

Add the following lines to the file /usr/share/redmine/public/dispatch.cgi

#!/usr/bin/ruby

require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)

require "dispatcher" 

ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
Dispatcher.dispatch

Configure file, directory and permissions

Some directories were not created by default during the package installation. Run the following command to create the directories.

sudo mkdir /usr/share/redmine/log /usr/share/redmine/tmp

These directories need to be writable by the user, so running these command will change the ownership of the directories.

sudo chown username /usr/share/redmine/log /usr/share/redmine/tmp

Be sure to change username with your username

The log file need to be created or the service will not start. Run the following command to do just that.

touch /usr/share/redmine/log/production.log

These files needs to be given the right permission. Run the following command at the terminal to set the permission.

sudo chmod 644 /etc/redmine/default/session.yml /etc/redmine/default/database.yml

Configure apache

The next part is to configure Virtualhost in Apache for Redmine to work. Add the following line in /etc/apache2/sites-enabled/000-default

<VirtualHost *:80>
        ServerName www.mywebsite.com
        ProxyPass / http://www.mywebsite.com:3000/
        ProxyPassReverse / http://www.mywebsite.com:3000/
</VirtualHost>

The above lines assume that you want your Redmine installation to be accessible via the www.mywebsite.com address. You can change that to fit your need.

The ProxyPass above require you to enable the proxy modules in Apache. Run the following command to do that.

sudo a2enmod proxy proxy_http

Configure htaccess

The next step is to configure Apache's htaccess. Change the file /usr/share/redmine/public/.htaccess to the following

RewriteEngine On
RewriteBase /
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

Restart apache

Once everything is configured, Apache need to be restarted for changes to take effect. Run the following command at the terminal.

sudo /etc/init.d/apache2 restart

Start service

You can start the web service with the following command, and start using Redmine at the address you configured your Apache webserver, or by pointing your browser to port 3000 of the server's address.

ruby /usr/share/redmine/script/server webrick -e production

Configure cron

The web service need to be started every time the system is booted. To do this, run the following command to edit your crontab

crontab -e

And add the following line to start the service automatically during system boot.

@reboot ruby /usr/share/redmine/script/server webrick -e production

Video tutorial

comments powered by Disqus