April 17, 2014

Installing Redmine & Subversion on CentOS 5.5

In this CentOS 5.5 tutorial we will be installing Redmine and Subversion with LDAP authentication on a CentOS 5.5 i386 server. The assumption is that you have a basic to medium understanding of Apache and MySQL but if you follow this tutorial you should be able to complete the task successfully. A bit on the software that we’ll be using:

Redmine
Redmine is a flexible project management web application. Written using Ruby on Rails framework, it is cross-platform and cross-database. An online demo can be found here:
http://demo.redmine.org/

Subversion
Subversion is a free/open-source version control system. That is, Subversion manages files and directories, and the changes made to them, over time. This allows you to recover older versions of your data, or examine the history of how your data changed.
http://subversion.apache.org/

Preliminary Note:
I am using a CentOS 5.5 i386 base installation in this tutorial.

* svn.how2centos.com (IP 10.0.0.100): CentOS 5.5 i386 base installation
* ldap.how2centos.com (IP 10.0.0.100): CentOS 5.5 i386 base installation
* redmine.how2centos.com (IP 10.0.0.100): CentOS 5.5 i386 base installation

Lets begin by installing the framework required by the Redmine, Subversion and LDAP platform.

# yum install yum-priorities
# rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# yum update
# yum install mysql mysql-server
# yum install httpd
# yum install gcc-c++
# yum install ImageMagick ImageMagick-devel
# yum install subversion mod_dav_svn
# yum install perl-HTML-Parser perl-SVN-Notify
# yum install ruby rubygems rubygem-rails rubygem-sqlite3-ruby ruby-devel ruby-mysql

Next a couple of Ruby Gems

# gem install rack -v 1.0.1
# gem install cgi_multipart_eof_fix
# gem install coderay
# gem install thin

Now lets add the software to startup and start MySQL and Apache.

# thin install
# chkconfig thin on
# chkconfig mysqld on
# chkconfig httpd on
# service mysqld start
# service httpd start

Configure Thin

# thin config -C /etc/thin/(config-name).yml -c (rails-app-root-path) --servers (number-of-threads) -e (environment)

(application-name) = redmine
(rails-app-root-path) = /opt/redmine
(number-of-threads) = 3
(environment) = production

# thin config -C /etc/thin/redmine.yml -c /opt/redmine --servers 3 -e production

Download, install and configure the Redmine framework.

# cd /opt/
# http://rubyforge.org/frs/download.php/73457/redmine-1.0.4.tar.gz
# tar zxvf redmine-1.0.4.tar.gz
# mv redmine-1.0.4 redmine
# chmod -R a+rx /opt/redmine/public/
# cd /opt/redmine
# chmod -R 755 files log tmp

# cd /opt/redmine/config/
# cp database.yml.example database.yml
# vi /opt/redmine/config/database.yml

1
2
3
4
5
6
7
production:
  adapter: mysql
  database: redmine
  host: redmine
  username: redmine
  password: redmine
  encoding: utf8

# mysql

mysql> create database redmine default character set utf8;
mysql> grant all on redmine.* to redmine@localhost identified by ‘redmine’;
mysql> flush privileges;
mysql> quit

# cd /opt/redmine
# RAILS_ENV=production rake config/initializers/session_store.rb
# RAILS_ENV=production rake db:migrate

Configure Apache and add a Redmine config file

# vi /etc/httpd/conf/httpd.conf

Uncomment
NameVirtualHost *:80

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

1
2
3
4
5
6
7
8
9
10
11
12
13
<VirtualHost *:80>
        DocumentRoot /opt/redmine
        ServerName redmine.how2centos.com
        <Proxy balancer://redminecluster>
                 BalancerMember http://127.0.0.1:3000
                 BalancerMember http://127.0.0.1:3001
                 BalancerMember http://127.0.0.1:3002
        </Proxy>
        ProxyPass / balancer://redminecluster/
        ProxyPassReverse / balancer://redminecluster/
        ErrorLog /var/log/httpd/redmine_error.log
        CustomLog /var/log/httpd/redmine_access.log combined
</VirtualHost>

Setup Redmine to email

# cp /opt/redmine/config/email.yml.example /opt/redmine/config/email.yml
# vi /opt/redmine/config/email.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
production:
  delivery_method: :smtp
  smtp_settings:
    address: smtp.how2centos.com
    port: 25
    domain: how2centos.com
#    authentication: :login
#    user_name: "redmine@example.net"
#    password: "redmine"
 
development:
  delivery_method: :smtp
  smtp_settings:
    address: 127.0.0.1
    port: 25
    domain: how2centos.com
#    authentication: :login
#    user_name: "redmine@example.net"
#    password: "redmine"

Start thin and Redmine

# service thin start

Create a Subversion repository and start the SVN deamon

# svnadmin create /opt/svn/repo
# svnserve -d

Add a Subversion Apache configuration file

# vi /etc/httpd/conf.d/svn.conf

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so
 
LDAPSharedCacheFile /root/LDAPSharedCacheFile
LDAPSharedCacheSize 200000
LDAPCacheEntries 1024
LDAPCacheTTL 600
LDAPOpCacheEntries 1024
LDAPOpCacheTTL 600
 
<VirtualHost *:80>
 
        DocumentRoot /opt/svn
        ServerName svn.how2centos.com
 
        ErrorLog /var/log/httpd/svn_error.log
        LogLevel warn
        CustomLog /var/log/httpd/svn_access.log combined
        ServerSignature On
 
        <Location "/">
                AuthBasicProvider ldap
                AuthType Basic
                AuthzLDAPAuthoritative off
                AuthName "How2CentOS SVN server"
                AuthLDAPURL "ldap://ldap.how2centos.com/CN=Users,DC=how2centos,DC=com?sAMAccountName"
                AuthLDAPBindDN "CN=ldap,CN=Users,DC=how2centos,DC=com"
                AuthLDAPBindPassword LDAPpassword
 
                require valid-user
 
        </Location>
 
        <Location "/svn">
                DAV svn
                SVNParentPath           /opt/svn
                SVNListParentPath       On
                SVNReposName            "How2CentOS SVN Repo"
        </Location>
 
        <Location /cache-info>
                SetHandler ldap-status
        </Location>
 
</VirtualHost>

# chown -R apache:apache /opt/svn/*
# chmod -R 770 /opt/svn/*

Restart Apache for changes to take effect

# Service httpd restart

Browse to newly setup Redmine and Subversion setup

http://redmine.how2centos.com

http://svn.how2centos.com

  • Didi

    Just as a little note, I is quite dangerous to install epel and rpmfoge without the priorities plugin. As these might get into the way of each other and render your system useless.

    Have you thought about adding this to the centos-wiki? Just drop a mail to the ML.

    Cheers Didi

  • How2CentOS

    Thanks for the heads up Didi!

    For those of you that don't know about the priorities plug-in install it like so:
    # yum install yum-priorities

  • Judd

    thin config -C /etc/thin/redmine.yml -c /opt/redmine –servers 3 -e production

    is wrong. ‘-servers’ switch is really ‘-s’

    rmagick is never built or installed in these instructions.

  • Judd
  • Anonymous

    Using the ‘–servers’ switch is not wrong

    # thin –help

    *snip*
    Cluster options:
    -s, –servers NUM Number of servers to start
    *snip*

    RMagick (to enable Gantt export to png image) wasn’t installed in this How To because it’s an optional extra.

  • shams

    Hi,
    I’ve follow your guide

    [Wed Sep 08 23:52:25 2010] [error] (EAI 2)Name or service not known: Could not resolve host name *:80=”" — ignoring!
    Syntax error on line 21 of /etc/httpd/conf.d/svn.conf:
    directive requires additional arguments

  • shams

    Hi,
    I manage to follow the guide until Restart Apache for changes to take effect
    # Service httpd restart

    end up with the below error

    Starting httpd: [Wed Sep 08 23:52:25 2010] [warn] module dav_svn_module is already loaded, skipping
    [Wed Sep 08 23:52:25 2010] [warn] module authz_svn_module is already loaded, skipping
    [Wed Sep 08 23:52:25 2010] [error] (EAI 2)Name or service not known: Could not resolve host name *:80=”" — ignoring!
    Syntax error on line 21 of /etc/httpd/conf.d/svn.conf:
    directive requires additional arguments

    could anyone help me on this. Thank you.

  • Anonymous

    Apologies there was a typo in the configuration. I have updated the config, please try again.

  • lauro

    Hello,

    on /opt/redmine/config/database.yml

    1 production:
    2 adapter: mysql
    3 database: redmine
    4 host: redmine
    5 username: redmine
    6 password: redmine
    7 encoding: utf8

    Is it correct to use host=redmine ? It should not be localhost or the hostname ?

  • Luke Strickland

    localhost or where ever your databases are.

  • Madhoo

    It was of great help but faced issues when tried with latest Redmine version. Please modify it based on the latest version of Redmine. Will try to consolidate the changes i had to do and post.

  • GrannySmith9929

    Many thanks guys for an excellent post.

    Hi Madhoo! I’m having some probs also trying to install the latest Redmine version (1.1.2) which the documentation says needs ruby 1.8.6, 1.8.7 | Rails 2.3.11 | Rack 1.1.0.

    I had to revert to Rack 1.0.1 and Gems 1.4.2 in order for the “RAILS_ENV=production rake db:migrate” command to work – but not sure if that messed up other things as a result, because when I browse to redmine.mydomain.com, there’s no index so I just get a “403 error – forbidden to access /” page.

    Did you get any joy getting latest Redmine to install?

  • GrannySmith9929

    Small comment for above:

    “Service httpd restart” –> should be “service httpd restart”

    I had to manually create the folders before this command would work: “svnadmin create /opt/svn/repo”