Installation Of Redmine With SVN On A cPanel/CentOS 5.6 Server

Want to support HowtoForge? Become a subscriber!
 
Submitted by agno01 (Contact Author) (Forums) on Mon, 2012-09-24 15:47. :: CentOS

Installation Of Redmine With SVN On A cPanel/CentOS 5.6 Server

This tutorial explains how to install Redmine with SVN on a cPanel/CentOS 5.6 server. Redmine is a flexible project management web application. Written using the Ruby on Rails framework, it is cross-platform and cross-database.

All steps are executed as ‘root’.

Prior to installation check if ImageMagick is installed:

# /scripts/checkimagemagick

ok

If it is not then install it:

# /scripts/installimagemagick

It will take few minutes so prepare a coffee. ;)

After ImageMagick is installed let's start with mod_dav.

Check if mod_dav is enabled:

# httpd -M | grep dav

dav_module (static)
dav_fs_module (static)

If nothing displayed then recompile Apache using:

# /scripts/easyapache

  • Simple CLI will be loaded:
  • Move with 'Tab' between buttons.
  • Load default - "Previously Saved Config"
  • Start customizing based on profile.
  • Choose latest Apache version (e.g.: 2.2.22).
  • Choose latest stable PHP version (e.g.: 5.3.15).
  • Move with 'Tab' key to "Exhaustive Options List".
  • Under "Apache Built-in Module" mark Dav and DAVFs
  • Move down with down arrow to "Preferences".
  • Mark "Archive Backup (this session only)" - obviously to create a backup of working Apache :)
  • "Next step" > "Save and build" > confirm everything if asked... AND the build is running.

Now you can have 20-30 minutes break - drink previously prepared coffee :D

After it is successfully finished check again if dav is enabled now:

# httpd -M | grep dav

dav_module (static)
dav_fs_module (static)

Next we need to install/enable subversion.

# cd /usr/local/src/

Check latest package of rpmforge repo rpm on http://pkgs.repoforge.org/rpmforge-release/ according to architecture of your system (uname -p) and download and install it:

# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
# rpm -K rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
# rpm -i rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

Install latest subversion from rpmforge:

# yum --enablerepo=rpmforge install subversion

Get sources of the same subversion release you just installed (e.g. 1.6.11):

# svn --version

svn, version 1.6.11 (r934486)
compiled May 14 2012, 05:36:18

# yum list subversion

Installed Packages
subversion.i386 1.6.11-10.el5_8 installed
subversion.x86_64 1.6.11-10.el5_8 installed

# wget http://subversion.tigris.org/downloads/subversion-1.6.11.tar.bz2

Check latest SQLite Amalgamation package on http://www.sqlite.org/download.html and download it (e.g.: 3.7.13):

# wget http://www.sqlite.org/sqlite-amalgamation-3071300.zip

Unpack everything and prepare for configuration:

# tar xjf subversion-1.6.11.tar.bz2
# unzip sqlite-amalgamation-3071300.zip
# mkdir -p subversion-1.6.11/sqlite-amalgamation/
# cp sqlite-amalgamation-3071300/sqlite3.c subversion-1.6.11/sqlite-amalgamation/sqlite3.c
# ls -lad /usr/local/apache/bin/apxs /home/cpeasyapache/src/httpd*/srclib/apr /home/cpeasyapache/src/httpd*/srclib/apr-util

drwxr-xr-x 26 root root 4096 Aug 11 05:36 /home/cpeasyapache/src/httpd-2.2.22/srclib/apr/
drwxr-xr-x 20 root root 4096 Aug 11 05:37 /home/cpeasyapache/src/httpd-2.2.22/srclib/apr-util/
-rwxr-xr-x 1 root root 22652 Aug 11 05:36 /usr/local/apache/bin/apxs*

^^^^^^^^^^^^^^
Notice the paths - will be needed for next step.

Configure, build and install subversion:

# cd subversion-1.6.11
# ./configure --with-apxs=/usr/local/apache/bin/apxs --with-apr=/home/cpeasyapache/src/httpd-2.2.22/srclib/apr --with-apr-util=/home/cpeasyapache/src/httpd-2.2.22/srclib/apr-util
# make clean
# make && make install

Again - take a short break...

After successful installation of subversion let's configure it.

Create include folder for EA3 config file:

# mkdir -p /usr/local/apache/conf/userdata/std/2/[USERNAME]/[DOMAIN]
# vi /usr/local/apache/conf/userdata/std/2/[USERNAME]/[DOMAIN]/svn.conf

Add following lines:

<IfModule mod_dav_svn.c>
   <Location /svn>
     DAV svn
     SVNPath /home/[USERNAME]/svn
     AuthType Basic
     AuthName "Subversion"
     AuthUserFile /home/[USERNAME]/.svn.htpasswd
     Require valid-user
   </Location>
</IfModule>

Find the location of modules:

# updatedb
# locate mod_dav_svn.so mod_authz_svn.so

/usr/local/apache/modules/mod_authz_svn.so
/usr/local/apache/modules/mod_dav_svn.so
^^^^^^^^^^^^^^

Notice the paths - will be needed for next step.

# vi /etc/httpd/conf/includes/pre_main_global.conf

Add following lines:

   LoadModule dav_svn_module /usr/local/apache/modules/mod_dav_svn.so
   LoadModule authz_svn_module /usr/local/apache/modules/mod_authz_svn.so

Create svn repository:

# cd /home/[USERNAME]
# svnadmin create svn
# chown -R [USERNAME]:nobody svn

Check if htpasswd is present:

# locate htpasswd

.
.
/usr/local/apache/bin/htpasswd
.
.

# /usr/local/apache/bin/htpasswd -cm /home/[USERNAME]/.svn.htpasswd [USERNAME_FOR_SVN]

You will be prompted to set up a new password.

Finally do:

# ln -s /home/[USERNAME]/svn /svn

Set up of subversion is done, now let's make it permanent and make some adjustments...

Create startup script:

# vi /etc/init.d/subversion

Insert following lines:

#!/bin/bash
   #
   #   /etc/rc.d/init.d/subversion
   #
   # Starts the Subversion Daemon
   #
   # chkconfig: 345 90 10
   # description: Subversion Daemon 
   # processname: svnserve

source /etc/rc.d/init.d/functions

[ -x /usr/bin/svnserve ] || exit 1

# To pass additional options (for instace, -r root of directory to server) to
   # the svnserve binary at startup, set OPTIONS here.
   #
   OPTIONS="-r /svn"
 

RETVAL=0
   prog="svnserve"
   desc="Subversion Daemon"

start() {
   echo -n $"Starting $desc ($prog): "
   daemon $prog -d $OPTIONS
   RETVAL=$?
   [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
   echo
   }

stop() {
   echo -n $"Shutting down $desc ($prog): "
   killproc $prog
   RETVAL=$?
   [ $RETVAL -eq 0 ] && success || failure
   echo
   [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
   return $RETVAL
   }

case "$1" in
   start)
   start
   ;;
   stop)
   stop
   ;;
   restart)
   stop
   start
   RETVAL=$?
   ;;
   condrestart)
   [ -e /var/lock/subsys/$prog ] && restart
   RETVAL=$?
   ;;
   *)
   echo $"Usage: $0 {start|stop|restart|condrestart}"
   RETVAL=1
   esac

exit $RETVAL

Now check if the startup script is working:

# service subversion status

Usage: /etc/init.d/subversion {start|stop|restart|condrestart}

Great! :)
Enable it to start at server boot:

# chkconfig subversion on
# chkconfig --list subversion

subversion 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Now check if all is configured correctly and apply changes:

# /scripts/verify_vhost_includes

Testing /usr/local/apache/conf/userdata/std/2/[USERNAME]/[DOMAIN]/svn.conf...ok
^^^^^^^^^^^^^^

Do NOT continue if there are errors! Examine and double check where is the mistake!

# /scripts/ensure_vhost_includes --user=[USERNAME]

info [safeapacherestart] Forced restart elapsed seconds: 2
Apache successfully restarted.

# /scripts/rebuildhttpdconf

Built /usr/local/apache/conf/httpd.conf OK

# /scripts/restartsrv_httpd

# service subversion restart

Final check:

Go to www.yoursite.com/svn

If all is working well you should be prompted for username/password.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.