Log inSign up

A Subversion server with Apache and HTTPS

Install subversion, Apache and the WebDAV module (libapache2-mod-svn on Ubuntu and Debian, mod_dav_svn on Rocky and Alma), create repositories with svnadmin create under /srv/svn and expose them through a <Location /svn> block with basic authentication and an authz file. Add a Certbot certificate so passwords only travel over HTTPS, and back up with svnadmin hotcopy or svnadmin dump.

Topic: Developer tools and CI · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13, Rocky Linux 9, AlmaLinux 9 · Updated 2026-12-03

Which way of serving Subversion should you choose?

For most teams, Apache with mod_dav_svn over HTTPS is the right choice: it works through any firewall, uses TLS for passwords and data, and supports per path access rules. The alternatives are narrower:

  • svnserve: a small daemon on port 3690 with its own protocol. Fast, but traffic is not encrypted unless you add SASL.
  • svn+ssh: clients start svnserve -t over SSH. Secure, but every user needs a system account and fine grained rules are awkward.

This guide uses Apache. Subversion is light on resources; a small plan handles a team, and disk space is the figure to watch as history grows. Point a name such as svn.example.net at the server first (DNS records).

Which packages does a Subversion server need?

Everything needed is in the base repositories of each distribution.

# Ubuntu and Debian
sudo apt update
sudo apt install -y subversion apache2 libapache2-mod-svn apache2-utils
sudo a2enmod dav dav_svn authz_svn
svn --version --quiet
apache2 -v

# Rocky Linux 9 and AlmaLinux 9
sudo dnf install -y subversion httpd mod_dav_svn mod_ssl httpd-tools
sudo systemctl enable --now httpd
svn --version --quiet
httpd -v

On the RHEL family the module package drops /etc/httpd/conf.modules.d/10-subversion.conf, which already loads mod_dav_svn and mod_authz_svn.

How do you create a repository?

Create a parent folder, make each repository with svnadmin create and hand ownership to the web server user so Apache can write new revisions.

sudo mkdir -p /srv/svn
sudo svnadmin create /srv/svn/project
sudo chown -R www-data:www-data /srv/svn       # Rocky/Alma: apache:apache

On Rocky and AlmaLinux, SELinux also needs to allow Apache to write there:

sudo dnf install -y policycoreutils-python-utils
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/srv/svn(/.*)?"
sudo restorecon -Rv /srv/svn

Each repository is a self contained folder with its database in db/, server side scripts in hooks/ and settings in conf/. Repeat the create step for every new project.

How do you set up users and access rules?

Use an htpasswd file for passwords and an authz file for permissions. The -B option stores bcrypt hashes.

sudo htpasswd -c -B /etc/svn-users alice      # -c only for the first user
sudo htpasswd -B /etc/svn-users bob
sudo tee /etc/svn-authz >/dev/null <<'EOF'
[groups]
devs = alice, bob

[/]
* =

[project:/]
@devs = rw

[project:/tags]
@devs = r
alice = rw
EOF

Rules are read per repository and path: [project:/] applies to the whole project repository, and the more specific [project:/tags] section makes tags read only for everyone except alice. The empty * = line at the top denies access by default.

How do you configure Apache for Subversion?

Add a virtual host that maps /svn to the parent folder. On Ubuntu and Debian save it as /etc/apache2/sites-available/svn.conf; on Rocky and Alma as /etc/httpd/conf.d/svn.conf.

<VirtualHost *:80>
    ServerName svn.example.net
    <Location /svn>
        DAV svn
        SVNParentPath /srv/svn
        SVNListParentPath On
        AuthType Basic
        AuthName "Subversion"
        AuthUserFile /etc/svn-users
        AuthzSVNAccessFile /etc/svn-authz
        Require valid-user
    </Location>
</VirtualHost>
# Ubuntu and Debian
sudo a2ensite svn
sudo apache2ctl configtest && sudo systemctl reload apache2

# Rocky and Alma
sudo apachectl configtest && sudo systemctl reload httpd

Make the two auth files readable by the web server group, for example sudo chgrp www-data /etc/svn-users /etc/svn-authz and mode 640.

How do you enable HTTPS and the firewall?

Request a certificate with Certbot and its Apache plugin; it adds a TLS virtual host and a redirect from HTTP. On Rocky and Alma, Certbot comes from EPEL.

# Ubuntu and Debian
sudo apt install -y certbot python3-certbot-apache
sudo ufw allow OpenSSH
sudo ufw allow 'Apache Full'
sudo ufw enable

# Rocky and Alma
sudo dnf install -y epel-release
sudo dnf install -y certbot python3-certbot-apache
sudo firewall-cmd --permanent --add-service=http --add-service=https
sudo firewall-cmd --reload

sudo certbot --apache -d svn.example.net

The Certbot guide covers renewals and troubleshooting. Never run Subversion with basic authentication over plain HTTP, since the password is only base64 encoded.

How do you test the server from a client?

Create the standard layout, check out a working copy and commit a file:

svn mkdir --parents -m "Initial layout" \
  https://svn.example.net/svn/project/trunk \
  https://svn.example.net/svn/project/branches \
  https://svn.example.net/svn/project/tags --username alice
svn checkout https://svn.example.net/svn/project/trunk project
cd project
echo "hello" > README.txt
svn add README.txt
svn commit -m "Add readme"
svn log -l 3

A 403 on commit points to the authz rules; a 500 often means Apache cannot write to the repository (owner or SELinux label). Look in /var/log/apache2/error.log or /var/log/httpd/error_log.

How do you back up and maintain repositories?

Use svnadmin hotcopy for a fast, consistent copy of a live repository, and svnadmin dump for a portable file that loads into any Subversion version.

sudo svnadmin hotcopy /srv/svn/project /var/backups/svn/project --incremental
sudo svnadmin dump -q /srv/svn/project | gzip > /var/backups/svn/project-$(date +%F).dump.gz
sudo svnadmin verify -q /srv/svn/project

# restore a dump into a new repository
sudo svnadmin create /srv/svn/project-restored
gunzip -c project-2026-12-01.dump.gz | sudo svnadmin load -q /srv/svn/project-restored

Copy the backups off the server, for example with restic as in daily backups. To let users fix commit messages, add an executable hooks/pre-revprop-change script that exits 0 when the property is svn:log. After a major Subversion upgrade, svnadmin upgrade moves a repository to the newer format.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
S1-2small team repositories1 vCPU, 2 GB RAM, 55 GB SSD$6.00/mo$72.00 for 12 months
A1-2busy repositories on NVMe1 vCPU, 2 GB RAM, 50 GB NVMe$7.20/mo$43.20 for 6 months

Questions about Apache Subversion server

Can I migrate a Subversion repository to Git later?

Yes. git svn clone or dedicated migration tools convert history, and a private Git server can host the result.

Why does a commit fail with 500 on Rocky Linux?

Usually SELinux. Check that /srv/svn carries the httpd_sys_rw_content_t label and run restorecon -Rv /srv/svn again after moving files.

How do I add a new user?

Run sudo htpasswd -B /etc/svn-users newname without -c, which would overwrite the file, then add the name to a group in the authz file.

Do changes to the authz file need a reload?

No. mod_authz_svn reads the file on each request, so new rules apply right away.

Can I trigger CI builds on commit?

Yes. A post-commit hook can call a CI webhook with curl, for example to start a Jenkins job.