One week ago I spend a few hours to install subversion on Debian Squeeze. It is short guide that contain what it necessary to do. Follow the guide.
1. Install Apache and PHP
apt-get install apache2
apt-get install libapache2-mod-php5
2. Install subversion
apt-get install subversion
apt-get install libapache2-svn
3. Configure SVN repository with name ‘repos‘
mkdir /var/svn
svnadmin create --fs-type fsfs /var/svn/repos
4. Assign repository folder to apache user
chown -R www-data:www-data /var/svn/*
chmod -R 770 /var/svn/*
5. Edit ‘/etc/apache2/mods-available/dav_svn.conf’ and input this code
<Location /svn>
DAV svn
SVNParentPath /var/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/svn.passwd
Require valid-user
SSLRequireSSL
</Location>
6. Activate SSL and the DAV modules on Apache
a2enmod ssl
a2enmod dav
a2enmod dav_svn
7. Create users account for SVN
htpasswd -c /etc/apache2/svn.passwd user1
htpasswd /etc/apache2/svn.passwd user2
Pleas note that -c switch you use first time only, because passwd file don’t exist.
8. Generate self-signed certificate for HTTPS connection
openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/svn.pem -keyout /etc/apache2/ssl/svn.key
9. Change the permission on the certificate
chmod 600 /etc/apache2/ssl/svn.pem
chmod 600 /etc/apache2/ssl/svn.key
10. Edit ‘/etc/apache2/sites-available/default-ssl’ and input/modifi this code
<VirtualHost *:443>
ServerAdmin admin@server.name
ServerName your.server.name
DocumentRoot /var/www
<Directory /var/www>
Options -Indexes FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error_ssl.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/svn.pem
SSLCertificateKeyFile /etc/apache2/ssl/svn.key
</VirtualHost>
11.Enable your site
a2ensite default-ssl
apache2ctl restart
12. Test your svn repository
You can test your repository through this url https://<your_domain_or_ip>/svn/repos, than you should be asked to type your svn user login and password
13. Install Websvn (optiona web manager of repository content)
apt-get install enscript
apt-get install websvn
After, the configuration dialog appears
select apache2 (unselect all other options)
type in the location of the parent folder of your repositories
To force connection through SSL for WenSVN /etc/websvn/apache.conf and following code between <Directory> …. </Directory> tags.
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2.svn.passwd
Require valid-user
14. Disable to show the complete server token for Apache
In /etc/apache2/conf.d/security change ServerTokens parameter from OS to Prod. Should be like this.
ServerTokens Prod
Sources: blog.mattsch.com, www.reviewingit.com, www.howtoforge.com