Tutorials  /  Linux Basics

Install and Configure an SVN Server with Apache on CentOS 7

Ccentron Redaktion · May 2025 ·5 min read ·Linux Basics, Tutorial

Apache Subversion (SVN) is a popular version control system that allows storage of various file versions, such as source code and documentation.

This guide demonstrates how to utilize Apache Subversion and Apache to configure an SVN server on a CentOS 7 server instance.

Prerequisites

  • A virtual machine running CentOS 7 (a minimal installation is recommended but not mandatory).
  • A sudo user for system access.
VM

Matching infrastructure at centron

No hardware needed to follow along: ccloud³ VMs with full root access start at €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →

Step 1: System Update

Execute the following commands to update the system:

Console
sudo yum update
sudo shutdown -r now

After the reboot process completes, log in again using the same sudo user credentials.

Step 2: Apache Installation

Install Apache through YUM with the command below:

Console
sudo yum install httpd

Next, remove Apache's default welcome page using:

Console
sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf

Disable Apache's file listing in the /var/www/html directory with the following command:

Console
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf

Step 3: Install SVN and the mod_dav_svn Module

To integrate SVN with Apache, it is necessary to install the additional Apache module named "mod_dav_svn" along with SVN itself:

Console
sudo yum install subversion mod_dav_svn

Step 4: SVN Configuration

1) Edit the SVN Configuration File

Open the SVN configuration file with the following command:

Console
sudo vi /etc/httpd/conf.modules.d/10-subversion.conf

The content of the file should look like this:

Code
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

Next, append the following section:

Code
<Location /svn>
  DAV svn
  SVNParentPath /svn
  AuthName "SVN Repos"
  AuthType Basic
  AuthUserFile /etc/svn/svn-auth
  AuthzSVNAccessFile /svn/authz
  Require valid-user
</Location>

Save the file and exit the editor:

Code
:wq!

Note: This configuration defines an HTTP authentication file at /etc/svn/svn-auth and a permission control file at /svn/authz. These files will be created in later steps.

2) Create an SVN Repository

Create a directory for SVN repositories and set up the first repository using the commands below:

Console
sudo mkdir /svn
cd /svn
sudo svnadmin create repo1
sudo chown -R apache:apache repo1

3) Create SVN User Accounts

Execute the commands below to set up the HTTP authentication file at /svn/svn-auth and create an SVN user named user001:

Console
sudo mkdir /etc/svn
sudo htpasswd -cm /etc/svn/svn-auth user001
sudo chown root:apache /etc/svn/svn-auth
sudo chmod 640 /etc/svn/svn-auth

To add additional SVN users, use these commands:

Console
sudo htpasswd -m /etc/svn/svn-auth user002
sudo htpasswd -m /etc/svn/svn-auth user003

Warning: Do not include the -c flag again when adding new users. Using -c will recreate the authentication file and delete all previously created accounts.

4) Assign Permissions to SVN Users

Copy the existing authorization file and open it for editing:

Console
sudo cp /svn/repo1/conf/authz /svn/authz
sudo vi /svn/authz

Assuming the following:

  • user001 is the administrator.
  • user002 is a regular user with read and write permissions for the repository repo1.
  • user003 is a trainee allowed only to read the contents of repo1.

Adjust the permission settings like this:

Code
[groups]
admin=user001
repo1_user=user002
repo1_trainee=user003

[/]
@admin=rw

[repo1:/]
@repo1_user=rw
@repo1_trainee=r

Save and exit the editor:

Code
:wq!

Step 5: Launch Apache and Adjust Firewall Settings

Initiate the Apache service using the following commands:

Console
sudo systemctl start httpd.service
sudo systemctl enable httpd.service

Allow traffic for the HTTP service through the firewall with these commands:

Console
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload

Finally, you can connect to the SVN repository repo1 from an SVN client by navigating to the following URL:

http://<your-server-ip>/svn/repo1/

Conclusion

By following the steps outlined in this guide, you have successfully set up an SVN server using Apache Subversion and Apache on a CentOS 7 instance. You learned how to install necessary packages, configure the SVN service, create user accounts with appropriate permissions, and enable HTTP access through the firewall. Your SVN repository is now ready for version control operations, and users can easily connect to it through their SVN clients. This setup provides a reliable and efficient environment for managing project files and collaborating with team members.

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Linux Basics
Teilen
Noch offene Fragen?

Our team will help you with your specific setup - in German or English, by people who run the platform themselves.

War dieses Tutorial hilfreich?

Your answer is stored anonymously and helps us improve our tutorials.

Kommentare

No comments yet - be the first to ask a question about this tutorial.

Sign in to comment

Comments are open to centron customers. Sign in to your account to ask a question about this tutorial.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren