Install Subversion/Apache
Subversion Configuration
Create subversion repositories:
sudo chown -R www-data:www-data /var/svn
All our subversion repositories should be located in /var/svn in order to be visible to Apache (you can change /var/svn to any directory).
SSL (Secure Sockets Layer)
The following steps are required if you need SSL, otherwise skip this chapter.
a2enmod ssl
“Listen 443″ should already exist in /etc/apache2/ports.conf, otherwise add it manually:
Create a new SSL config file (replace ssl.new.site with your preferred name):
Edit the file:
Replace:
with
Before </VirtualHost>, add:
SSLCertificateFile /etc/apache2/ssl/ssl.new.site.pem
You can try using the template from “default-ssl” instead of “default”, which is easier and more reliable since many SSL-related configurations are already handled. However, I haven’t tried this method and I’m not sure if it works without modifications.
Create SSL certificate file:
sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/ssl.new.site.pem
Enable the new site:
sudo /etc/init.d/apache2 reload
To see if the setup works, use your web browser to visit:
Replace server.ip with the ip of your server.
There should be a pop-up or an alert about the new certificate.
DAV_SVN Configuration
Edit /etc/apache2/mods-available/dav_svn.conf and follow the guidline:
Normally it looks like this:
DAV svn
SVNParentPath /var/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
SSLRequireSSL # this line must be added if you want SSL enabled
</Location>
Don’t forget to change /var/svn to your svn directory (thanks, D@vid).
Enable the mod and restart:
sudo /etc/init.d/apache2 restart
Create a user account for dav_svn:
To add more users, use:
Subversion Testing
sudo chown -R www-data:www-data /var/svn/test
svn co https://new.site/svn/test
It should says “Checked out revision 0.”, otherwise try looking for the errors on the Internet.
You probably forgot some steps or I forgot to mention some details.
Migration
Skip this chapter if you don’t need to migrate you data from your old server.
On the old server, we need to dump all updates into a single file. Each repository must be done separately.
cd svndump
sudo svnadmin dump /var/svn/repository > ./repository.dump
cd ..
tar zcvf svndump.tgz svndump
scp svndump.tgz username@new.server.ip:./
Those dump files must be applied on the new system’s repositories.
cd /var/svn/repository
sudo svnadmin create repository-name
sudo svnadmin load repository-name < ~/svndump/repository.dump
sudo chown -R www-data:www-data /var/svn/*
Congratulations, all your source code has been migrated!
19 Comments
Like this theme, nice one.
Yes! Thank U so much. Super Tutorial. Works fine for me.
You’re welcome. I’m glad that you like it
Really usefull.
Thank you.
Excellent, best guide out there! Thanks a million
Thanks fo this great tutorial, I have my first SVN server running…
Very good, saved me a lot of time, thanks!!
Very nice tutorial !
Many thanks to you guys for the responses!
Hello , I followed that tutorial but unfortunately I get a “403 Forbidden error PROPFIND”. does anyone got the same ?
Thanks
That could be a permission error. Try `sudo chown -R www-data:www-data /var/svn/*`
Nice tutorial, exactly what I need.
But I got an error:
when I try to checkout I got this message:
svn: Could not open the requested SVN filesystem
Does anyone have an idea ?
thanks
I found the problem….
I forgot to change a line in the default dav_svn conf:
I had
SVNParentPath /var/lib/svn
instead of
SVNParentPath /var/svn
Hi D@vid, thanks for the comments. I have updated the post in case other readers would have the same problem.
Just Perfect!!! really nice…
How can I protect create files for specific users I mean restrict files…
Thanks in advance.
A brief guideline should be available in /etc/apache2/mods-available/dav_svn.conf
For more explanation, try this.
Hello,
i Have the same error than D@v1d but my config file looks like good.
I have the good path for my SVNParentPath
if i try with my firefox with this adress : https://ip/svn it works
I don’t understand what’s append
@manu Tha’s weird. Probably dav_svn.conf or the passwd file is misconfigured.
Thank you..
tutorial works for Debian Squeeze too..
One Trackback
[...] Pré-requisitos: subversion previamente instalado e um repositório já criado, caso precise de um guia para a instalação e criação dos repositórios no SVN recomendo este tutorial: http://longspine.com/how-to/install-apachesubversion-on-debian-lenny-and-migrate-the-repositories/ [...]