1. MagicESP
  2. Ubuntu Server 22.04
  3. Install Subversion on Ubuntu 18.04

Install Subversion on Ubuntu 18.04

Synonyms:
  1. Subversion
  2. SVN

Setup a private subversion server for your code is important and easy.

Install apache2 with subversion support

Apache2 goes with a self-signed certificate, that is enough for a private subversion server.

sudo apt update && sudo apt -y install subversion libapache2-mod-svn apache2 apache2-utils
sudo a2enmod authz_svn
sudo a2enmod ssl
sudo a2dissite 000-default
sudo a2ensite default-ssl
sudo systemctl restart apache2

navigate the browser to your server ip will shows a certificate warning, skip the warning will shows a default apache page.

https://{{ ip.value }}/

Config apache2 website

sudo {{ texteditor.value }} /etc/apache2/sites-enabled/default-ssl.conf

add after <VirtualHost default:443>

LimitXMLRequestBody 8000000
LimitRequestBody 0
 
<Location {{ urlpath.value }}>
DAV svn
SVNParentPath {{ filepath.value }}
AuthzSVNAccessFile {{ authz_file.value }}
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile {{ passwd_file.value }}
Require valid-user
</Location>

Add SVN user name and password

# first time create 
sudo htpasswd -cm {{ passwd_file.value }} {{ svnuser.value }}
# add svn user
sudo htpasswd -m {{ passwd_file.value }} {{ svnuser.value }}
# edit this file
sudo {{ texteditor.value }} {{ passwd_file.value }}

Create SVN Repositories

sudo mkdir -p {{ filepath.value }} && sudo svnadmin create {{ filepath.value }}/{{ svnrepo.value }}
sudo chown -R www-data:www-data {{ filepath.value }}

Edit SVN Authz

sudo {{ texteditor.value }} {{ authz_file.value }}
[groups]
developers = {{ svnuser.value }}
 
[{{ svnrepo.value }}:/]
@developers = rw

Restart Apache2

sudo /etc/init.d/apache2 restart

Finished

Now, the subversion server is ready, time to checkout!

https://{{ ip.value }}{{ urlpath.value }}/{{ svnrepo.value }}

SVN Client Command

svn info
svn switch --relocate old-svn-url new-svn-url