Install Apache Subversion(SVN) in RHEL 8

Install Apache Subversion(SVN) in RHEL 8

Check if your system is already updated with latest patches. If no, then update your system using the below command.

sudo yum -y update

Let's install SVN and its dependencies using this command

sudo dnf install subversion mod_dav_svn

Create Apache Subversion configuration file

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

And copy paste the below contents

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn
   AuthType Basic
   AuthName "Apache SVN Repositories"
   AuthUserFile /etc/svn/svn-auth
   Require valid-user
</Location>

Create directories for SVN

sudo mkdir /var/www/svn /etc/svn/
cd /var/www/svn

If SELINUX is installed, set it properly

sudo semanage fcontext -a -t  httpd_sys_content_t "/var/www/svn(/.*)?"
chcon -R -t httpd_sys_content_t  /var/www/svn/myrepo
chcon -R -t httpd_sys_rw_content_t /var/www/svn/myrepo

Create our first SVN repo

sudo svnadmin create myrepo
sudo chown -R apache.apache myrepo

Create SVN auth file for authentication

sudo touch /etc/svn/svn-auth

Add svnuser

sudo htpasswd -cm /etc/svn/svn-auth svnuser
New password: <Enter-password>
Re-type new password: <Confirm-password>
Adding password for user svnuser
sudo chmod 640 /etc/svn/svn-auth

After this modification, enable and restart httpd

sudo systemctl enable --now httpd
sudo systemctl restart httpd

If firewall is installed on your system, then execute the following commands

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload

Check in your browser with http URL yourip/svn/myrepo

You will need to authenticate using the above created user and credential.