How-To: Set up SVN with Apache2 in Linux (Ubuntu)
Initially I didn’t plan on writing anything up about this, since its pretty basic to setup. But I ran into a slight problem, which I imagine others might run into also. I guess most would have Apache running already, so all that is needed is SVN:
> apt-get install subversion libapache2-svn
Say you have a domain already set up, call it abc.com. You want to be able to checkout a repository from abc.com/svn.
Open the following file (/etc/apache2/mods-available/dav_svn.conf) in an editor and follow the instructions. In the most basic form (with no authentication) you’ll have something like this when your done:
< Location /abc.com/svn >
DAV svn
SVNPath /svn
< /Location>
Inside the < Location /abc.com/svn > that path must point to a directory in your web server which does NOT exist. abc.com will exist, but make sure svn doesn’t. The SVNPath will point to the actual repository which MUST be outside your web server space.
This way, if you go to a browser and type: http://www.abc.com/svn nothing will show up, but when you checkout your repository, you will be re-directed to the actual svn directory (in this case /svn).
Now create the SVN repository, in directory /svn
> svnadmin create /svn
Be sure to change the permissions on this directory, so the web server can write to the folder:
> chown -R www-data /svn
Restart Apache2:
> /etc/init.d/apache2 -k restart
Now from a remote computer, you should be able to type:
svn co http://xxx.xxx.xxx.xx/abc.com/svn < name >
(were xxx.xxx.xxx.xxx is your server ip and name is what you want to call the local folder)


September 4th, 2006 at 7:35 pm
Thanks for this how-to, it just came in handy!
-Sam.
September 12th, 2006 at 3:01 am
great how-to. but does this level of configuration ask for authentication?
October 20th, 2006 at 9:10 am
Yo George. This was useful..i didnt know the svn repo had to be outside the webserver. Working great now with authentication :)
November 28th, 2007 at 11:09 am
Nice howto, short and simple.
Thanks for sharing.
May 29th, 2008 at 3:02 am
to add password requirement to do commits..
DAV svn
SVNPath /svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
and in console:
create the password file
rm -f /etc/apache2/dav_svn.passwd
add username and password for some 1 (useing temar as example)
htpasswd2 -c /etc/apache2/dav_svn.passwd temar
it will ask for password after u enter that :D
enjoy
February 3rd, 2009 at 1:55 pm
Hi, i just completed my svn installation but i’m not able to browse my project. e.g. svn co http://localhost/svn/myproject gives me doesn’t exist. Where am i going wrong ?
April 3rd, 2009 at 8:35 am
Hi, I have installed svn 1.5.4 on unix server. I want to create repository on UNIX server and client on windows. How can I achieve this? Please help me.
April 6th, 2009 at 1:41 pm
So now you need to get a client going. I use http://tortoisesvn.tigris.org
April 13th, 2009 at 7:31 pm
Note: ” htpasswd2 -c /etc/apache2/dav_svn.passwd temar ” changed a little while ago slightly. If htpasswd2 does not work, try htpasswd instead:
thus: htpasswd -c /etc/apache2/dav_svn.passwd temar
November 20th, 2009 at 7:58 am
I have followed the steps properly. My problem is about authentication user to access svn
I created a user say test as
htpasswd -cm /etc/apache2/dav_svn.passwd test
Then I open the svn :
http://xxx.xxx.xxx.xx/svn
I got the login interface. When I try login with USER-ID (test) & correct password
I get the message:
You don’t have permission to access /svn/testKRA on this server.
Can you plz help me what is wrong with my installation process..