SVN repository on Ubuntu 16.04
Contents
Software installation
apt install subversion apache2 libapache2-svn
Subversion group creation
addgroup subversion adduser www-data subversion
Create repository
cd /opt/repositories mkdir svn cd svn mkdir luniel svnadmin create /opt/repositories/svn/luniel/ chown -R www-data:subversion luniel/ chmod -R g+rwx luniel/
Apache configuration
cat /etc/apache2/sites-available/20_svn.luniel.com.conf <VirtualHost *:80> ServerName svn.luniel.com RewriteEngine On RewriteRule (.*) https://svn.luniel.com%{REQUEST_URI} </VirtualHost>
<VirtualHost *:443> ServerName svn.luniel.com Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;" DocumentRoot "/var/www/svn.luniel.com" SSLEngine on SSLCertificateFile /etc/apache2/ssl/rigel.oamis.net.cer SSLCertificateKeyFile /etc/apache2/ssl/rigel.oamis.net.key SSLCACertificateFile /etc/apache2/ssl/ca.cer <Location / > DAV svn SVNParentPath /opt/repositories/svn SVNListParentPath On AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/subversion/passwd Require valid-user LimitXMLRequestBody 0 </Location> <Directory "/var/www/svn.luniel.com"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined CustomLog /var/log/apache2/access_svn.luniel.com_ssl.log combined ErrorLog /var/log/apache2/error_svn.luniel.com_ssl.log </VirtualHost>
Users creation
htpasswd -c /etc/subversion/passwd user1 htpasswd /etc/subversion/passwd user2 htpasswd /etc/subversion/passwd user2 ...
Enable site
a2ensite 20_svn.luniel.com Enabling site 20_svn.luniel.com. To activate the new configuration, you need to run: service apache2 reload
Restart apache
systemctl restart apache2
References
Daniel Simao (talk) 14:40, 16 September 2018 (EDT)