Difference between revisions of "Redmine setup"

From ArchWiki
Jump to: navigation, search
m (SQLite3 additions)
m (SQLite3 resource)
Line 242: Line 242:
* [http://www.redmine.org/wiki/redmine/RedmineInstall Official Redmine Installation]
* [http://www.redmine.org/wiki/redmine/RedmineInstall Official Redmine Installation]
* [http://www.redmine.org/wiki/1/HowTo_configure_Apache_to_run_Redmine Configuring Apache to run Redmine]
* [http://www.redmine.org/wiki/1/HowTo_configure_Apache_to_run_Redmine Configuring Apache to run Redmine]
* [http://www.redmine.org/boards/2/topics/2768 Installing Redmine with SQLite]

Revision as of 00:10, 26 January 2010


This article explains how to install Redmine, an open-source web-based project management and bug-tracking tool, on Arch Linux. For this article, MySQL(with C bindings provided by the 'mysql' gem) are used.


Package and Gem version Overview

The following packages are used at the time of this [re]writing:

ruby 1.8 <- the PKGBUILD should edited to include 'rails=2.3.5' in the Provides array(more below)
rubygems 1.8
mysql 5.1.42
apache 2.2.14

rake 0.8.3
rack 1.0.1
rails 2.3.5
mysql 2.8.1

Ruby 1.8 Environment

As Redmine doesn't support ruby 1.9, we need to use the older 1.8 from AUR instead. Remove the "ruby" package(if you have it installed), so that it doesn't conflict, and retrieve and build the packages w 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 -s /usr/bin/ruby-1.8 /usr/bin/ruby
  # (optional) link gem-1.8 to gem
  ln -s /usr/biin/gem-1.8 /usr/bin/gem

  # and retrieve the gems
  gem install rake -v=0.8.3
  gem install rack -v=1.0.1
  gem install rails -v=2.3.5

Database Preparation

Redmine can work with MySQL 4.1 or higher, PortageSQL 8 or SQLite 3.


Install the MySQL gem:

gem install mysql -v=2.8.1

Install 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';


Install SQLite

pacman -S sqlite3

SQLite is actually not a standalone application like most databases. Instead it is a C library that is linked to by the executable that is using it. Therefore, you need to point to the SQLite source to install the ruby gem.

gem install sqlite3-ruby --with-sqlite3-include=/usr/include --with-sqlite3-lib=/usr/lib

Modify database.yml

adapter: sqlite3
dbfile: db/redmine.db

Create the databases:

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

Configuring Redmine

# change to the redmine root dir
cd /opt/redmine

# copy example database configuration file
cp config/database.yml.example config/database.yml

Edit the database file for production environment:

vi config/database.yml


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

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

To create the database structure, 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 populate 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:


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

Using Apache Web Server(CGI)

Install apache according to Apache.

Make sure that Redmine works fine with the WEBrick server. Copy redmine 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 /opt/redmine directory).

Note: All other commands assume 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:

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

Edit /etc/httpd/conf/httpd.conf by adding 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

Give the 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.

Apache w/ Phusion Passenger

The CGI method described earlier is 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
gem install passenger

# install the apache2 module

This will guide you through the module compilation and installation. Note the settings it will show you in the end. They are important.

Apache Configuration

# using ''/srv/http'' as the server root dir, make a symbolic link to the redmine/public dir
	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 (again, 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>
   # server DocumentRoot, address, and admin email

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

NOTE: you need to restart Apache(if it was running) for the changes to take effect

Verify that everything is setup correctly by going to http://MY-SERVER-IP-ADDRESS/redmine. Insert non-formatted text here