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.
SVN (Subversion) is an open-source versioning and revision control system distributed under the open-source Apache License and built by Apache Foundation Team. With SVN, one can set up a repository to maintain current and historical versions of files such as source code, documentation, and others.
This brief tutorial shows students and new users how to install and configure the SVN server on Ubuntu 16.04 | 18.04 with Apache2 HTTP server and allows users to log in, check files, and commit changes.
This post will also show you how to create user accounts to access the subversion repository after creating it.
When you’re ready, continue with the steps below:
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 be used to 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
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, then 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.
sudo systemctl restart apache2.service
When you’re done, open your browser, browse the repository, then log on.
That’s it! This is how to install and configure Subversion on Ubuntu. Now you can learn how to check in files and commit changes.
You may also like the post below: