Thursday, April 9, 2015

Subversion 1.8 Installation in Centos-6.X Step By Step






How to install Basic SVN and Mod SVN (1.8) in Centsos-6.X with Viewvc integration

Steps to Create Basic SVN (1.8) :


Step 1 :

To install SVN 1.8 Firstly we need to configure yum repository in our system. Create a new repo file /etc/yum.repos.d/wandisco-svn.repo and add following content as per your operating system version.

# vi /etc/yum.repos.d/wandisco-svn.repo

  [WandiscoSVN]
  name=Wandisco SVN Repo
  baseurl=http://opensource.wandisco.com/centos/6/svn-1.8/RPMS/$basearch/
  enabled=1
  gpgcheck=0


 :wq!

# yum clean all
# yum install subversion subversion-python

# svn --version


Step 2 :  Creating the Repo

# mkdir /svn
# svnadmin create /svn/testrepo


Step 3 : Create user (svn) and Giving ownership for the created Repo

# useradd svn -s /sbin/nologin
# chown -R svn /svn/testrepo/


Step 4 : Deleting/Renaming the default passwd file from Conf folder

# cd /svn/testrepo/conf
# mv  passwd passwd.old 

(from newly create repo , inside conf directory)


Step 5 : Now Create a soft link to the passwd file which present in location at /svn/testrepo/conf  with a command -

# vi /svn/passwd  (just create a blank file)
# ln -s /svn/passwd /svn/testrepo/conf/passwd


Step 6 : Edit the svnserve.conf and change like this

# vi  /svn/testrepo/conf/svnserve.conf

Anon_access=none
Auth_access=write
Password-db=passwd

:wq!


Step 7 : Now start the svnserve demon


# /usr/bin/svnserve -d -r /svn

Put this code in rc.local so that the svnserve demon will run after the system restart also.


Step 8 : Now create the initial directories

# svn mkdir file:///svn/testrepo/{trunk,tags,branches} -m "initial directories"


Step 9 : Create a username and password to checkout SVN repo

# vi /svn/passwd

 vipin = yourpassword

:wq!


Step 10 : Your Basic SVN server is ready, Now just checkout and see

# svn co svn://192.168.1.X/testrepo/ /mnt/






Steps to Create MOD SVN (1.8) :

Note : In this example I am setting up the mod svn in the same server itself. 
So please follow the above 9 steps.


The benefit of Mod_svn is you can access all repo data over browser with the login credentials provided by the administrator, it is easier to browse, without any client svn package, Mod SVN subversion is moderated and managed by apache , so password file and ownership by default goes to apache user or you have to change ownership for the repo to apache before to us.

Step 1: Install the Packages.

# yum install  –y mod_dav_svn httpd


Step 2: Now Edit /etc/httpd/conf.d/subversion.conf file like this.

# Make sure you uncomment the following if they are commented out
LoadModuledav_svn_module     modules/mod_dav_svn.so
LoadModuleauthz_svn_module   modules/mod_authz_svn.so

# Add the following to allow a basic authentication and point Apache to where the actual repository resides


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


<Location /testrepo>
  DAV svn
  SVNPath /svn/testrepo
  AuthType Basic
  AuthName "SVN Repo"
  AuthUserFile /svn/mod-auth/svn.passwd
  Require valid-user
</Location>

:wq!


Step 3 : change ownership from root to apache

# chown -R apache.apache /svn/testrepo/


Step 4 : Create htpassword file from command

# mkdir /svn/mod-auth
# htpasswd -cm /svn/mod-auth/svn.passwd vipin

    Now enter the password

Note : If you want to add multiple user, please run the code like this :
# htpasswd -cm /svn/mod-auth/svn.passwd user1
# htpasswd -m /svn/mod-auth/svn.passwd user2


Step 5 : Restart the apache service.

# service httpd restart
# chkconfig httpd on


Your Mod SVN is ready. Now open the browser and type :

http://192.168.1.X/testrepo






Steps to Install & Configure ViewVC (1.1.10) :



Step 1: Download ViewVC stable release 1.1.10
You can download using wget command on CentOS server as below.

# cd /tmp
# wget http://viewvc.tigris.org/files/documents/3330/48879/viewvc-1.1.10.tar.gz

Step 2 : Extract and unzip the viewvc-1.1.10.tar.gz using below command.

# tar xvfz viewvc-1.1.10.tar.gz

Step 3 : Go to viewvc-1.1.10 directory and start the installation

# cd viewvc-1.1.10
# ./viewvc-install


Step 4 : Now Edit viewvc.conf file

# vi /usr/local/viewvc-1.1.10/viewvc.conf

(Uncomment line 151 and define the subversion root repositories )

root_parents = /svn : svn,


:wq!

Note : Here /svn is your repo path.

 
Step 5 : Edit the apache web server config file as below


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

Add the below two lines under ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" Stanza

ScriptAlias /viewvc /usr/local/viewvc-1.1.10/bin/cgi/viewvc.cgi
ScriptAlias /query /usr/local/viewvc-1.1.10/bin/cgi/query.cgi

:wq!



Step 6 : Restart all the services

# service httpd restart
# chkconfig httpd on
# setenforce 0
# service iptables stop 



Now open the browser and type :   http://192.168.1.X/viewvc





***** Thanks *****





No comments:

Post a Comment