Apache Subversion (SVN) is a version control system available under the open-source Apache License. Developers commonly use SVN to monitor and manage code and file changes within projects. It provides support for several network access protocols including SVN, SVN+SSH, HTTP, and HTTPS. This tutorial explains the process to install Subversion on Ubuntu 20.04.
Prerequisites
- Set up a Ubuntu 20.04 server with all packages updated.
- Generate a non-root user account with sudo rights.
Matching infrastructure at centron
Ubuntu servers without your own hardware: ccloud³ VMs with full root access from €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →
1. Install Apache2
Begin by setting up the Apache HTTP web server.
$ sudo apt update
$ sudo apt install apache2 apache2-utils -yStart Apache service:
$ sudo systemctl start apache2Enable Apache to start at boot time:
$ sudo systemctl enable apache22. Install Apache Subversion
First, install necessary dependency packages:
$ sudo apt-get install libapache2-mod-svn subversion-tools libsvn-dev -yWhen prompted, choose the Internet Site default configuration.
Then, install Subversion:
$ sudo apt install subversion -yActivate required Apache modules for SVN:
$ sudo a2enmod dav
$ sudo a2enmod dav_svnRestart Apache service to apply changes:
$ sudo systemctl restart apache23. Configure Apache2 for SVN
Open the SVN configuration file in Apache for editing:
$ sudo nano /etc/apache2/mods-enabled/dav_svn.confEnsure the file matches the following configuration before saving and exiting:
Alias /svn /var/www/svn
<Location /svn>
DAV svn
SVNParentPath /var/www/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>Create the SVN project directory:
$ sudo mkdir /var/www/svn
$ sudo svnadmin create /var/www/svn/projectAdjust permissions for the repository:
$ sudo chown -R www-data:www-data /var/www/svn
$ sudo chmod -R 775 /var/www/svn4. Create SVN Admin Accounts
Add a new SVN user named admin:
$ sudo htpasswd -cm /etc/apache2/dav_svn.passwd adminRestart Apache to apply user authentication settings:
$ sudo systemctl restart apache2To view the repository in your browser, navigate to:
http://server_IP/svn/project
Example:
http://192.0.2.10/svn/project
Conclusion
You have now completed the installation and configuration of Apache Subversion (SVN) on your Ubuntu 20.04 server. By following the steps in this guide, you installed the Apache2 web server, configured the necessary modules, set up SVN repositories, and secured access with basic authentication. Your system is now ready to manage version-controlled projects efficiently and securely.
SVN is a powerful and reliable tool for tracking changes in codebases and managing collaborative development. It provides a stable environment for teams that require centralized version control. With your repository up and running, you can start organizing your code, enforcing access rules, and integrating SVN into your development workflow.
Make sure to maintain regular backups of your repositories and monitor access logs to ensure security and integrity. As your projects grow, you can further enhance SVN by integrating web interfaces, hooks for automation, or migration to more advanced repository structures.
For advanced configuration options and best practices, consult the official Apache Subversion documentation. With this foundation in place, your development team can work more effectively, keep track of every change, and maintain full control over your code history.
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.