Apache Subversion (SVN) is a version control system that helps teams manage files and code versions. To secure your SVN server, you can use HTTPS with a free Let's Encrypt SSL certificate. In this guide, we will walk you through the process of setting up Apache Subversion with HTTPS using Let's Encrypt on CentOS 8. Whether you're using a Windows VPS UK or another server provider, this setup will help secure your version control system.
Prerequisites
Before you begin, ensure you have the following:
- A CentOS 8 server, which could be hosted on a UK Windows VPS, Windows Virtual Private Servers, or another Windows VPS Hosting UK solution.
- Root or sudo privileges on your server.
- A domain name pointed to your server’s IP address.
Step 1: Update Your System
Before installing any software, ensure your system is up to date:
sudo dnf update -y
Step 2: Install Apache and Subversion
Install Apache HTTP Server and Subversion on CentOS 8:
sudo dnf install httpd subversion mod_dav_svn -y
After installation, start and enable Apache to start on boot:
sudo systemctl start httpd
sudo systemctl enable httpd
Step 3: Configure Apache for Subversion
Next, create a new directory for your SVN repository:
sudo mkdir /var/www/svn
Create a new SVN repository:
sudo svnadmin create /var/www/svn/myrepo
Set the appropriate permissions for the repository:
sudo chown -R apache:apache /var/www/svn/myrepo
Edit the Apache configuration to enable SVN:
sudo nano /etc/httpd/conf.d/subversion.conf
Add the following configuration:
<Location /svn>
DAV svn
SVNParentPath /var/www/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/svn-auth-users
Require valid-user
</Location>
Create an authentication file and add a user:
sudo htpasswd -cm /etc/svn-auth-users svnuser
You will be prompted to enter a password for the user.
Restart Apache to apply the changes:
sudo systemctl restart httpd
Step 4: Install Certbot and Obtain an SSL Certificate
To secure your SVN repository with HTTPS, you can use Let's Encrypt. First, install Certbot:
sudo dnf install certbot python3-certbot-apache -y
Obtain an SSL certificate for your domain:
sudo certbot --apache -d your-domain.com -d www.your-domain.com
Certbot will automatically configure Apache to use SSL. After the process is complete, Certbot will automatically set up a cron job to renew the SSL certificate.
Step 5: Test Apache Subversion with HTTPS
Once everything is set up, open your web browser and navigate to https://your-domain.com/svn/myrepo
. You will be prompted to enter the credentials you created for the SVN user. If everything is configured correctly, you should see the Subversion repository page over HTTPS.
Conclusion
By following these steps, you have successfully set up Apache Subversion with HTTPS using Let's Encrypt on CentOS 8. Whether you are using a Windows VPS UK, Windows VPS Italy, or another Windows Virtual Private Server Hosting solution, this setup ensures your version control system is secure and reliable.