How To Install Subversion On CentOS 7.X


This is how to blog, Install & Configure Apache Subversion (SVN) on CentOS 7.


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 Install SVN & Apache Packages :

SVN & Apache (HTTPD) package are available in the default CentOS 7 repository. Use below yum command to install required packages :
[root@SVN ~]# yum install httpd subversion mod_dav_svn mod_ldap

Step:2 Edit the configuration file of Apache Subversion

[root@svn ~]# vi /etc/httpd/conf.modules.d/10-subversion.conf
Make sure below mentioned line are uncomment in the config file (/etc/httpd/conf.modules.d/10-subversion.conf).

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


Step:3 Start & enable the apache (httpd) service:

[root@svn ~]# systemctl start httpd
[root@svn ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

Step:4 Allow httpd port in firewall:

 Add port 80 using below command
[root@svn ~]# firewall-cmd --zone=public --permanent --add-port=80/tcp
success

Reload firewall config using below command
[root@svn ~]# firewall-cmd --reload
success

Check allowed port using below command
[root@svn ~]# firewall-cmd --zone=public --permanent --list-port
80/tcp

Step:5 Create & Configure SVN Repository :

First Create a Directory where you want to create all the repositories.
[root@svn ~]# mkdir /svndata
Now create SVN repository using below command.
[root@svn ~]# svnadmin create /svndata/testrepo
Now Change the permission and make owner to Apache using below command
[root@svn ~]# chown -R apache:apache /svndata/testrepo/

Step:6 Create repository configuration file:

 Now, We need to create a config file for the testrepo so that we can access it through Apache.

Create testrepo.conf file to path /etc/httpd/conf.d/
[root@svn ~]# vi /etc/httpd/conf.d/testrepo.conf
Now append below mentioned line into file.

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


Save and exit from file.

Step:7 Create User 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.

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


[root@svn ~]# systemctl restart httpd
Now browse the URL:


Step:9 Import Trunk, Tag and Branch :

First, create a directory where we will create trunk, tag and branches so that in future we can simply import from here.
[root@svn ~]# mkdir /home/amar
[root@svn ~]# cd /home/amar/
[root@svn amar]# mkdir trunk branches tag


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 ~]#


Step:10 Restart Apache and check URL:


[root@svn ~]# systemctl restart httpd

Now browse the URL



That's All 



!!!!! Cheers !!!!!!