Join our Discussion Boards - Here

How To Install Redmine on Centos 5.2 Update

This is a combination of all my instructions on how to setup redmine on Centos.  Its still a work in progress so please note any problems in comments.

Install Ruby on Rails

yum install ruby ruby-devel ruby-libs ruby-irb ruby-rdoc ruby-mysql

Download and install ruby gems

wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz

tar xvf rubygems-1.3.1.tgz

cd rubygems-1.3.1

ruby setup.rb

Install Rails

gem install rails

Install Redmine

go to /opt

cd /opt

Get latest source code from http://www.redmine.org

unzip redmineXXXX.zip

Create a Database for Redmine

mysql -u root -p

create database redmine character set utf8;

exit

Configure the Redmine database connection settings

Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for “production” environment.

cp /opt/redmine-0.7.3/config/database.yml.example /opt/redmine-0.7.3/config/database.yml

edit database.yml

production:

adapter: mysql

database: redmine

host: localhost

username: yourusername

password: yourpassword

socket: /var/lib/mysql/mysql.sock

Run the following command in /opt/redmine-0.7.3/

rake db:migrate RAILS_ENV=”production”

If you get this error message: “cannot connect to mysql: No such file or directory – /tmp/mysql.sock”, You forgot to specify the socket location in config/database.yml – see above.

This will create tables and an administrator account.

Run this command to load default data into db.

rake redmine:load_default_data RAILS_ENV=”production”

Test the installation by running WEBrick web server:

ruby script/server -e production

Once WEBrick has started, point your browser to http://localhost:3000/. You should now see the application welcome page.

Use default administrator account to log in:

login: admin

password: admin

You can go to Admin & Settings to modify application settings.

You must install Rmagick as well for the nice Gant charts.

yum install ImageMagick

yum install ImageMagick-devel

gem install rmagick -v 1.15.13 –no-rdoc –no-ri

How to Autocreate SVN repositories with Redmine

Create a repository folder.

mkdir /svn

Change the owner and group to root.apache

chown -R root.apache /svn

Change the permissions

chmod 0750 /svn

Configure subversion to be browsed, goto /etc/httpd/conf.d

vi subversion.conf

Insert the following at the bottom

<Location /svn>

DAV svn

SVNParentPath /svn

SVNListParentPath on

</Location>

If you get ‘Could not open the requested SVN filesystem’ when you try to browse to your repository http://localhost/svn then you have used SVNPath instead of SVNParentPath, just update your subversion.conf and that should fix this issue.  This could also be a permission error related to the file permissions of your svn repository, make sure they are readable by apache.

Run the following command to test that it works

ruby reposman.rb -redmine localhost:3000 -svn-dir /svn -owner apache -url http://localhost/svn/ -verbose

If it does not, and fails with this error

/usr/lib/ruby/1.8/rdoc/ri/ri_options.rb:53: uninitialized constant RI::Paths (NameError)

from /usr/lib/ruby/1.8/rdoc/usage.rb:72:in ‘require’

from /usr/lib/ruby/1.8/rdoc/usage.rb:72

from reposman.rb:59:in ‘require’

from reposman.rb:59

Then you need to edit the reposman.rb file and add require statement require ‘rdoc/ri/ri_paths’ above all the other require statements.

require ‘rdoc/ri/ri_paths’

You need to add this to your crontab

5 * * * * ruby /opt/redmine-0.8.0_RC1/extra/svn/reposman.rb -redmine localhost:3000 -svn-dir /svn -owner apache -url http://localhost/svn/ -verbose >> /var/log/reposman.log

Setup permission for SVN to use apache etc

I found the instructions at http://www.redmine.org/wiki/redmine/Repositories_access_control_with_apache_mod_dav_svn_and_mod_perl did not work for me. I managed to get it working doing the following;

You do not need to but you can set subversion 1.54 by installing the RPMForge repos, follow these instructions – http://wiki.centos.org/AdditionalResources/Repositories/RPMForge

Get the necessary packages

yum install mod_dav_svn mod_perl perl-Apache-DBI perl-Digest-SHA1 perl-DBD-mysql subversion

Copy Redmine.pm from /opt/redmine-0.7.3/extra/svn/Redmine.pm to /usr/lib/perl5/vendor_perl/5.8.8/Apache/

cp /opt/redmine-0.7.3/extra/svn/Redmine.pm /usr/lib/perl5/vendor_perl/5.8.8/Apache/

create a file in /etc/httpd/conf.d/ called redmine.conf and put this in it.

PerlLoadModule Apache::Redmine

<Location /svn>

DAV svn

SVNParentPath “/svn”

AuthType Basic

AuthName redmine

Require valid-user

PerlAccessHandler Apache::Authn::Redmine::access_handler

PerlAuthenHandler Apache::Authn::Redmine::authen_handler

## for mysql

RedmineDSN “DBI:mysql:database=da;host=my.db.server”

## for postgres

# RedmineDSN “DBI:Pg:dbname=databasename;host=my.db.server”

RedmineDbUser “redmine”

RedmineDbPass “password”

</Location>

# a private location in read only mode to allow Redmine browsing

<Location /svn-private>

DAV svn

SVNParentPath “/svn”

Order deny,allow

Deny from all

# only allow reading orders

<Limit GET PROPFIND OPTIONS REPORT>

Allow from redmine.server.ip

</Limit>

</Location>

The error I received from using the Redmine-0.7.X was;

‘Invalid command ‘RedmineDSN’, perhaps misspelled or defined by a module not included in the server configuration’

This is related to not copying Redmine.pm to /usr/lib/perl5/vendor_perl/5.8.8/Apache

Install a Mongrel Front to Apache

Taken from http://www.redmine.org/wiki/redmine/HowTo_run_Redmine_with_a_Mongrel_cluster

Install Mongrel

gem install mongrel mongrel_cluster daemons

Configure the Mongrel Cluster for redmine.

cd /opt/redmine

mongrel_rails cluster::configure -e production -p 8000 -N 3 -c /opt/redmine-0.8.0_RC1 -user apache -group apache

Start the Cluster

mongrel_rails cluster::start

Configure apache as the load balancer

create a new config file in /etc/httpd/conf.d

vi /etc/httpd/conf.d/redmine.conf

paste this into the file

<VirtualHost *>

ServerName your.domain.name

DocumentRoot /opt/redmine-0.8.0_RC1

<Directory “/opt/redmine-0.8.0_RC1/public”>

Options FollowSymLinks

AllowOverride None

Order allow,deny

Allow from all

</Directory>

<Proxy balancer://redmine_cluster>

Order allow,deny

Allow from all

BalancerMember http://127.0.0.1:8000

BalancerMember http://127.0.0.1:8001

BalancerMember http://127.0.0.1:8002

</Proxy>

RewriteEngine On

RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f

RewriteRule ^/(.*)$ balancer://redmine_cluster%{REQUEST_URI} [P,QSA,L]

</VirtualHost>

And restart apache

service httpd restart

7 comments to How To Install Redmine on Centos 5.2 Update

  • PeterPresto

    I followed your instructions and luckily I (or rather: my server) survived. The downside is that i cannot get my application to work properly.

    Everything is fine when i run the test-server using: “ruby script/server -e production”, the application is running on port 3000 perfectly fine, creating subversion repositories automatically etc.

    When i issue the command [mongrel_rails cluster::start], I get the following error:
    ** Ruby version is not up-to-date; loading cgi_multipart_eof_fix
    Starting port 8000

    The same message is repeated for 8001 and 8002

    When i go to my server: http://redmine.mydomain.com/, i get a “Service Temporarily Unavailable” error.

    Any idea where i’ve gone wrong, or what’s missing? I feel like i’m so close to a working redmine installation! :)

  • PeterPresto

    @PeterPresto
    I found (with mongrel_rails cluster::status) that the mongrel pid files were not being created due to permission issues… After adjusting permissions, the mongrel cluster did start…

    All to find another error message popping up -> Status: 500 Internal Server Error Content-Type: text/html

    Is this a step closer?

  • PeterPresto

    @PeterPresto
    And… to answer my own question, yes it was a step closer. It seems like there were some ruby session files created in Redmine’s /tmp folder (possibly related with the times i accessed Redmine using WEBrick server, referring to port 3000?), which triggered the error…

    Anyway, after deleting the old session files, i could finally access Redmine using http://redmine.mydomain.com on port 80…

    Thanks for this great tutorial! It made installing Ruby on Rails and Redmine relatively easy for a newbie like me!

  • jchatard

    Hi thanks for your howto, everything went fine until this section:

    DAV svn
    SVNParentPath “/where/is/my/svn”
    AuthType Basic
    AuthName redmine
    Require valid-user
    PerlAccessHandler Apache::Authn::Redmine::access_handler
    PerlAuthenHandler Apache::Authn::Redmine::authen_handler
    ## for mysql
    RedmineDSN “DBI:mysql:database=redmine;host=localhost”
    ## for postgres
    # RedmineDSN “DBI:Pg:dbname=databasename;host=my.db.server”
    RedmineDbUser “redmine”
    RedmineDbPass “my_super_password”

    I can’t log in, I got an “auth failed” error (but I’m sure of credentials, since I can log in in Redmine). If I comment theses lines as below, I can access my repo.

    DAV svn
    SVNParentPath “/where/is/my/svn”

    Any idea?
    Thanks, Jérémy

  • lrkwz

    I’ve added:

    * Generate session store secret key (see. http://www.redmine.org/wiki/redmine/RedmineInstall)
    RAILS_ENV=production rake config/initializers/session_store.rb
    * Install mysql gem (you should have already installed mysql-devel and gcc)
    gem install mysql -v ’2.7′ — –with-mysql-config=/usr/lib64/mysql/mysql_config

    [version 2.7 is needed since the latest need ruby >= 1.8.6 and yum installs 1.8.5)

  • [...] of a well known software called Redmine. I followed the installation steps of redmine from this link, but when I run the following command, I see this error [...]

  • [...] => Booting WEBrick… => Rails application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with –help for options [2009-08-19 12:42:01] INFO WEBrick 1.3.1 [2009-08-19 12:42:01] INFO ruby 1.8.5 (2006-08-25) [i386-linux] [2009-08-19 12:42:01] INFO WEBrick::HTTPServer#start: pid=2211 port=3000 这样redmine就会侦听本机IP的3000端口,输入URL:http://IP:3000就可以看到登陆界面, 默认的用户名和密码都是admin,进去之后就可以进行项目管理和操作了!如果redmine不能和SVN整合,那基本上是因为redmine服务器上还没有安装SVN客户端,安装上即可! 以上内容参照至这篇文章:http://www.how-to-linux.com/2009/02/how-to-install-redmine-on-centos-52-update/ [...]

You must be logged in to post a comment.