Install Redmine on CentOS

Redmine website is http://www.redmine.org/.

Install and setup prerequisites

We will need Ruby, Ruby on Rails, Git, etc. The current Redmine (0.9.3) requires Ruby 1.8.7 or 1.8.6, And RoR 2.3.5.  

Libraries

# yum install autoconf automake zlib zlib-devel

 

GIT and Subversion

We need git and svn for various installation:

# yum install git subversion

(or "apt-get install", "emerge", etc)

Compilers

We will need automake, autoconf.

Ruby

Here are three ways to install Ruby:

Method 1:

Goto this webpage ftp://ftp.ruby-lang.org/pub/ruby/, and you will find the latest ruby-1.8.7.

Method 2:

Or use svn to get the latest of 1.8.x:

$ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8/ 
$ autoconf
$ ./configure --prefix=/usr/local/ruby-1.8
$ make
$ sudo make install
$ cd ext/openssl
$
ruby extconf.rb
$ make; make install

The ext/openssl has to be compiled for redmine to work.

Rubygem

Download Rubygem from http://rubyforge.org/frs/?group_id=126, extract and run "ruby setup.rb"

Note: I was not able to use the rubygems from RubyWorks repository. After I installed that version, I got "rails not found" when trying to install rails through "gem install rails".

Ruby on Rails

At the moment, Rails 2.3.5 is the version for redmine.

# gem install rails -v=2.3.5

On CentOS-4, I got an error

ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand

I found a wonderful post that explains how to fix this: http://lucaschan.com/weblog/2007/03/22/installing-ruby-on-rails-on-cento...

Basically, you have to go back to your source directory of the ruby, and run
# cd /usr/local/src/ruby-1.8.7-p299/ext/zlib/
# ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib
# make
# make install

And then go back to your rubygem source directory, and run
# cd /usr/local/src/rubygems-1.3.7
# ruby setup.rb

Now you should be able to run
# gem install rails -v=2.3.5

Mongrel

# gem install mongrel

This will make the the website runs much much faster.

Database

If you use MySQL, then do

# yum install mysql mysql-devel
# gem install mysql

We need "mysql-devel" for gem to install mysql.

If you have to run MySQL server locally, then do "yum install mysql-server", which will pull in the package "perl-DBD-mysql".

Sendmail or Postfix

Unless you plan to use SMTP, otherwise install and configure either sendmail or postfix to allow email communication from Redmine.

RMagick

We use RMagick to enable Gantt export to png image. Install the following packages:

# yum install freetype libjpeg libpng libwmf ghostscript
# wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
# tar xzf ImageMagick.tar.gz
# mv ImageMagick-6.6.3-1/ /usr/local/src/
# cd /usr/local/src/ImageMagick-6.6.3-1/
# ./configure --disable-static --with-modules --without-perl  \
   --without-magick-plus-plus --with-quantum-depth=8
# make ; make install
# gem install rmagick

 

Install and Setup Redmine

Just follow the Redmine Installation page. Please make sure you have dev/test setup as well. This is important when you want to try out some Redmine plugins.

Account Management

Redmine doesn't have a way to delete spam accounts. To do so, we can use the script/console:

$ export RAILS_ENV="production"
$ script/console
>> u = User.find(13) #change the 13 by the id of the user you want to delete
>> u.destroy  

Assuming you want to delete user ids 13 and 20, type:

$ ./script/console production
>> [13,20].each { |u| User.find(u).destroy }  

Speed up Page Load

If your user complains about page load take too long, you can try this:

Edit the file app/views/layouts/base.rhtml, in the lines

<%= stylesheet_link_tag 'application', :media => 'all' %>
<%= javascript_include_tag :defaults %>

Add ":cache => true":

<%= stylesheet_link_tag 'application', :media => 'all', :cache => true %>
<%= javascript_include_tag :defaults, :cache => true %>

For reference, please refer to the article Combine Multiple CSS/JS Files Into a Single File in Rails and Rails API doc on ActionView::Helpers::AssetTagHelper.