Install Subversion in Ubuntu 24.04

In this article, we cover how to install Subversion in Ubuntu 24.04 release. It is mainly a version control system. Version control system helps the software developers keep track of the modifications they make in the code. So, if something doesn’t fit well, they can always roll back the changes or modify the code accordingly.

There is a central repository where files/directories are placed and Subversion would keep track of any changes made to these files/directories.

Note: The following operations require Administrative rights. Contact your System Administrator if you don’t have the required rights.

Install Apache in Ubuntu

If you already have an Apache web server installed, then move to the next section. If you don’t have it installed then, open a terminal and issue the following in the terminal:

sudo apt update
sudo apt install apache2

Install Subversion in Ubuntu 24.04

The package is a part of the standard Ubuntu repository. Therefore, issue the following in the terminal:

sudo apt update
sudo apt install subversion libsvn-dev libapache2-mod-svn

You can skip updating the repository if you have already done that in the previous section.

Create a repository for SVN

We will store our mysvn repository in the directory: /home/$USER/svn

So, create a directory:

mkdir /home/$USER/svn

and,

sudo mkdir -p /home/$USER/svn/mysvn

SVN repository can be created through:

sudo svnadmin create /home/$USER/svn/mysvn

Also, change ownership as well:

cd /home/$USER/svn
sudo chown -R www-data:www-data mysvn/
sudo chmod -R 775 mysvn/

Now, make certain changes so that we get to access the Subversion repository through the WebDAV protocol.

sudo touch /etc/apache2/mods-available/dav_svn.conf
sudo nano /etc/apache2/mods-available/dav_svn.conf

And, append the file with the following code:

<Location /svn/mysvn>
     DAV svn
     SVNPath /home/$USER/svn/mysvn
     AuthType Basic
     AuthName "mysvn repository"
     AuthUserFile /etc/subversion/passwd
     Require valid-user
</Location>

Important: Replace $USER with your username.

Restart apache2.service

sudo systemctl restart apache2.service

Thereafter, create /etc/subversion/passwd file.

sudo htpasswd -c /etc/subversion/passwd user_name

It will prompt us to enter the password twice. Verify the entry through the following command:

cat /etc/subversion/passwd

Lastly, restart the Apache service:

sudo systemctl restart apache2.service

Now, open a web browser and enter the following in the address bar:

svn co http://localhost/svn/mysvn mysvn --username user_name

In conclusion, we have covered how to install Subversion in Ubuntu 24.04 release here.

Similar Posts