How To Install Apache Subversion on Ubuntu 22.04 LTS
In this tutorial, we will show you how to install Apache Subversion on Ubuntu 22.04 LTS. For those of you who didn’t know, Apache Subversion, often referred to as SVN, is a widely recognized open-source version control system. It is a critical tool for software developers and teams, enabling them to manage and track changes to files such as source code, documents, and web pages. SVN provides a centralized repository where all changes are stored and tracked, allowing multiple users to work on the same files concurrently without conflict. This powerful tool is essential for maintaining the integrity of projects and ensuring efficient collaboration among team members.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Apache Subversion (SVN) on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.
Prerequisites
- A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Subversion.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Apache Subversion on Ubuntu 22.04 LTS Jammy Jellyfish
Step 1. Before diving into the installation process, it’s crucial to ensure that your system is up-to-date. This step is important because it ensures that you have the latest security patches and system improvements, which can help prevent potential issues during the installation process. To update your system packages, open the terminal and run the following commands:
sudo apt update sudo apt upgrade
Step 2. Installing Apache.
Subversion is dependent on Apache so first, we need to install Apache on the server. Now run the following command below to install the Apache web server:
sudo apt install apache2
By default, after the Apache installation successfully completed, the service should be up and running. To be certain, we need to start it again:
sudo systemctl enable apache2 sudo systemctl start apache2
For additional resources on installing Apache, read the post below:
Step 3. Installing Apache Subversion on Ubuntu 22.04.
By default, Subversion is available on Ubuntu 22.04 base repository. Now run the following command below to install the latest version of the Subversion cache to your Ubuntu system:
sudo apt install subversion subversion-tools libapache2-mod-svn
After that, enable the Apache modules and restart the Apache with the following commands:
sudo a2enmod dav sudo a2enmod dav_svn sudo systemctl restart apache2
Step 4. Configure SVN (Subversion) on Ubuntu 22.04.
Now we open the following configuration file with your favorite text editor:
nano /etc/apache2/mods-enabled/dav_svn.conf
Uncomment the lines below:
<Location /svn> DAV svn SVNParentPath /var/lib/svn AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd Require valid-user </Location>
Save and close the file, then restart Apache to apply the changes:
sudo systemctl restart apache2
Next, create an SVN repository on Ubuntu 22.04. Here we named it idroot-repo
. To do this, you can use the following commands:
sudo mkdir -p /var/lib/svn/ sudo svnadmin create /var/lib/svn/idroot-repo
Change the ownership for the SVN repository:
sudo chown -R www-data:www-data /var/lib/svn sudo chmod -R 775 /var/lib/svn
After that, create an SVN user in /etc/apache2/dav_svn.passwd
file. These users will use it for the authentication of svn repositories:
sudo htpasswd -cm /etc/apache2/dav_svn.passwd admin
To create additional users you can use the following command below:
sudo htpasswd -m /etc/apache2/dav_svn.passwd idroot_user
Step 5. Accessing Apache Subversion.
Once successfully set up Subversion, open a web browser and navigate to http://your-IP-address/svn/idroot-repo/
.
Congratulations! You have successfully installed Subversion. Thanks for using this tutorial for installing Apache Subversion (SVN) on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the official Apache website.