Home Craft Using the Subversion Version Control System on a Server

Using the Subversion Version Control System on a Server

by Staff
0 comment

Subversion is an open-source version tracking system. It keeps files in a central repository and provides version control over directories or files. As a developer, you can pull project files from a repository, make changes to them, and push them back again.

Subversion also has a server component that you can use to host your projects. It works much like an ordinary file server.

How to Install Subversion

Subversion is straightforward to install. You can use the appropriate command for your distro to begin:

sudo apt install subversion apache2 libapache2-mod-svn

sudo dnf install subversion apache2 mod_dav_svn

Note that this command also installs the Apache2 web server. You’ll need a web server if you want to access the Subversion repository via HTTP or WebDAV. You can also use HTTPS, you’ll just need to install and configure a digital certificate to do so.

Once you’ve run this command, you can check that subversion installed correctly. You should now be able to run the svn command and you can see the current version using the –version option:

Server Configuration With Subversion

If the installation went smoothly, you can now begin working on the repository configuration that you’ll use with svn. Of course, you’ll need to create a new repository for this. First, create a folder in a root directory to place your repository:

sudo mkdir /subversion

If you need to access your repository using WebDAV over HTTP, you’ll need to give Apache ownership of its directory. Since Apache uses www-data user by default, authorize this user as follows:

sudo chown www-data:www-data /subversion

You can now switch to the www-data user and start working on your repository. The command you would use to log in as the www-data user is:

sudo su -s /bin/bash www-data

You are now an Apache user and after this step, you can create your Subversion repository as follows:

svnadmin create /subversion/myrepo

You now have a Subversion repository. To make this repository a little more secure and to identify its users, the next step is to create a user and set a password for it. To do this, use the following command:

htpasswd -cmb /subversion/passwd myadmin mypass

According to this command, your username will be myadmin and your password will be mypass. You can change these values to whatever is appropriate for your circumstances.

Your Subversion repository is now ready to use. At this stage, you can exit the www-data user by using the exit command.

Now you can send a desired project or file to your repo using the command below:

sudo svn import <your-project-address> file:///subversion/myrepo -m "First Commit"

This command uses the import parameter to push everything in your project folder to your Subversion repository. While doing this, you need to add the commit message with the -m parameter.

Using Access Methods in Subversion

You may have noticed that you are using the file:// protocol to add a project to your repository. This is just one of several network protocols you can use to access an svn repository. You can also use the WebDAV protocol over HTTP or HTTPS, or subversion’s custom svn protocol.

Direct Access to the Repository

As you’ve seen, you can use the file:// protocol to access a local repository. Here’s how you can checkout a local repo to your current directory:

svn co file:

When you check out the repo, svn displays a list of the files it contains:

Accessing Using WebDAV

To integrate your Subversion repository with Apache, you’ll need to configure some settings.

For the first step, activate the dav, dav_svn, and dav_fs modules using the following commands:

sudo a2enmod dav dav_fs dav_svn

After activating the required modules, you can now edit the /etc/apache2/mods-enabled/dav_svn.conf file. Create the file if it doesn’t already exist, and change its contents as follows:

<Location /subversion>
DAV svn
SVNPath /subversion/myrepo
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /subversion/passwd
Require valid-user

The AuthUserFile setting references the file that you created earlier using htpasswd. Adding it here will grant repository access to all users named in the file, provided they authenticate with a valid password.

Once you’ve created and saved this file, restart the Apache2 service with the following command:

sudo systemctl restart apache2.service

Now, when you open a web browser and go to http://localhost/subversion/, you’ll see the contents of your repository. When you go to this address, it will ask for your username and password:

Login with the username (e.g. myadmin) and password (mypass) that you set up earlier. You can access your Subversion repository using WebDAV after entering the username and password:

Accessing With SSL and WebDAV

The https:// protocol has almost the same configuration as the http:// protocol, with just a few important differences. To give an example, the .conf file you need to use during configuration is different. You also need to install a digital certificate. Because as you know, this is the working logic of the SSL encryption method.

You can create a digital certificate yourself, or you can install one issued by a competent authority. Assuming you have installed a digital certificate, what you need to do is simple.

The difference in this step is the changes you will make in the configuration file. Below is a sample configuration file for SSL and WebDAV usage:

<Location /subversion>
Options None
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /subversion/passwd
Require valid-user

As you can see, the difference between https:// and http:// protocols is not that much in terms of changes in the configuration file. After these changes, you’ll need to restart the apache2 service. Run systemctl restart apache2.service to do so.

Why Use Subversion?

As a version tracker, Subversion remembers every change made to files and directories. It lets you access old versions of software or documents you’re working with and find their differences. This makes it easier to manage projects, especially if your development team is large or distributed.

There are many version control systems for Linux aside from Subversion, which you may want to consider.

Read the full article here

SaleBestseller No. 1
Apple AirPods Max Wireless Over-Ear Headphones. Active Noise Cancelling, Transparency Mode, Spatial Audio, Digital Crown for Volume Control. Bluetooth Headphones for iPhone - Green
Apple AirPods Max Wireless Over-Ear Headphones. Active Noise Cancelling, Transparency Mode, Spatial Audio, Digital Crown for Volume Control. Bluetooth Headphones for iPhone - Green
 Apple-designed dynamic driver provides high-fidelity audio; Active Noise Cancellation blocks outside noise, so you can immerse yourself in music
SaleBestseller No. 3
Apple iPad Air 2, 64 GB, Space Gray (Renewed)
Apple iPad Air 2, 64 GB, Space Gray (Renewed)
Apple iOS 8; 9.7-Inch Retina Display; 2048x1536 Resolution; A8X Chip with 64-bit Architecture; M8 Motion Coprocessor
SaleBestseller No. 4
2021 Apple 10.2-inch iPad (Wi-Fi, 64GB) - Silver
2021 Apple 10.2-inch iPad (Wi-Fi, 64GB) - Silver
Gorgeous 10.2-inch Retina display with True Tone; A13 Bionic chip with Neural Engine; 8MP Wide back camera, 12MP Ultra Wide front camera with Center Stage
Bestseller No. 5
2022 Apple TV 4K Wi‑Fi with 64GB Storage (3rd Generation)
2022 Apple TV 4K Wi‑Fi with 64GB Storage (3rd Generation)
4K Dolby Vision and HDR10+ for vivid picture quality; Dolby Atmos for three-dimensional, theater-like sound
Bestseller No. 7
Apple AirTag 4 Pack
Apple AirTag 4 Pack
Keep track of and find your items alongside friends and devices in the Find My app; Simple one-tap setup instantly connects AirTag with your iPhone or iPad
Bestseller No. 8
Apple MacBook Air with Intel Core i5, 1.6GHz, (13-inch, 4GB,128GB SSD) - Silver (Renewed)
Apple MacBook Air with Intel Core i5, 1.6GHz, (13-inch, 4GB,128GB SSD) - Silver (Renewed)
1.6 GHz dual-core Intel Core i5 (Turbo Boost up to 2.7 GHz) with 3 MB shared L3 cache; 13.3-Inch (diagonal) LED-backlit Glossy Widescreen Display, 1440 x 900 resolution
Bestseller No. 9
Apple Of My Eye
Apple Of My Eye
Amazon Prime Video (Video on Demand); Amy Smart, Burt Reynolds, Liam McIntyre (Actors); Castille Landon (Director) - Castille Landon (Writer) - Dori A. Rath (Producer)
SaleBestseller No. 10
Apple 35W Dual USB-C Port Compact Power Adapter ​​​​​​​
Apple 35W Dual USB-C Port Compact Power Adapter ​​​​​​​
The compact size and folding prongs make it easy to pack and store.; Charging cable sold separately.

You may also like

Leave a Comment

Iman Hearts is one of the biggest lifestyle news and articles portals, we provide the latest news and articles about family, lifestyle, entertainment, and many more, follow us to get the latest news about what matters to you.


© 2022 Iman Hearts. All rights reserved. Sitemap