Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Sunday 27 August 2017

How To Configure SVN (Subversion) Server on RHEL/Centos 6x

How To Configure SVN (Subversion) Server on RHEL/Centos 6x


Q. What is SVN (Subversion)?

-- Subversion is a free/open-source version control system. 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. In this regard, many people think of a version control system as a sort of "time machine".

Step: 1. Install Apache Server :

# yum -y install httpd httpd-devel mod_ssl

Step: 2. Configure Apache Server :

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

-- Uncomment :

NameVirtualHost *:80

-- Add the following Lines at the End :

DocumentRoot "/var/www/html"
RewriteEngine on
CheckCaseOnly On

-- Save & Quit (:wq)

Step: 3. Install SVN Packages :

# yum -y install mod_dav_svn subversion

Step: 4. Modify Subversion config file :

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

-- Add following config to /etc/httpd/conf.d/subversion.conf file.

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /repos>
  DAV svn
  SVNParentPath /var/www/svn/repos
  AuthType Basic
  AuthName "Welcome To KMInfosystems VersionControl"
  AuthUserFile /var/www/svn/secure/svn-users
  AuthzSVNAccessFile /var/www/svn/secure/svn-access-control
  Require valid-user
</Location>

-- Save & Quit (:wq)

Step: 5. Restart the httpd Service :

# service httpd restart
# chkconfig httpd on

Step: 6. Add SVN (Subversion) Users :

-- At First Create User Directory :

# mkdir -p /var/www/svn/secure/

-- For 1st User :

# htpasswd -cm /var/www/svn/secure/svn-users koushik

-- For 2nd User :

# htpasswd -m /var/www/svn/secure/svn-users user1
# htpasswd -m /var/www/svn/secure/svn-users user2
# htpasswd -m /var/www/svn/secure/svn-users user3

Step: 7. Create SVN Access Control List :

# cd /var/www/svn/secure/
# touch svn-access-control
# vi svn-access-control

[groups]
admin = koushik
testrepo = user2,user3
prodrepo = user1

[/]
@admin = rw

[testrepo:/]
@testrepo = rw

[prodrepo:/]
@prodrepo = rw

-- Save & Quit (:wq)

Step: 8. Create and configure SVN Repository :

# mkdir /var/www/svn/repos
# cd /var/www/svn/repos

# svnadmin create testrepo
# chmod -Rf 777 testrepo

# svnadmin create prodrepo
# chmod -Rf 777 prodrepo

Step: 9. Restart Apache Server :

# service httpd restart

Step: 10. Point Your Web Browser :

http://192.168.72.140/repos/testrepo/

User: koushik
Pass: redhat

Step: 11. Configure Repository (Optional) :

To disable anonymous access and enable access control add following rows to svnserve.conf file.

# vi /var/www/svn/repos/testrepo/conf/svnserve.conf

## Disable anonymous access ##
anon-access = none

## Enable access control ##
authz-db = authz

-- Save & Quit (:wq)

Step: 12. Create trunk, branches and tags structure under testrepo :

# mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}

Step: 13. Then import Template to Project Repository using “svn import” command :

# svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/repos/testrepo/

Password for 'root': (Just Press Enter)

Authentication realm: <http://localhost:80> Subversion repositories

Username: user1
Password for 'user1': redhat

Adding         /tmp/svn-structure-template/trunk
Adding         /tmp/svn-structure-template/branches
Adding         /tmp/svn-structure-template/tags

Store password unencrypted (yes/no)? yes

Committed revision 1.

Note: Check results on browser and see testrepo revision 1.

http://192.168.72.140/repos/testrepo

User: user2, user3
Pass: redhat

http://192.168.72.140/repos/prodrepo

User: user1 (only user1)
Pass: redhat

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog


Copyright © 2016 Kousik Chatterjee's Blog