How to Install Subversion Server on Ubuntu Linux

|

|

The text provides a guide on how to install and configure SVN (Subversion), an open-source versioning and revision control system, on Ubuntu 16.04 | 18.04 with Apache2 HTTP server. The guide covers installation and configuration of Apache and SVN packages, setup of an SVN repository, creation of user accounts, and enabling access to the repository.

This article explains how to install a Subversion server on Ubuntu Linux.

SVN (Subversion) is an open-source versioning and revision control system distributed under the open-source Apache License and built by the Apache Foundation Team.

You might want to install the Subversion server on Ubuntu Linux for several reasons. One of the most common reasons is to have a centralized place to store and manage versions of your files, such as source code, documentation, and others.

This can be particularly useful if you work on a project with others or need to keep track of changes over time. Another reason to use Subversion is that it provides a secure and efficient way to manage your files. Subversion uses a client-server architecture, which means you can access your files from any computer with the Subversion client installed as long as you have the necessary permissions.

Finally, Subversion is an open-source project supported by a large and active community of developers. This means you can use a wide range of features, plugins, and extensions to customize your Subversion server to meet your needs.

This post will also show you how to create user accounts to access the subversion repository after creating it.

Install Apache

The subversion server needs a web or HTTP server. For this setup, we’re going to be using Apache2. On Ubuntu, the commands below will install Apache2.

sudo apt update
sudo apt install apache2 apache2-utils

After installing Apache2, the commands below can stop, start, and enable the Apache2 service to always start up with the server boots.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

After installing Apache2, continue below to setting up Subversion.

Install SVN Packages on Ubuntu

To get Subversion setup and working on Ubuntu, run the commands below to get it, including all dependencies:

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

After installing the above packages, run the commands below to enable Apache2 modules that allow Subversion to function.

sudo a2enmod dav
sudo a2enmod dav_svn
sudo service apache2 restart

Configure Apache

After installing Subversion packages, run the commands below to edit the SVN config file. This should allow you to create an SVN repository for controlling access. Next, run the commands below to open the file.

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

Then, make the highlighted changes into the file and save.

#  . 
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/
# Note, a literal /svn should NOT exist in your document root.
<Location /svn>
  # Uncomment this to enable the repository
  DAV svn

  # Set this to the path to your repository
  #SVNPath /var/lib/svn
  # Alternatively, use SVNParentPath if you have multiple repositories under
  # under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, .).
  # You need either SVNPath and SVNParentPath, but not both.
  SVNParentPath /var/lib/svn

  # Access control is done at 3 levels: (1) Apache authentication, via
  # any of several methods.  A "Basic Auth" section is commented out
  # below.  (2) Apache  and , also commented out
  # below.  (3) mod_authz_svn is a svn-specific authorization module
  # which offers fine-grained read/write access control for paths
  # within a repository.  (The first two layers are coarse-grained; you
  # can only enable/disable access to an entire repository.)  Note that
  # mod_authz_svn is noticeably slower than the other two layers, so if
  # you don't need the fine-grained control, don't configure it.

  # Basic Authentication is repository-wide.  It is not secure unless
  # you are using https.  See the 'htpasswd' command to create and
  # manage the password file - and the documentation for the
  # 'auth_basic' and 'authn_file' modules, which you will need for this
  # (enable them with 'a2enmod').
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav_svn.passwd

  # To enable authorization via mod_authz_svn (enable that module separately):
   #
  #AuthzSVNAccessFile /etc/apache2/dav_svn.authz
  #

  # The following three lines allow anonymous read, but make
  # committers authenticate themselves.  It requires the 'authz_user'
  # module (enable it with 'a2enmod').
  #
    Require valid-user
  # 
   </Location>

Run the commands below to create an SVN Repository in the /var/lib/svn directory.

sudo mkdir /var/lib/svn
sudo svnadmin create /var/lib/svn/repository
sudo chown -R www-data:www-data /var/lib/svn
sudo chmod -R 775 /var/lib/svn

Create SVN User Accounts

Once your SVN repository is created, run the commands below to create an account name admin.

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

Type a password and continue to complete the setup.

Repeat the step above to create additional users.

Restart Apache2

sudo systemctl restart apache2.service

When you’re done, open your browser, browse the repository, then log on.

http://example.com/svn/repository

That’s it! This is how to install and configure Subversion on Ubuntu. Now, you can learn how to check files and commit changes.

You may also like the post below:


Discover more from Geek Rewind

Subscribe to get the latest posts to your email.

Like this:



3 responses to “How to Install Subversion Server on Ubuntu Linux”

  1. Saravanakumar Avatar
    Saravanakumar

    Hi,
    I am new user to svn. I followed the above steps to create svn repository. It works good.

    I need to create multiple repository for varies users. help me to configure more repository.

  2. vadim Avatar
    vadim

    Thanks for right lesson.

  3. Ryan Avatar
    Ryan

    Still works!

Leave a Reply to vadimCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Discover more from Geek Rewind

Subscribe now to keep reading and get access to the full archive.

Continue reading