How To Install Apache SVN on CentOS 7

Install Apache SVN on CentOS 7

In this tutorial, we will show you how to install and configure Apache SVN on CentOS 7 server. For those of you who didn’t know, 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 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).

SVN supports several protocols for network access: SVN, SVN+SSH, HTTP, HTTPS. If you are behind a firewall, HTTP-based Subversion is advantageous since SVN traffic will go through the firewall without any additional firewall ruleset. This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS.

Install Apache SVN on CentOS 7

Step 1. First, you need to install subversion and mod_dav_svn (this stands for the Apache HTTPd module for subversion server) using the following command:

yum install httpd subversion mod_dav_svn

Step 2. Configure Subversion with Apache.

Once installing the package, you must open the subversion httpd config file.

nano /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn
   AuthType Basic
   AuthName "Subversion User Authentication "
   AuthUserFile /etc/svn-users
   Require valid-user
</Location>

Step 3. Create SVN users.

The following commands will add two users for svn. It will prompt users’ passwords to be assigned.

htpasswd -cm /etc/svn-users idroot
htpasswd -m /etc/svn-users idroid

Step 4. Create and configure SVN repository

cd /var/www/svn
svnadmin create testrepo
chown -R apache.apache testrepo

If you still have issues with SELinux Security please apply this:

chcon -R -t httpd_sys_content_t /var/www/svn/testrepo
chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo

Step 5. Restart your web server.

systemctl restart httpd.service

Step 6. Finally, You can visit the URL http://your-ip-address/svn/testrepo to check out the content, you will be asked to enter the user name and password.

Step 7. Create a basic repository structure with the below commands.

mkdir -p /tmp/svn/{trunk,branches,tags}
svn import -m 'Initializing basic repository structure' /tmp/svn/ http://localhost/svn/testrepo/

Congratulations! You have successfully installed Apache Subversion. Thanks for using this tutorial for installing Apache Subversion on CentOS 7 system. For additional help or useful information, we recommend you check the official Apache website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “Rar/Unrar” installation, starting from $10 (Paypal payment). Please contact us to get the best deal!