16 C
Texas
angeloma
Senior Writer and partner

How to install Apache Subversion on Ubuntu 20.04?

Hello, friends. Although Git is the most popular version control system out there, some projects are maintained using Subversion. So, in this post, you will learn how to install Apache Subversion on UBuntu 20.04.

Brief introduction to Apache Subversion

According to the website of this program:

Subversion is an open-source version control system. Founded in 2000 by CollabNet, Inc. the Subversion project and software have seen incredible success over the past decade. Subversion has enjoyed and continues to enjoy widespread adoption in both the open-source arena and the corporate world.

With the advent of Git, it has indeed fallen in use, but it is still important to many developers and projects worldwide. That’s why learning how to install it can be quite useful.

What does Subversion pretend to be? Subversion exists to be universally recognized and adopted as an open-source, centralized version control system characterized by its reliability as a haven for valuable data; the simplicity of its model and usage; and its ability to support the needs of a wide variety of users and projects, from individuals to large-scale enterprise operations.

- Advertisement -

So now we can get started.

Install Apache Subversion on Ubuntu 20.04

So, before we start, update your entire Linux distribution as follows:

sudo apt update
sudo apt upgrade

Then, install Apache and the apache2-utils package

sudo apt install apache2 apache2-utils

Check the status of the Apache service for any errors

sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2021-08-12 17:24:56 CEST; 7s ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 1872 (apache2)
      Tasks: 55 (limit: 2286)
     Memory: 5.6M
     CGroup: /system.slice/apache2.service
             ├─1872 /usr/sbin/apache2 -k start
             ├─1873 /usr/sbin/apache2 -k start
             └─1874 /usr/sbin/apache2 -k start

Aug 12 17:24:56 osradar systemd[1]: Starting The Apache HTTP Server...
Aug 12 17:24:56 osradar apachectl[1871]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName'>ug 12 17:24:56 osradar systemd[1]: Started The Apache HTTP Server.

If everything is OK, then you can install the modules required by Subversion.

sudo apt install libapache2-mod-svn subversion-tools libsvn-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libapr1-dev libaprutil1-dev libc-dev-bin libc6-dev libcrypt-dev libexpat1-dev libldap2-dev libsctp-dev libsctp1 libserf-1-1 libsvn1 libutf8proc2 linux-libc-dev
  subversion uuid-dev
Suggested packages:
  db5.3-util python glibc-doc manpages-dev lksctp-tools libserf-dev libsvn-doc zlib1g-dev ruby-svn svn2cl
Recommended packages:
  manpages-dev default-mta | mail-transport-agent libconfig-inifiles-perl libsvn-perl liburi-perl python-subversion
The following NEW packages will be installed:
  libapache2-mod-svn libapr1-dev libaprutil1-dev libc-dev-bin libc6-dev libcrypt-dev libexpat1-dev libldap2-dev libsctp-dev libsctp1 libserf-1-1 libsvn-dev libsvn1
  libutf8proc2 linux-libc-dev subversion subversion-tools uuid-dev
0 upgraded, 18 newly installed, 0 to remove and 29 not upgraded.
Need to get 9,473 kB of archives.
After this operation, 63.0 MB of additional disk space will be used.
Do you want to continue? [Y/n]

And then Subversion itself:

sudo apt install subversion

After that, enable the apache modules for Subversion

sudo a2enmod dav
sudo a2enmod dav_svn

In my case, they were already enabled, but better be sure.

Configuring Subversion for the first use

Subversion is already installed and running, but it is convenient to make some previous configurations.

The first thing to do is to create a username and password to secure access from the web.

To do this, run the following command:

sudo htpasswd -cm /etc/apache2/dav_svn.passwd admin
New password:
Re-type new password:
Adding password for user admin

You can replace admin with any username you want. The above command will prompt for the password of this new user.

Apply the changes by restarting Apache

sudo systemctl restart apache2

Now, you have to modify the configuration file of one of the Subversion modules for Apache

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

And replace the content with the following:

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>

Note: It is advisable then, to make a backup before

Save the changes and close the editor.

Now create a new folder for Subversion projects.

sudo mkdir /var/www/svn

Next, it is necessary to initialize the Subversion project.

sudo sudo svnadmin create /var/www/svn/[project-name]

Remember that you have to replace [project-name] with the name of your project as this will generate a folder.

Make Apache the owner of the project folder.

sudo chown -R www-data:www-data /var/www/svn

And assign the correct permissions:

sudo chmod -R 775 /var/www/svn

Now yes, you can see the change from apache and a web browser at the address http://ip-server/svn/project, and from now on you can work with Subversion.

1.- Apache Subversion working on Ubuntu 20.04
1.- Apache Subversion working on Ubuntu 20.04

Conclusion

Git is the clear market dominator but Subversion is a useful tool that adapts to other needs. So it is always convenient to know how to install it.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article