Subversion : subversion on ubuntu

by toy

So, I have just created my googlecode project. And I have to deal with subversion which is quite new for me. Anyway, basically, this topic I will present how to create your own repository in ubuntu. I recommended this book which is very good for anyone who is new to subversion.

Note : I am using ubuntu 8.04. This version is different from the others that it uses htpasswd instead of htpasswd2.

Step 1, install subversion

COMMAND
$ sudo apt-get install subversion

Step 2, install Apache2. I’m using this server to use WEBDAV and because it’s a very extensible web server.

COMMAND
$ sudo apt-get install apache2 libapache2-svn

Step 3, make your own repository locally

COMMAND
$ sudo mkdir -p /var/local/svn <– This is your repository
$ sudo svnadmin create –fs-type fsfs /var/local/svn <– Bind it to subversion
$ sudo chown -R www-data:www-data /var/local/svn <– Change permission

Step 4, Set configuration for apache2 subversion module. This step, you have to re-configure your apache. It’s a xml-like config file.

COMMAND
sudo gedit /etc/apache2/mods-enabled/dav_svn.conf

Modified the file to look like this. Everything you need to know about this file is in the file itself. Just for one thing. If you plan to use multiple repositories use SVNParentPath. But If you have only one repository use SVNPath instead

/etc/apache2/mods-enabled/dav_svn.conf
<Location /svn>
DAV svn
SVNParentPath /var/local/svn
</Location>

Step 5, You have two choices. One is Basic authentication, and SSL access.
In this topic I use Basic authentication. So, modified the same file dav_svn.conf

/etc/apache2/mods-enabled/dav_svn.conf
<Location /svn>
DAV svn
SVNParentPath /var/local/svn
AuthType Basic <– for basic authentication
AuthName “Subversion Repository” <– name
AuthUserFile /etc/apache2/dav_svn.passwd <– password file
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>

Step 6, Create user and password

COMMAND
& sudo htpasswd -cm /etc/apache2/dav_svn.passwd ${yours username}

Step 7, Reload the setting

COMMAND
$ sudo /etc/init.d/apache2 reload

So, now you should be able to access your repository via http://127.0.0.1/svn/${yours repository}
if you want to change your server name. just edit the file /etc/hosts

Reference : http://ubuntuforums.org/showthread.php?t=187739