Saturday, October 22, 2016

Step by Step Creating SVN Repository Centos 7.X

This blog, How to create SVN repository With Active Directory Authentication CentOS 7.X

What is Apache Subversion :-

Apache Subversion, which is commonly referred to in its abbreviated form as SVN, (named after the command name SVN) is a popular software versioning and revision control system which is distributed as a free software under the Apache License. Mainly used by developers to maintain present and historic file versions like documentation, source code, and web pages, it primarily aims to be a compatible successor to the extensively used CVS (Concurrent Versions System). As a matter of fact, the Subversion has been widely used by the free software community. This tutorial explains how to install and use SVN on CentOS 7.


Step:1 Creating SVN Repository

Use below mentioned command to create SVN repository
[root@svn ~]# svnadmin create /svndata/testrepo

Where 
svnadmin create =  Command 
/svndata               =   is Perent SVN data folder where we will create all the repository
/testrepo              =   is repository name

Step:2 Change Repository Ownership

Now we need to give permission to user Apache so he can write into SVN Repository.
Use below command to make Owner Apache User.
[root@svn ~]# chown -R apache:apache /svndata/testrepo/

Step:3 Create Repository Configuration File:

Now we need to create Repository config file in Apache so it can be accessed over the network.

Create testrepo.conf file to path /etc/httpd/conf.d/ using command below.
[root@svn ~]# vi /etc/httpd/conf.d/testrepo.conf
Now append below content into file.
<location /testrepo>
DAV svn
SVNPath /svndata/testrepo
 Order deny,allow
  Deny from all
  Allow from 10.0.0.0/24
  Allow from 10.0.1.0/24
   AuthType Basic
   AuthName "SVN Auth"
  AuthBasicProvider "ldap"
  AuthLDAPURL ldap://BMT-DC-01.ISHIR.LOCAL:3268/DC=ISHIR,DC=LOCAL?sAMAccountName?sub?(objectClass=user)
  AuthLDAPBindDN       svnauth@ISHIR.LOCAL
  AuthLDAPBindPassword *********
  authzldapauthoritative Off
 AuthzSVNAccessFile /etc/svn/testrepo
  require valid-user
</Location>

Note:- Please change the Repository name instead of testrepo if you are using different name.

Save and Exit from File.

Step:4 Create Access file.

We need to create auth file, Where we can assign user access for the specific repository using below command.
[root@svn ~]# vi /etc/svn/testrepo

Now add the user whom you want to give access on this repo.
[/]
asingh = rw
Save and exit from file.

Note:- Please add Active Directory Login user and keep file name that you have in Configuration file i.e. (AuthzSVNAccessFile /etc/svn/testrepo)

Step:5 Import Trunk, Tag and Branch :

Let's import trunk, tag and branches into testrepo using below command.

[root@svn ~]# svn import /home/amar/ file:///svndata/testrepo/ -m "initial messege"
Adding         /home/amar/tag
Adding         /home/amar/trunk
Adding         /home/amar/branches

Committed revision 1.
[root@svn ~]#
Note:- Please change repository name instead of testrepo


Step:6 Restart Apache and try to browse the URL.


[root@svn ~]# systemctl restart httpd

Now browse the URL:



That's ALL
!!!! Cheers !!!!

No comments:

Post a Comment