Install Subversion on Ubuntu 18.04
Synonyms:
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
$[ip]$
navigate the browser to your server ip will shows a certificate warning, skip the warning will shows a default apache page.
https://$ip$/
Config apache2 website
$[texteditor]$
$[urlpath]$
$[filepath]$
$[authz_file]$
$[passwd_file]$
sudo $texteditor$ /etc/apache2/sites-enabled/default-ssl.conf
add after <VirtualHost default:443>
LimitXMLRequestBody 8000000
LimitRequestBody 0
<Location $urlpath$>
DAV svn
SVNParentPath $filepath$
AuthzSVNAccessFile $authz_file$
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile $passwd_file$
Require valid-user
</Location>
Add SVN user name and password
$[svnuser]$
# first time create
sudo htpasswd -cm $passwd_file$ $svnuser$
# add svn user
sudo htpasswd -m $passwd_file$ $svnuser$
# edit this file
sudo $texteditor$ $passwd_file$
Create SVN Repositories
$[svnrepo]$
sudo mkdir -p $filepath$ && sudo svnadmin create $filepath$/$svnrepo$
sudo chown -R www-data:www-data $filepath$
Edit SVN Authz
sudo $texteditor$ $authz_file$
[groups]
developers = $svnuser$
[$svnrepo$:/]
@developers = rw
Restart Apache2
sudo /etc/init.d/apache2 restart
Finished
Now, the subversion server is ready, time to checkout!
https://$ip$$urlpath$/$svnrepo$
SVN Client Command
svn info
svn switch --relocate old-svn-url new-svn-url