Installation of Redmine on Debian with Ruby and Apache integration (2)
February 4th, 2009 by Frank Niedermann, under Linux.
Redmine is a very interesting free project management web application based on Ruby on Rails. Unfortunately it’s not that easy to install the components necessary to get Redmine up and running on a Debian server. Therefore I describe what I’ve done here.
First we will install the Ruby packages from Debian:
1 | apt-get install ruby rake rubygems libmysql-ruby librmagick-ruby |
It’s possible to have an own user account for Redmine. This user needs to have the GEM_PATH set. In addition to that we prepare some directories and install rails with Gem:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | adduser --home /opt/redmine --disabled-login redmine su - redmine redmine:~$ echo export "GEM_PATH=$HOME/gems" > ~/.bashrc redmine:~$ mkdir gems redmine:~$ gem install -i $GEM_PATH rails -y redmine:~$ gem install -i $GEM_PATH rails -y Bulk updating Gem source index for: http://gems.rubyforge.org Successfully installed rails-2.2.2 Successfully installed rake-0.8.3 Successfully installed activesupport-2.2.2 Successfully installed activerecord-2.2.2 Successfully installed actionpack-2.2.2 Successfully installed actionmailer-2.2.2 Successfully installed activeresource-2.2.2 Installing ri documentation for rake-0.8.3... Installing ri documentation for activesupport-2.2.2... Installing ri documentation for activerecord-2.2.2... Installing ri documentation for actionpack-2.2.2... Installing ri documentation for actionmailer-2.2.2... Installing ri documentation for activeresource-2.2.2... Installing RDoc documentation for rake-0.8.3... Installing RDoc documentation for activesupport-2.2.2... Installing RDoc documentation for activerecord-2.2.2... Installing RDoc documentation for actionpack-2.2.2... Installing RDoc documentation for actionmailer-2.2.2... Installing RDoc documentation for activeresource-2.2.2... gem update --system rake db:migrate RAILS_ENV="production" rake redmine:load_default_data RAILS_ENV="production" |
Now let’s get Redmine:
1 2 3 4 5 | wget http://rubyforge.org/frs/download.php/49319/redmine-0.8.0.tar.gz tar xvfz redmine-0.8.0.tar.gz mv redmine-0.8.0 redmine chown -R redmine:nogroup files log tmp chmod -R 755 files log tmp |
Of course Redmine needs a database:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | mysql -u root -p mysql> create database redmine; mysql> grant all privileges on redmine.* to someone@localhost \ identified by 'password' mysql> exit /opt/redmine/redmine# cp config/database.yml.example config/database.yml $editor config/database.yml production: adapter: mysql database: tracks host: localhost username: someone password: password socket: /var/run/mysqld/mysqld.sock |
That’s all for the basic Redmine installation, let’s test it!
1 | /opt/redmine/redmine# ruby script/server -e production |
We should now be able to open Redmine on our server using http and port 3000 (eg http://myserver:3000).
The default Administrator login is admin/admin (change it immediately!).
Most people don’t want to start Redmine using the ruby command so we integrate Ruby and Redmine into Apache using another great product: Passenger:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | gem install passenger Building native extensions. This could take a while... Building native extensions. This could take a while... Successfully installed fastthread-1.0.1 Successfully installed rack-0.9.1 Successfully installed passenger-2.0.6 3 gems installed Installing ri documentation for fastthread-1.0.1... Installing ri documentation for rack-0.9.1... Installing ri documentation for passenger-2.0.6... Installing RDoc documentation for fastthread-1.0.1... Installing RDoc documentation for rack-0.9.1... Installing RDoc documentation for passenger-2.0.6... passenger-install-apache2-module Welcome to the Phusion Passenger Apache 2 module installer, v2.0.6. 1. The Apache 2 module will be installed for you. 2. You'll learn how to configure Apache. 3. You'll learn how to deploy a Ruby on Rails application. ... Phusion Passenger is a trademark of Hongli Lai & Ninh Bui. |
The Passenger installation suggests some configuration and that’s excactly what we do:
1 2 3 4 5 6 7 8 9 10 | /etc/apache2/mods-available# cat passenger.load LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so /etc/apache2/mods-available# cat passenger.conf PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6 PassengerRuby /usr/bin/ruby1.8 a2enmod passenger Module passenger installed; run /etc/init.d/apache2 force-reload to enable. /etc/init.d/apache2 force-reload Forcing reload of web server (apache2)... waiting . |
That should be it – now we can access Redmine on Ruby through Apache. You might want to use some VirtualHost configuration for it or something else – that’s Apache configuration.
Feel free to comment