In this article, we want to teach you How To Install and Configure an SVN Server on AlmaLinux 8.
Subversion (SVN) is a free/open-source version control system. It manages files and directories, and the changes made to them, over time.
This allows you to recover older versions of your data or examine the history of how your data changed. In this regard, many people think of a version control system as a sort of “time machine.”
How To Install and Configure an SVN Server on AlmaLinux 8
Before you start to install subversion on AlmaLinux 8, you need to log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow our article the Initial Server Setup with AlmaLinux 8.
Now follow the steps below to Set up an SVN server on AlmaLinux 8.
Set up SVN on AlmaLinux 8
First, you need to update your local package index with the following command:
sudo dnf update
Then, install the Epel release repository on AlmaLinux 8 with the command below:
sudo dnf install epel-release
Now you can use the following command to install SVN on your server:
sudo dnf install subversion mod_dav_svn
Configure SVN on AlmaLinux 8
The SVN module package will create an Apache configuration file. You need to make some configuration changes to it. Open the file with your favorite text editor, here we use vi:
sudo vi /etc/httpd/conf.d/subversion.conf
Add the following contents to the file:
<Location /svn> DAV svn SVNParentPath /var/www/svn AuthType Basic AuthName "Apache SVN Repositories" AuthUserFile /etc/svn/svn-auth Require valid-user </Location>
When you are done, save and close the file.
Next, you need to create SVN directories on AlmaLinux 8 with the command below:
sudo mkdir /var/www/svn /etc/svn/
Switch to the directory with the following command:
At this point, you can create an SVN repository with the following command, here we named it myrepo, you can choose your own name:
sudo svnadmin create myrepo
Then, set the correct permissions for it:
sudo chown -R apache.apache myrepo
Here you need to create an SVN HTTP access authentication file on AlmaLinux 8 with the command below:
sudo touch /etc/svn/svn-auth
Add your first SVN user in the SVN authentication file, here we named it orca:
sudo htpasswd -cm /etc/svn/svn-auth orca
In your output you will see:
Output New password: Re-type new password: Adding password for user orca
You can add more SVN users on AlmaLinux 8 with the command below:
sudo htpasswd -m /etc/svn/svn-auth user
Now set the correct permissions for the SVN authentication file with the following commands:
$ sudo chown root:apache /etc/svn/svn-auth $ sudo chmod 640 /etc/svn/svn-auth
Next, you need to enable and restart your httpd service with the following commands:
$ sudo systemctl enable --now httpd $ sudo systemctl restart httpd
We assumed that you have enabled firewalld at the beginning of the article. Now you need to open the HTTP port through the firewall with the command below:
sudo firewall-cmd --add-service=http --permanent
Then, reload the firewall to apply the new rules:
sudo firewall-cmd --reload
Access SVN Repository
At this point, you can access the SVN repo by typing your server’s IP address in your web browser followed by /svn/myrepo:
You should enter your username and password that you have defined before to access the SVN repo.
At this point, you learn to set up and Configure an SVN server on AlmaLinux 8.
Hope you enjoy using it.
Maybe you have interested in these articles: