How to install apache subversion on ubuntu

How to Install Apache Subversion on Ubuntu

“The Apache Subversion, abbreviated as SVN, is an open-source version control system released by Apache and is used by developers for tracking code changes across projects. Besides, SVN documents and organizes the project changes, and it can work across the network, especially since it supports different protocols, such as HTTPS, HTTP, and SVN.

Today’s guide covers how to install SVN on Ubuntu systems in a step-by-step manner.”

Understanding Apache Subversion

The SVN is a great tool for developers working on the same codebase as it helps track changes. Therefore, it works as a version control system and works well to version control different directories and files.

Sponsored

The SVN comprises two components. The first is the server which stores the repository for the subversion. At the same time, the other is the client, which is the application used in organizing updates contained in the subversion server.

Installing Apache Subversion

The Apache Subversion can be installed from the command line, but first, you must have Apache installed. The steps below will guide you throughout.

1. Install Apache2

You probably have Apache installed already. If not, update your system and then use the command below to install Apache. If not, update your system and then use the commands below to install Apache.

How to install apache subversion on ubuntu 1

To check the Apache status, use the following command.

$ sudo systemctl status apache2

How to install apache subversion on ubuntu 2 

If Apache is not running, you need to start it.

$ sudo systemctl start apache2

Apache is not enabled at boot up. However, if you wish to enable it every time you boot up your system, the command below does the magic.

$ sudo systemctl enable apache2

Also, you can confirm that Apache is up and running by typing your local host IP address on the browser. It should return the Apache welcome page, like in the image below.

How to install apache subversion on ubuntu 3

2. Install Apache Subversion

Run the command below to install Apache Subversion and all its necessary dependencies.

$ sudo apt-get install subversion libapache2-mod-svn subversion-tools libsvn-dev

How to install apache subversion on ubuntu 4

When prompted, like in the image below, choose the default selected option, Internet Site

How to install apache subversion on ubuntu 5

Also, you will need to enter the system mail name.

How to install apache subversion on ubuntu 6

Once installed, run the commands below to enable the Apache modules required to run SVN.

How to install apache subversion on ubuntu 7

Then, restart Apache2

$ sudo systemctl restart apache2

3. Apache Subversion Configuration

The configuration file for SVN needs to be edited to configure Apache with SVN.

$ sudo nano /etc/apache2/mods-enabled/dav_svn.conf

Open it with an editor of choice and uncomment the lines below.

Sponsored
DAV svn

SVNParentPath /var/www/svn

AuthType Basic

AuthName “Subversion Repository”

AuthUserFile /etc/apache2/dav_svn.passwd

Require valid-user

Once you’ve made the changes,  save and close the file.

How to install apache subversion on ubuntu 8

The next thing is to create repositories. Start by creating a directory for the SVN. In this case, we will use the /opt directory.

$  sudo mkdir /opt/svn

Create a repository for it, and you can name it as you wish. In our case, we will name it “linuxhint.”

$  sudo svnadmin create /opt/svn/linuxhint

Also, you must change the file permissions and ownership for the SVN directory and repository using the commands below.

To change the ownership for the SVN repository:

See also  How to Install Lynis for Security on Ubuntu 22.04
$  sudo chown -R www-data:www-data /opt/svn/linuxhint

To change the permissions:

$ sudo chmod -R 775 /opt/svn/linuxhint

How to install apache subversion on ubuntu 9

4. Create SVN Users

The first user we will create is the admin, and to create the user, we need a password file stored in the /etc directory.

$ sudo htpasswd -cm /etc/apache2/dav_svn.passwd linuxhint-admin

How to install apache subversion on ubuntu 10

Replace the username appropriately.

If you need more users, for instance, to create a new user admin2, the command will be:

$ sudo htpasswd -m /etc/apache2/dav_svn.passwd admin2

How to install apache subversion on ubuntu 11

The configuration is complete. Restart Apache, then proceed to test Apache Subversion.

$ sudo systemctl restart apache2

Open your browser and use the URL syntax below for testing.

$ http://your-ip>/svn/project-name

In our case, it will be:

$ http://127.0.0.1/svn/linuxhint

How to install apache subversion on ubuntu 12

Bingo! You’ve successfully installed and used Apache Subversion on Ubuntu.

Conclusion

This guide covered installing Apache Subversion, starting with installing Apache2 to the installation and configuration of SVN. Hopefully, your installation was successful, and you can extend the tutorial to configure and manage your projects. All the best!

Leave a Comment

Only people in my network can comment.