Atlantic.Net Blog

How to Install Apache Subversion on Ubuntu 18.04

Hitesh Jethva
by Atlantic.Net (64posts) under VPS Hosting
0 Comments

Apache Subversion is an open-source version control system that stores previous versions of and changes to your files and directories. This will allow you to recover your older versions of files when you need it. You can also track the repository and identify who made specific changes.

Subversion is very similar to Git with the key difference that Git is a distributed version control system while SVN is a centralized version control system. Subversion has a single central repository that makes it easier for you to maintain a top-down approach to control.

In this tutorial, we will show you how to install and configure Apache Subversion on Ubuntu 18.04.

Prerequisites

  • A fresh Ubuntu 18.04 VPS on the Atlantic.Net Cloud Platform.
  • A valid domain name pointed to your IP address.
  • A static IP address configured on your server.

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server.  Create a new server, choosing Ubuntu 18.04 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged into your Ubuntu 18.04 server, run the following command to update your base system with the latest available packages.

apt-get update -y

Step 2 – Install Apache Subversion

Before starting, Apache webserver must be installed on your server. If not installed, you can install it with the following command:

apt-get install apache2 apache2-utils -y

Once the installation has been completed, you can install the Subversion with the following command:

apt-get install subversion libapache2-mod-svn -y

After installing Apache Subversion, you will need to enable some SVN modules. You can enable them with the following command:

a2enmod dav
a2enmod dav_svn
a2enmod authz_svn

Once all the modules are enabled, restart the Apache service to implement the changes:

systemctl restart apache2

At this point, Apache Subversion is installed. You can now proceed to create your first repository.

Step 3 – Create the Subversion Repository

In this section, we will create the Subversion repository and create a user to access this repository.

First, create a directory for Subversion:

mkdir /svn

Next, create a repository named atlanticrepo inside the /svn directory:

svnadmin create /svn/atlanticrepo

Once the repository is created, change the ownership of the repository to www-data:

chown -R www-data:www-data /svn/atlanticrepo
chmod -R 775 /svn/atlanticrepo

Next, create a new Subversion user with the following command:

htpasswd -cm /etc/svn-user atlantic

Provide your desired password, as shown below:

New password:
Re-type new password:
Adding password for user atlantic

Step 4 – Configure Apache for Subversion

Next, you will need to create an Apache virtual host file to access Apache Subversion through a web browser.

You can create it with the following command:

nano /etc/apache2/sites-available/svn.conf

Add the following lines:

<VirtualHost *:80>
        ServerName svn.example.com
        <Location /svn>
     DAV svn
     SVNParentPath /svn
     AuthType Basic
     AuthName "Subversion Repository"
     AuthUserFile /etc/svn-user
     Require valid-user
</Location>
    ErrorLog ${APACHE_LOG_DIR}/svn-error.log
    CustomLog ${APACHE_LOG_DIR}/svn-access.log combined
</VirtualHost>

Save and close the file when you are finished. Then, restart the Apache service to implement the changes:

systemctl restart apache2

Step 5 – Access Apache Subversion

Now, open your web browser and type the URL http://svn.example.com/svn/atlanticrepo. You should see the following page:

Now, provide your username, password and click on the OK button. You should see your created repository in the following screen:

Step 6 – Test Subversion

In this section, we will install the Subversion client in the remote system, check out the repository from the Subversion server, create some files and directories, and add them to the Subversion repository.

Go to the remote system and install Subversion with the following command:

apt-get install subversion -y

Once installed, create a directory for the local repository with the following command:

mkdir atlantic

Next, check out the atlanticrepo repository from the Subversion server to the local repository with the following command:

svn checkout http://svn.example.com/svn/atlanticrepo --username atlantic atlantic/

You will be asked to provide a password for the user “atlantic” as shown below:

Authentication realm: <http://svn.example.com:80> Subversion Repository
Password for 'atlantic': *****

Checked out revision 0.

Next, change the directory to the atlantic repository and create some files and directories:

cd atlantic
touch file1.txt file2.txt
mkdir dir1 dir2

Next, add all the files and directories to the Subversion repository with the following command:

svn add file1.txt file2.txt dir1 dir2

You should see the following output:

A         file1.txt
A         file2.txt
A         dir1
A         dir2

Next, commit changes to the repository with the following command:

svn commit -m 'This is my first commit on Atlantic SVN server'

You should see the following output:

Adding         dir1
Adding         dir2
Adding         file1.txt
Adding         file2.txt
Transmitting file data ..
Committed revision 1.

Now, open your web browser and access your repository using the URL http://svn.example.com/svn/atlanticrepo. You should see your newly added files and directories in the following screen:

Conclusion

Congratulations! You have successfully installed and configured an Apache Subversion server on Ubuntu 18.04. You can now keep track of all your files and folders and recover any version of your files whenever you need it. Try Apache Subversion today on an Atlantic.Net virtual private server.

Get A Free To Use Cloud VPS

Free Tier Includes:
G2.1GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G2.1GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources