Redmine setup

From ArchWiki

Jump to: navigation, search

Contents

Introduction

This article explains how to install Redmine an open source, web-based project management and bug-tracking tool, on Arch Linux.

Preparation

Ruby Environment (currently not working)

Redmine is written on Ruby so grab your self a copy of ruby by typing:

 pacman -S ruby

Ruby 1.8 Environment

As redmine doesn't support ruby 1.9, we need to use older 1.8 from AUR instead. Remove "ruby" package, so that it doesn't mess up, and retrieve and build the packages with any way you're comfortable with,

  pacman -R ruby
  yaourt -S ruby1.8
  yaourt -S rubygems1.8

  # ruby1.8 installs ruby-1.8 executable. link it to "ruby":
  cd /usr/bin
  ln ruby-1.8 ruby -s

  # install rake. skip the dependency checks, as otherwise it would just fall back to ruby 1.9 instead
  pacman -Sd rake

  # and retrieve the rake libraries
  gem-1.8 install rake


Redmine Download

The latest stable release for today is 0.8.5 so lets get it by typing:

 wget http://rubyforge.org/frs/download.php/63583/redmine-0.8.5.tar.gz

And extract it:

 tar -xzvf redmine-0.8.5.tar.gz

Database Preparation

Redmine can work with MySQL 4.1 or higher, PortageSQL 8 or SQLite 3. Here we are going to discuss only MySQL integration. Download MySQL by typing:

 pacman -S mysql

For full installation and configuration tutorial see MySQL.

Start MySQL:

 sudo /etc/rc.d/mysqld start

Create database and user for redmine to use:

 mysql -u root -p
 create database redmine character set utf8;
 create user 'redmine'@'localhost' identified by 'YOUR_PASSWORD';
 grant all privileges on redmine.* to 'redmine'@'localhost';

Configuring Redmine

Change directory to redmine directory.

 cd redmine-0.8.5

Copy example database configuration file

 cp config/database.yml.example config/database.yml

Edit the database file for production environment:

 vi config/database.yml

Here is an example:

 production:
   adapter: mysql
   database: redmine
   host: localhost
   username: redmine
   password: YOUR_PASSWORD
   encoding: utf8

If you used different database name or username in section Redmine_setup#Database_Preparation make sure to change them here also.

Now we have to create database structure, simply run the following command inside redmine root directory:

 rake db:migrate RAILS_ENV="production"

This will create the database tables and the following admin account:

  Username: admin
  Password: admin

Now we need to fill the database with default information. Run the following:

 rake redmine:load_deafault_data RAILS_ENV="production"

Running Redmine

Using WEBrick Server

Run the WEBrick server:

 scripts/server -e production

Now navigate to:

 http://MY_HOSTNAME_OR_IP:3000/

If everything went fine, you should be able to see the main page of redmine. Now you can login with default admin account and configure your new redmine. Don't forget to change admin's password.

Using Apache Web Server

Install apache according to Apache.

Make sure that redmine works fine with the WEBrick server. Copy redmine-0.8.5 directory content to /srv/http/ (or any other directory you use for your server):

 sudo mkdir /srv/http/redmine/
 sudo cp -r * /srv/http/redmine/

(The last command assumes you are inside redmine-0.8.5 directory).

Note: All other commands assumes that you are inside the /srv/http/redmine/ folder (or any other folder you decided to use for your server).

Copy dispatch.cgi.example file:

 cp public/dispatch.cgi.example public/dispatch.cgi

Give dispatch.cgi execute permission:

 chmod 775 public/dispatch.cgi

Uncomment the following line from config/environment.rb file:

 ENV['RAILS_ENV'] ||= 'production'

Edit /etc/httpd/conf/httpd.conf file and add the following:

 <VirtualHost *:80>
   ServerName YOUR-DOMAIN
   ServerAdmin webmaster@<YOUR-DOMAIN>.com
   DocumentRoot /srv/http/redmine/public/
   ErrorLog logs/redmine_error_log

   <Directory "/srv/http/redmine/public/">
     Options Indexes ExecCGI FollowSymLinks
     Order allow,deny
     Allow from all
     AllowOverride all
   </Directory>
 </VirtualHost>

Give http user and group the ability to read/write the following folders:

  chown -R http.http files log tmp vendor

Restart apache:

 sudo /etc/rc.d/httpd restart

Surf to your server and check if it works. Notice that most likely it will work slower then with WEBrick server, so if there is not special need to run redmine on apache I personally suggest to use WEBrick Server.

Alternative Apache setup with Phusion Passenger

The CGI method described early was a bit slower than WEBrick server, so here I am going to describe another method by installing apache module called Phusion Passenger (also known as mod rails) similar to python module you probably used when installed Trac. The basic idea was borrowed from Samson's Weblog.

Module Setup

Install passenger:

 sudo gem install passenger

Install apache 2 module

 sudo passenger-install-apache2-module

This will compile the module, make sure to remember the setting it will show you in the end, they are important.

Apache Configuration

My server root directory is at /srv/http so I made a symbolic link like this:

 sudo ln -s /path/to/redmine-0.8.5/public /srv/http/redmine

Important: Make sure you make a link to the public directory of redmine!

Now edit /etc/httpd/conf/httpd.conf and add the following (make sure you use the directories that passenger-install-apache2-module gave you):

 LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so
 PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5
 PassengerRuby /usr/lib/ruby

And add this:

 <VirtualHost *:80>
   #Here comes the definition of server DocumentRoot and server address and admin email

   RailsBaseURI /redmine #<- We add this, if you named your symbolic link differently write it here
 </VirtualHost>

Restart apache:

 sudo /etc/rc.d/httpd restart

Go to http://MY-SERVER-IP-ADDRESS/redmine to check that if it works.

Resources

Personal tools