Learn how to – Install Apache Subversion (SVN) on CentOS 8 / RHEL 8.
The Apache Subversion (SVN) is a free and open source version control system used to manage and track changes in files and directories. The versioning feature enables you restore to an old state of files as well as examine the changes over a period of time. The alternative to Apache Subversion is Git.
This guide will walk you through the installation of SVN Server on CentOS 8 / RHEL 8. As Apache Subversion doesn’t come with an authentication system, we’ll use Apache htpasswd command to add SVN users.
Install Apache Subversion on CentOS 8 / RHEL 8 Linux
There are no major pre-requisites for SVN installation on CentOS 8 / RHEL 8. We’ll just ensure our system is updated, then proceed to install and configure Apache Subversion (SVN) on CentOS 8 / RHEL 8 Linux.
Step 1: Update System
Update and upgrade system packages.
sudo yum -y update
Reboot is necessary after an upgrade.
sudo reboot
Step 2: Install Apache Subversion on CentOS 8 / RHEL 8 Linux
Run the following commands to install SVN on CentOS 8 / RHEL 8 Linux machine.
sudo dnf install subversion mod_dav_svn
Press the y key to start installation.
Step 3: Create Apache Subversion configuration file
Create a configuration file on httpd configurations folder for SVN.
sudo vi /etc/httpd/conf.d/subversion.conf
Paste below into the file.
<Location /svn>
DAV svn
SVNParentPath /var/www/svn
AuthType Basic
AuthName "Apache SVN Repositories"
AuthUserFile /etc/svn/svn-auth
Require valid-user
</Location>
Create SVN directories.
sudo mkdir /var/www/svn /etc/svn/
Step 4: Create repository & Add SVN users
Create your first SVN repository.
cd /var/www/svn
sudo svnadmin create myrepo
Set permissions
sudo chown -R apache.apache myrepo
Also set proper SELinux security context.
sudo semanage fcontext -a -t httpd_sys_content_t "/var/www/svn(/.*)?"
Create SVN HTTP access authentication file.
sudo touch /etc/svn/svn-auth
Add first SVN user.
$ sudo htpasswd -cm /etc/svn/svn-auth learnhowto
New password: <Enter-password>
Re-type new password: <Confirm-password>
Adding password for user learnhowto
Give proper permissions to password file.
sudo chown root:apache /etc/svn/svn-auth
sudo chmod 640 /etc/svn/svn-auth
To add additional users, use the command syntax.
sudo htpasswd -m /etc/svn/svn-auth user2
sudo htpasswd -m /etc/svn/svn-auth user3
sudo htpasswd -m /etc/svn/svn-auth user4
Step 5: Access SVN Web portal
Start and enable httpd service.
sudo systemctl enable --now httpd
sudo systemctl restart httpd
Open http port on the firewall.
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload
Open your web browser and type http://server_ip_or_hostname/svn/myrepo
Login with credentials provided earlier during configurations. For more reading, check official Apache Subversion documentation.
Related guides:
- Install Apache SVN on Ubuntu / Debian
- Install Gitea on CentOS 7/8 Linux
- Install GitLab CentOS / RHEL 8
Leave a Reply
You must be logged in to post a comment.