...
πŸš€ deploy subversion on debian vps
Learn how to deploy subversion on debian vps!

This article provides a guide demonstrating how to deploy Subversion on Debian VPS.

What is Subversion?

Apache Subversion (SVN) is an open-source version control system used to track changes to source code, configuration files, documents, and other files over time.

Like Git, it allows you to maintain a complete revision history, collaborate with other developers, and restore previous versions of files.

How Subversion works

Subversion uses a centralized version control model, meaning a single central repository maintains the authoritative version history.

Developers check out files from the central repository, make changes locally, and commit those changes back to the server.

Subversion vs. Git

Feature Subversion (SVN) Git
Architecture Centralized Distributed
Repository history Central server Local and remote
Offline commits No Yes
Revision identifiers Sequential numbers Commit hashes
Branching Repository-based Lightweight
Directory-level checkout Native Limited through sparse checkout
File locking Native Optional through extensions such as Git LFS
Granular directory permissions Native Typically requires additional tooling
Single server dependency Yes No

Common Subversion commands

# Check out a repository
svn checkout https://svn.example.com/project

# Retrieve the latest changes
svn update

# Check modified files
svn status

# View changes
svn diff

# Add a file
svn add filename.php

# Commit changes
svn commit -m "Updated configuration"

# View revision history
svn log

# Revert local changes
svn revert filename.php

Where Subversion is useful

  • Centralized server configuration management.
  • Enterprise software development.
  • Projects requiring directory-level access permissions.
  • Repositories containing large binary files.
  • Workflows requiring exclusive file locking.
  • Maintaining legacy software projects.

Is Subversion still worth using?

Yes! Subversion remains a viable version control system, particularly when centralized control and granular permissions are important.

Official website: subversion.apache.org

Notes

This guide covers Debian 12 (bookworm) and Debian 13 (trixie). The commands are the same on both. It sets up a central Subversion server with one of three access methods, then covers repository layout, access control, hooks, backups and troubleshooting.

Launch 100% ssd debian vps from $3. 19/mo!


Compare Debian VPS Plans

KVM-SSD-1
KVM-SSD-8
KVM-SSD-16
KVM-SSD-32
CPU
1 Core
2 Cores
4 Cores
8 Cores
Memory
1 GB
8 GB
16 GB
32 GB
Storage
16 GB NVMe
128 GB NVMe
256 GB NVMe
512 GB NVMe
Bandwidth
1 TB
4 TB
8 TB
16 TB
Network
1 Gbps
1 Gbps
1 Gbps
1 Gbps
Delivery Time
⏱️ Instant
⏱️ Instant
⏱️ Instant
⏱️ Instant
Location
US/EU/APAC
US/EU/APAC
US/EU/APAC
US/EU/APAC
Price
$7.58*
$39.50*
$79.40*
$151.22*
KVM-SSD-1
$7.58*
CPU 1 Core
Memory 1 GB
Storage 16 GB NVMe
Bandwidth 1 TB
Network 1 Gbps
Delivery Time ⏱️ Instant
Location US/EU/APAC
KVM-SSD-8
$39.50*
CPU 2 Cores
Memory 8 GB
Storage 128 GB NVMe
Bandwidth 4 TB
Network 1 Gbps
Delivery Time ⏱️ Instant
Location US/EU/APAC
KVM-SSD-16
$79.40*
CPU 4 Cores
Memory 16 GB
Storage 256 GB NVMe
Bandwidth 8 TB
Network 1 Gbps
Delivery Time ⏱️ Instant
Location US/EU/APAC
KVM-SSD-32
$151.22*
CPU 8 Cores
Memory 32 GB
Storage 512 GB NVMe
Bandwidth 16 TB
Network 1 Gbps
Delivery Time ⏱️ Instant
Location US/EU/APAC

How to Deploy Subversion on Debian VPS

To deploy Subversion on Debian VPS, follow the steps outlined below:

See Also: Install Coder on AlmaLinux VPS and Connect Workspace to VS Code (5 Minute Quick-Start Guide)

  1. Choose an Access Method

    Method URL scheme Transport security Auth backend Best for
    Apache + moddavsvn https:// TLS htpasswd, LDAP, etc. Production, firewalled clients, web browsing of repos
    svnserve daemon svn:// None (plaintext unless SASL encryption) passwd file or SASL LAN/VPN, quickest setup
    svnserve over SSH svn+ssh:// SSH SSH keys Small teams that already use SSH keys

    Recommendation: use Apache over HTTPS for anything that faces the internet. Sections 4–6 cover each method separately, so pick one. Running more than one against the same repository works, but every process that writes to it needs a shared group and umask.

  2. Prerequisites

    Update the system:

    sudo apt update && sudo apt full-upgrade -y
    sudo apt install -y subversion
    svnadmin --version | head -n1
    
  3. Create the Repository Root and a Repository

    Keep every repository under one parent directory. /srv/svn is the conventional choice.

    sudo mkdir -p /srv/svn
    sudo svnadmin create --fs-type fsfs /srv/svn/myproject
    

    Create the standard trunk/branches/tags layout in a single commit:

    sudo svn mkdir -m "Initial repository layout" \
      file:///srv/svn/myproject/trunk \
      file:///srv/svn/myproject/branches \
      file:///srv/svn/myproject/tags
    

    To import an existing source tree, use this instead:

    sudo svn import /path/to/source file:///srv/svn/myproject/trunk -m "Initial import"
    

    Repository directory structure:

    /srv/svn/myproject/
    β”œβ”€β”€ conf/        # svnserve.conf, passwd, authz (svnserve only)
    β”œβ”€β”€ db/          # FSFS revision data
    β”œβ”€β”€ hooks/       # *.tmpl hook templates
    β”œβ”€β”€ locks/
    └── format
    

    Ownership is set in the section for your chosen access method. Don’t skip that step. Wrong ownership is the most common cause of failed commits.

    See Also: Integrate Jitsi Meet with Moodle for Elearning Video Conferencing

  4. Method A: Apache + moddavsvn over HTTPS (Recommended)

    1. Install packages

      sudo apt install -y apache2 libapache2-mod-svn apache2-utils certbot python3-certbot-apache
      sudo a2enmod dav dav_svn authz_svn ssl headers
      
    2. Set repository ownership

      Apache runs as www-data, so it must own the repository:

      sudo chown -R www-data:www-data /srv/svn
      sudo chmod -R g+rwX /srv/svn
      
    3. Create a plain HTTP vhost (needed to issue the certificate)

      /etc/apache2/sites-available/svn.conf:

          ServerName svn.example.com
          DocumentRoot /var/www/html
          ErrorLog ${APACHE_LOG_DIR}/svn_error.log
          CustomLog ${APACHE_LOG_DIR}/svn_access.log combined
      
      
      sudo a2ensite svn.conf
      sudo apachectl configtest && sudo systemctl reload apache2
      sudo certbot --apache -d svn.example.com --redirect
      

      Certbot creates /etc/apache2/sites-available/svn-le-ssl.conf and adds an HTTP→HTTPS redirect to the port-80 vhost.

    4. Add the SVN location to the SSL vhost only

      Edit /etc/apache2/sites-available/svn-le-ssl.conf and add this inside :

          
              DAV svn
              SVNParentPath /srv/svn
              SVNListParentPath On
      
              # Authentication
              AuthType Basic
              AuthName "Subversion Repositories"
              AuthUserFile /etc/apache2/svn.htpasswd
              Require valid-user
      
              # Path-based authorization
              AuthzSVNAccessFile /etc/apache2/svn-authz
      
              # Performance
              SVNCacheFullTexts on
              SVNCacheTextDeltas on
              SVNInMemoryCacheSize 65536
      
              # Apache >= 2.4.54 defaults LimitRequestBody to 1 GiB; lift it for large binaries
              LimitRequestBody 0
          
      
          Header always set Strict-Transport-Security "max-age=31536000"
      

      SVNInMemoryCacheSize is in KiB, so 65536 means 64 MiB per Apache process. Lower it on small VPS plans.

    5. Create users

      sudo htpasswd -c -B /etc/apache2/svn.htpasswd alice   # -c only for the first user
      sudo htpasswd -B /etc/apache2/svn.htpasswd bob
      sudo chown root:www-data /etc/apache2/svn.htpasswd
      sudo chmod 640 /etc/apache2/svn.htpasswd
      

      -B stores bcrypt hashes. Remove a user with htpasswd -D /etc/apache2/svn.htpasswd bob.

    6. Define access rules

      /etc/apache2/svn-authz:

      [groups]
      devs    = alice, bob
      readers = carol
      
      # Default: deny everything
      [/]
      * =
      
      [myproject:/]
      @devs    = rw
      @readers = r
      
      # Example: lock down a subtree
      [myproject:/tags]
      @devs    = r
      alice    = rw
      
      sudo chown root:www-data /etc/apache2/svn-authz
      sudo chmod 640 /etc/apache2/svn-authz
      sudo apachectl configtest && sudo systemctl reload apache2
      

      The authz file is re-read on every request, so you don’t need to reload Apache after editing it.

    7. Firewall

      sudo ufw allow "Apache Full"    # 80 + 443
      

      Repository URL: https://svn.example.com/svn/myproject

  5. Method B: svnserve Daemon (svn://)

    svn:// traffic is unencrypted, and the passwd file stores passwords in plaintext. Use this method only on a private network or VPN, or put a tunnel in front of it.

    See Also: πŸš€ Deploy Odoo on Rocky Linux VPS

    1. Create a service account and set ownership

      sudo adduser --system --group --home /srv/svn --no-create-home svn
      sudo chown -R svn:svn /srv/svn
      sudo chmod -R g+rwX /srv/svn
      
    2. Shared auth files

      Keep the auth files outside the served root so all repositories can share them:

      sudo mkdir -p /etc/svnserve
      

      /etc/svnserve/passwd:

      [users]
      alice = StrongPassword1
      bob   = StrongPassword2
      

      /etc/svnserve/authz uses the same syntax as section 4.6.

      sudo chown -R root:svn /etc/svnserve
      sudo chmod 750 /etc/svnserve
      sudo chmod 640 /etc/svnserve/*
      
    3. Configure each repository

      /srv/svn/myproject/conf/svnserve.conf:

      [general]
      anon-access = none
      auth-access = write
      password-db = /etc/svnserve/passwd
      authz-db    = /etc/svnserve/authz
      realm       = Rad SVN
      
    4. systemd unit

      Debian doesn’t ship a unit for svnserve. Create /etc/systemd/system/svnserve.service:

      [Unit]
      Description=Subversion server (svnserve)
      After=network-online.target
      Wants=network-online.target
      
      [Service]
      Type=simple
      User=svn
      Group=svn
      UMask=0002
      ExecStart=/usr/bin/svnserve --daemon --foreground \
        --root=/srv/svn \
        --listen-port=3690 \
        --memory-cache-size=64 \
        --cache-txdeltas=yes \
        --cache-fulltexts=yes
      Restart=on-failure
      
      # Hardening
      NoNewPrivileges=yes
      PrivateTmp=yes
      ProtectSystem=strict
      ProtectHome=yes
      ReadWritePaths=/srv/svn
      ReadOnlyPaths=/etc/svnserve
      
      [Install]
      WantedBy=multi-user.target
      
      sudo systemctl daemon-reload
      sudo systemctl enable --now svnserve
      sudo systemctl status svnserve
      sudo ss -ltnp | grep 3690
      
    5. Firewall

      Restrict the port to trusted sources where you can:

      sudo ufw allow from 203.0.113.0/24 to any port 3690 proto tcp
      

      Repository URL: svn://svn.example.com/myproject. The path is relative to --root.

  6. Method C: svnserve over SSH (svn+ssh://)

    This method uses a single locked-down svn account. Each developer’s key is forced to run svnserve in tunnel mode under their own identity, so nobody gets a shell.

    sudo adduser --system --group --home /home/svn --shell /bin/sh svn
    sudo chown -R svn:svn /srv/svn
    sudo -u svn mkdir -p /home/svn/.ssh
    sudo -u svn touch /home/svn/.ssh/authorized_keys
    sudo chmod 700 /home/svn/.ssh && sudo chmod 600 /home/svn/.ssh/authorized_keys
    

    Add one line per developer to /home/svn/.ssh/authorized_keys:

    command="/usr/bin/svnserve -t -r /srv/svn --tunnel-user=alice",restrict ssh-ed25519 AAAA... alice@laptop
    command="/usr/bin/svnserve -t -r /srv/svn --tunnel-user=bob",restrict ssh-ed25519 AAAA... bob@desktop
    
    • restrict disables port, agent and X11 forwarding and PTY allocation.
    • --tunnel-user sets the commit author name. Path-based authorization still uses authz-db from svnserve.conf, so leave password-db unset for this method.
    • Because of -r /srv/svn, clients use paths relative to the root.

    Repository URL: svn+ssh://svn@svn.example.com/myproject

  7. Client Usage

    On a workstation, install the client with sudo apt install subversion (TortoiseSVN on Windows, or Homebrew subversion on macOS).

    See Also: πŸš€ How to Install and Run Netdata on AlmaLinux VPS (5 Minute Quick-Start Guide)

    # Check out trunk
    svn checkout https://svn.example.com/svn/myproject/trunk myproject
    cd myproject
    
    # Day-to-day
    svn status
    svn add newfile.php
    svn commit -m "Add newfile"
    svn update
    svn log -l 10
    svn diff -r PREV
    
    # Branch and tag (server-side cheap copies)
    svn copy ^/trunk ^/branches/feature-x -m "Create feature-x branch"
    svn copy ^/trunk ^/tags/1.0.0 -m "Tag 1.0.0"
    
    # Merge a branch back into trunk (from a trunk working copy)
    svn merge ^/branches/feature-x
    svn commit -m "Merge feature-x"
    
  8. Hooks

    Hooks live in /srv/svn//hooks/. They must be executable, owned by the service user, and must not depend on PATH, because they run with an empty environment.

    Allow log-message edits (hooks/pre-revprop-change):

    #!/bin/sh
    ACTION="$5"
    PROPNAME="$4"
    if [ "$ACTION" = "M" ] && [ "$PROPNAME" = "svn:log" ]; then
      exit 0
    fi
    echo "Only svn:log may be modified." >&2
    exit 1
    

    Require a commit message (hooks/pre-commit):

    #!/bin/sh
    REPOS="$1"; TXN="$2"
    LOG=$(/usr/bin/svnlook log -t "$TXN" "$REPOS")
    if [ -z "$(printf '%s' "$LOG" | tr -d '[:space:]')" ]; then
      echo "Commit message required." >&2
      exit 1
    fi
    exit 0
    
    sudo chmod 755 /srv/svn/myproject/hooks/pre-revprop-change /srv/svn/myproject/hooks/pre-commit
    sudo chown www-data:www-data /srv/svn/myproject/hooks/*   # or svn:svn for methods B/C
    
  9. Backups

    You can back up a repository two ways. Use both.

    • svnadmin hotcopy: a fast, consistent physical copy, best for restoring the same Subversion version.
    • svnadmin dump: a portable logical dump that survives version upgrades and migrations.

    /usr/local/sbin/svn-backup.sh:

    #!/usr/bin/env bash
    set -euo pipefail
    
    SRC=/srv/svn
    DEST=/var/backups/svn
    KEEP_DAYS=14
    STAMP=$(date +%F)
    
    mkdir -p "$DEST/hotcopy" "$DEST/dumps/$STAMP"
    
    for repo in "$SRC"/*/; do
      repo=${repo%/}
      name=$(basename "$repo")
      [ -f "$repo/format" ] || continue
    
      svnadmin hotcopy --incremental "$repo" "$DEST/hotcopy/$name"
      svnadmin dump --quiet --deltas "$repo" | gzip -6 > "$DEST/dumps/$STAMP/$name.dump.gz"
    done
    
    find "$DEST/dumps" -mindepth 1 -maxdepth 1 -type d -mtime +"$KEEP_DAYS" -exec rm -rf {} +
    
    sudo chmod 750 /usr/local/sbin/svn-backup.sh
    echo '30 2 * * * root /usr/local/sbin/svn-backup.sh' | sudo tee /etc/cron.d/svn-backup
    

    Sync /var/backups/svn to off-server storage (rsync, restic, S3, etc.). A backup kept only on the same VPS isn’t a backup.

    See Also: πŸš€ How to Deploy Navidrome on Ubuntu VPS

    Restore from a dump:

    sudo svnadmin create /srv/svn/myproject
    gunzip -c myproject.dump.gz | sudo svnadmin load /srv/svn/myproject
    sudo chown -R www-data:www-data /srv/svn/myproject   # adjust owner per method
    

    Migrate from a remote server you have no shell access to:

    svnrdump dump https://old.example.com/svn/myproject | gzip > myproject.dump.gz
    
  10. Maintenance

    # Integrity check (run periodically or after hardware issues)
    sudo svnadmin verify /srv/svn/myproject
    
    # Pack completed FSFS shards (fewer files, better performance)
    sudo -u www-data svnadmin pack /srv/svn/myproject
    
    # Upgrade repo format after a major Debian/Subversion upgrade
    sudo -u www-data svnadmin upgrade /srv/svn/myproject
    
    # Remove stale transactions left by aborted commits
    sudo svnadmin lstxns /srv/svn/myproject
    sudo -u www-data svnadmin rmtxns /srv/svn/myproject $(sudo svnadmin lstxns /srv/svn/myproject)
    
    # Repository info
    sudo svnadmin info /srv/svn/myproject
    

    svnadmin upgrade only bumps the repository format. To pick up every on-disk improvement, do a full dump and then load into a fresh repository.

  11. Troubleshooting

    Symptom Likely cause Fix
    Can't open file '.../db/txn-current-lock': Permission denied Wrong owner (often root after svn mkdir/import via file://) chown -R www-data:www-data /srv/svn/ (or svn:svn)
    HTTP 403 Forbidden on checkout authz rule denies the path, or repo name in the section doesn’t match the directory Check [repo:/path] sections and the [/] default
    HTTP 401 loop Wrong AuthUserFile path or htpasswd unreadable by www-data ls -l /etc/apache2/svn.htpasswd; check svn_error.log
    Could not open the requested SVN filesystem SVNParentPath mismatch, or URL includes the wrong segment URL should be /svn/, not /svn/srv/svn/
    E170013: Unable to connect Firewall, or service not listening ss -ltnp, ufw status, provider firewall
    E220001: Item is not readable authz denies read on part of the path Grant r at the needed level
    Large commits fail with 413 LimitRequestBody Set LimitRequestBody 0 in the
    svnserve: Authorization failed svnserve.conf paths wrong, or svn user can’t read /etc/svnserve/* Check permissions; journalctl -u svnserve
    Hook fails with command not found Hooks run with an empty PATH Use absolute paths (/usr/bin/svnlook)

    Logs:

    sudo tail -f /var/log/apache2/svn_error.log
    sudo journalctl -u svnserve -f
    
  12. Hardening Checklist

    • Serve only over HTTPS or SSH on public interfaces. Restrict svn:// with firewall rules.
    • Set [/] * = in authz as a default-deny, then grant access explicitly.
    • Use bcrypt (htpasswd -B) and keep auth files at mode 640, owned by root:.
    • Add fail2ban with the apache-auth jail to slow down brute-force attempts on Basic auth.
    • Put /srv/svn on a filesystem with enough free inodes. Unpacked FSFS repositories create one file per revision.
    • Verify repositories and test a restore on a schedule, not only when something breaks.
    • Keep unattended-upgrades enabled for security patches to Apache and Subversion.

Launch 100% ssd debian vps from $3. 19/mo!

See Also: How to Install BeAdmin Control Panel on Ubuntu VPS

Conclusion

You now know how to deploy Subversion on Debian VPS.


Compare Debian VPS Plans

KVM-SSD-1
KVM-SSD-8
KVM-SSD-16
KVM-SSD-32
CPU
1 Core
2 Cores
4 Cores
8 Cores
Memory
1 GB
8 GB
16 GB
32 GB
Storage
16 GB NVMe
128 GB NVMe
256 GB NVMe
512 GB NVMe
Bandwidth
1 TB
4 TB
8 TB
16 TB
Network
1 Gbps
1 Gbps
1 Gbps
1 Gbps
Delivery Time
⏱️ Instant
⏱️ Instant
⏱️ Instant
⏱️ Instant
Location
US/EU/APAC
US/EU/APAC
US/EU/APAC
US/EU/APAC
Price
$7.58*
$39.50*
$79.40*
$151.22*
KVM-SSD-1
$7.58*
CPU 1 Core
Memory 1 GB
Storage 16 GB NVMe
Bandwidth 1 TB
Network 1 Gbps
Delivery Time ⏱️ Instant
Location US/EU/APAC
KVM-SSD-8
$39.50*
CPU 2 Cores
Memory 8 GB
Storage 128 GB NVMe
Bandwidth 4 TB
Network 1 Gbps
Delivery Time ⏱️ Instant
Location US/EU/APAC
KVM-SSD-16
$79.40*
CPU 4 Cores
Memory 16 GB
Storage 256 GB NVMe
Bandwidth 8 TB
Network 1 Gbps
Delivery Time ⏱️ Instant
Location US/EU/APAC
KVM-SSD-32
$151.22*
CPU 8 Cores
Memory 32 GB
Storage 512 GB NVMe
Bandwidth 16 TB
Network 1 Gbps
Delivery Time ⏱️ Instant
Location US/EU/APAC

Avatar of editorial staff

Editorial Staff

Rad Web Hosting is a leading provider of web hosting, Cloud VPS, and Dedicated Servers in Dallas, TX.

Leave a Reply

lg