Setting up Subversion server using Apache in Debian/Ubuntu
So you start managing your codes/data/fill-in-the-blanks-here using Subversion. You create the repository and share it using NFS or Windows file sharing. But you needed something more sophisticated, like a repository server. Of course Subversion itself already come with built-in server. But that means adding a new daemon and a new port opened. You already have Apache web server in your intranet server. Why don't you use it?
I'll assume you already have Apache 2 installed. First you must install the Subversion along with it's module for Apache:
$ sudo apt-get install subversion libapache2-svn
First you must setup your base of repository. I put it in /opt/svn/repos but you can put it anywhere you like but /dev/null. Create your first repository:
$ sudo svnadmin create /opt/svn/repos/myproject
Make sure the owner of all the files and directories in /opt/svn/repos is www-data so can be accessed by Apache. You can do this by issuing this command:
$ sudo chown -R www-data: /opt/svn/repos
Edit the file /etc/apache2/mods-available/dav_svn.conf:
<Location /svn>
DAV svn
SVNParentPath /opt/svn/repos/
AuthType Basic
AuthName "My Repository"
AuthUserFile /opt/svn/passwd
Require valid-user
</Location>
Create your username and password to access the repository:
$ sudo htpasswd -c /opt/svn/passwd foo
Next time if you want to add more users just type this command (the same command but omit the -c option):
$ sudo htpasswd /opt/svn/passwd bar
And then we enable some Apache modules including Subversion:
$ sudo a2enmod dav dav_fs dav_svn
Finally, restart your Apache server:
$ sudo /etc/init.d/apache2 force-reload
You can test accessing your repository server by accessing the URL from your client's browser. I'll assume your server address is 192.168.0.1. You can browse to http://192.168.0.1/svn/myproject. The browser will ask for your username and password. If nothing goes wrong, you will see empty folder. Now you are ready to access your repository directly from your Subversion client!















nice...