POKE ME for any consultancy

Thursday, February 25, 2016

How To install CollabNet SVN on Linux

Introduction to CollabNet SVN

CollabNet Subversion Edge includes everything you need to install, manage and operate a Subversion server. It includes all of the Subversion and Apache binaries needed to run a Subversion server. It also integrates the popular ViewVC repository browsing tool so that users can view repository history from a web browser.
CollabNet Subversion Edge also includes a powerful web-based management console that makes it easy to configure and manage your Apache server and Subversion repositories.  You can easily setup the server to use SSL
connections and even connect the server to a corporate LDAP repository, including Microsoft Active Directory.
CollabNet Subversion Edge only supports serving Subversion repositories via Apache httpd and it only supports the Subversion fsfs repository format.
More information about CollabNet SVN.
In this article, i’ll show you how to install CollabNet SVN on Linux.
Before we install CollabNet SVN, we need to install JAVA – JRE.

1. Install JAVA

[root@hosted-by src]# wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jre-8u45-linux-x64.rpm
Check StackOverflow thread if you want to know about above wget :)
[root@hosted-by src]# rpm -Uvh jre-8u45-linux-x64.rpm
The result is:
Preparing...                ########################################### [100%]
   1:jre1.8.0_45            ########################################### [100%]
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        localedata.jar...
        jfxrt.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
[root@hosted-by src]#

2. Install CollabNet SVN

Set the JAVA_HOME environment variable, and point it to JAVA JRE home. For example:
[root@hosted-by src]# export JAVA_HOME=/usr/java/jre1.8.0_45
Test the variable:
[root@hosted-by src]# $JAVA_HOME/bin/java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
[root@hosted-by src]#
[root@hosted-by src]# wget https://downloads-guests.open.collab.net/files/documents/61/11447/CollabNetSubversionEdge-5.0.1_linux-x86_64.tar.gz
IMPORTAINT: Do not untar CollabNet SVN using root or sudo. This will cause the UID/GID on the files to carry the values from our build system instead of being reset.
So we need to create a new user csvn:
[root@hosted-by ~]# groupadd csvn
[root@hosted-by ~]# useradd -c "CSVN Server" -d /usr/local/csvn -g csvn csvn
Check csvn directory, make sure user csvn have write permission:
drwx------  2 csvn csvn 4096 Jul 12 22:52 csvn
[root@hosted-by csvn]# su csvn
[csvn@hosted-by ~]$ tar xzf CollabNetSubversionEdge-5.0.1_linux-x86_64.tar.gz
This will create a directory named “csvn” in the current directory.
[csvn@hosted-by ~]$ mv csvn/* .
[csvn@hosted-by ~]$ ll
total 44
drwxr-xr-x  7 csvn csvn 4096 May 22 18:40 appserver
drwxr-xr-x  5 csvn csvn 4096 May 22 18:40 bin
drwxr-xr-x  7 csvn csvn 4096 May 22 18:40 data
drwxr-xr-x  2 csvn csvn 4096 May 22 18:40 dist
drwxr-xr-x 15 csvn csvn 4096 May 22 18:40 lib
drwxr-xr-x  2 csvn csvn 4096 May 22 18:40 licenses
drwxr-xr-x  7 csvn csvn 4096 May 22 18:39 pkg
-rwxr-xr-x  1 csvn csvn 9274 May 22 18:40 README
drwxr-xr-x  5 csvn csvn 4096 May 22 18:40 www
[csvn@hosted-by ~]$
Run the command below to install:
[csvn@hosted-by ~]$ sudo -E bin/csvn install
To configure CSVN, we need to open file data/conf/csvn.conf  and change something like this:
#JAVA_HOME=
change it to:
JAVA_HOME=/usr/java/jre1.8.0_45
WAIT_FOR_WEBSERVER_URL="http://localhost:3343/csvn"
change it to:
WAIT_FOR_WEBSERVER_URL="http://Your_Public_IP:3343/csvn"
Start the server, make sure you logged in csvn, not running as root.
[csvn@hosted-by ~]$ bin/csvn start
This will take a few minutes and the script will loop until it sees that server is running. If the server is not start, then try start the server with this command:
[csvn@hosted-by ~]$ bin/csvn console
It will start the server but initial startup messages to the console.
The output is:
[csvn@hosted-by ~]$ bin/csvn start
Starting CSVN Console...
...
CSVN Console started
Waiting for application to initialize (this may take a minute)..........................
CSVN Console is ready at http://Your_Public_IP:3343/csvn
[csvn@hosted-by ~]$
Configure the Apache Subversion server to start automatically when the system boots:
[csvn@hosted-by ~]$ sudo bin/csvn-httpd install
[sudo] password for csvn:
Detected RHEL or Fedora:
 Installing the Subversion Edge Apache Server daemon..
[csvn@hosted-by ~]$
Start Apache Subversion server:
[csvn@hosted-by ~]$ sudo bin/csvn-httpd start
[sudo] password for csvn:
Starting Subversion Edge Apache Server:                      OK
[csvn@hosted-by ~]$
Login CSVN management
URL: http://Your_Public_IP:3343/csvn/
User: admin
Password: admin
This is the default administrator, please change it
Subversion Edge also starts an SSL-protected version using a self-signed SSL certificate. You can access the SSL version on this URL:
Address: https://Your_Public_IP:4434/csvn
You can force users to use SSL from the Server configuration. This will cause attempts to access the site via plain HTTP on port 3343 to be redirected to the secure port on 4434.