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
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
<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
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
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