Install and Configure an SVN Server on Debian 11

In this article, we want to teach you How To Install and Configure an SVN Server on Debian 11.

Apache Subversion (SVN) is a free, open-source version control system that operates according to the client/server model.

An SVN server is usually installed on a central computer and it manages the data of the SVN repository in a database.

How To Install and Configure an SVN Server on Debian 11

Before you start to set up an SVN Server on Debian 11, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article the Initial Server Setup with Debian 11.

Now follow the steps below to install SVN on Debian 11.

Install Apache and SVN on Debian 11

First, update your local package index with the following command:

sudo apt update

Then, you need to install Apache to access the SVN server using HTTP URLs. To do this, use the following command:

sudo apt install apache2

Now you can install SVN and also install the Apache module to make SVN work with Apache. Run the following command:

sudo apt install subversion subversion-tools libapache2-mod-svn

After your installation is finished, enable the Apache modules and restart the Apache with the following commands:

$ sudo a2enmod dav
$ sudo a2enmod dav_svn
$ sudo systemctl restart apache2

Configure SVN on Debian 11

Here you need to configure Apache with subversion. Open the following configuration file with your favorite text editor, here we use vi:

sudo vi /etc/apache2/mods-enabled/dav_svn.conf

You need to uncomment the following lines at the file by removing the # from the beginning of the lines. These lines should look like this:

<Location /svn>
 DAV svn
 SVNParentPath /var/lib/svn
 AuthType Basic
 AuthName "Subversion Repository"
 AuthUserFile /etc/apache2/dav_svn.passwd
 Require valid-user
</Location>

When you are finished, save and close the file.

To apply the changes restart Apache with the following command:

sudo systemctl restart apache2

Now you need to create an SVN repository on Debian 11. Here we named it myrepo. To do this, you can use the following commands:

$ sudo mkdir -p /var/lib/svn/
$ sudo svnadmin create /var/lib/svn/myrepo

Also, you need to set the correct permissions for the new directories that you have created:

$ sudo chown -R www-data:www-data /var/lib/svn
$ sudo chmod -R 775 /var/lib/svn

Then, you need to 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

This will create a user named admin and you will be asked to give it a password.

To create additional users you can use the following commands:

$ sudo htpasswd -m /etc/apache2/dav_svn.passwd user1
$ sudo htpasswd -m /etc/apache2/dav_svn.passwd user2

Now you can access SVN repository o Debian 11 by typing your server’s IP address in your web browser followed by /svn/myrepo/:

http://server-IP-address/svn/myrepo/

You should enter your credentials and you will see:

SVN repository on Debian 11

Conclusion

At this point, you learn to set up and Configure an SVN server on your Debian 11.

Hope you enjoy using it.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

POPULAR TAGS

Most Popular