SVN repository on Ubuntu 16.04

From Luniwiki
Jump to: navigation, search

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/
<VirtualHost *:80>
   RewriteEngine On
   RewriteRule (.*){REQUEST_URI}

<VirtualHost *:443> ServerName Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;" DocumentRoot "/var/www/" SSLEngine on SSLCertificateFile /etc/apache2/ssl/ SSLCertificateKeyFile /etc/apache2/ssl/ 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/"> 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

Enabling site
To activate the new configuration, you need to run:
 service apache2 reload

Restart apache

systemctl restart apache2


Daniel Simao (talk) 14:40, 16 September 2018 (EDT)