First start off by installing Apache:
sudo apt-get install apache2
Enter the root password and follow the instructions. Check that is it installed correctly by going to http://localhost
and checking that you see the standard Apache "It works!" message. Then install subversion and the subversion Apache module:
sudo apt-get install subversion libapache2-svn
Then create a directory to store repositories in:
sudo mkdir /var/svn/
sudo mkdir /var/svn/repositories
and create a test repository:
sudo svnadmin create /var/svn/repositories/test
So that Apache can read and write the repository its user (www-data
) needs to be given ownership of it:
sudo chown -R www-data:www-data /var/svn/repositories/test
To be able to authenticate users who access the repository a password file is needed:
sudo htpasswd -c /etc/subversion/passwd paul
Enter a password for the user paul
. For additional users repeat the command without the -c
option to make sure the existing file is appended to rather than replaced.
Then edit the Apache config file:
sudo gedit /etc/apache2/apache2.conf
Add the following to the end of the file:
#svn users
<Location /svn>
DAV svn
SVNParentPath /var/svn/repositories/
SVNListParentPath On
AuthType Basic
AuthName "Test"
AuthUserFile /etc/subversion/passwd
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
Save the config file and restart Apache:
sudo /etc/init.d/apache2 restart
The Test repository can now be accessed via
http://localhost/svn/test
For the error: "svn: attempt to write a readonly database"
ReplyDeletesudo chown -R www-data:www-data /var/svn/repositories/test
chmod -R g+w /var/svn/repositories/test
Via: http://idolinux.blogspot.com/2010/05/subversion-svn-group-permissions.html
Perfect.
ReplyDeleteVery good article, objective and enlightening.
Thank you.
Really nice article. SVN up and running in no time. Thanks dude.
ReplyDelete