Apache Subversion (SVN) is a version control system that helps manage files and code changes efficiently. Securing your SVN repository with SSL is essential for protecting data during transmission. In this guide, we will show you how to set up Apache Subversion with a Let's Encrypt SSL certificate on Ubuntu 22. Whether you're using a Windows VPS UK or another hosting provider, this setup will ensure your SVN repository is secure and easy to manage.

Prerequisites

Before starting, ensure you have the following:

Step 1: Update Your System

Before installing any packages, ensure your system is up to date:

sudo apt update && sudo apt upgrade -y

Step 2: Install Apache and Subversion

Install Apache HTTP Server and Subversion by running the following commands:

sudo apt install apache2 subversion libapache2-mod-svn -y

Once the installation is complete, start and enable Apache to run at boot:

sudo systemctl start apache2
sudo systemctl enable apache2

Step 3: Create an SVN Repository

Create a new directory to store your SVN repository:

sudo mkdir -p /var/www/svn/myrepo

Initialize the repository:

sudo svnadmin create /var/www/svn/myrepo

Set the appropriate permissions for the repository:

sudo chown -R www-data:www-data /var/www/svn/myrepo

Step 4: Configure Apache for Subversion

Edit the Apache configuration file to configure Subversion:

sudo nano /etc/apache2/sites-available/svn.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. After creating the user, enable the site and restart Apache:

sudo a2ensite svn.conf
sudo systemctl restart apache2

Step 5: Install Certbot and Obtain SSL Certificate

To secure your SVN repository with HTTPS, you can use Let's Encrypt. First, install Certbot:

sudo apt install certbot python3-certbot-apache -y

Obtain an SSL certificate for your domain:

sudo certbot --apache -d your-domain.com

Follow the prompts to complete the SSL setup. Certbot will automatically configure Apache to use the SSL certificate. After the process is complete, Certbot will also set up a cron job to automatically renew the certificate.

Step 6: Test the SVN Repository with HTTPS

Once everything is configured, you can test your setup by opening your web browser and navigating to https://your-domain.com/svn/myrepo. You should be prompted to enter the SVN username and password you created earlier. If everything is set up correctly, you will see the Subversion repository page over HTTPS.

Conclusion

By following these steps, you have successfully set up Apache Subversion with Let's Encrypt SSL on Ubuntu 22. Whether you are using a Windows VPS UK, Windows VPS Italy, or another Windows Virtual Private Server Hosting solution, this setup ensures that your SVN repository is secure and accessible over HTTPS.

Hai trovato utile questa risposta? 0 Utenti hanno trovato utile questa risposta (0 Voti)