How to install subversion and websvn on ubuntu

This write-up contains a set of instruction on how to install and configure svn as well as setup websvn on an ubuntu 12.04 machine. 1.) I...

This write-up contains a set of instruction on how to install and configure svn as well as setup websvn on an ubuntu 12.04 machine.

1.) Install subversion and apache2
sudo apt-get install subversion
sudo apt-get install apache2
sudo apt-get install libapache2-svn

2.) Create a directory where we will install subversion repository
sudo mkdir /var/subversion

3.) Change ownership of the newly created folder
sudo chown www-data:www-data -R /var/subversion

4.) Change mode bits
sudo chmod 770
sudo chmod 770 -R /var/subversion

 5.) Create a new repository
sudo svnadmin create /var/subversion/demo

6.) Look/check at the newly create repository
sudo svnlook tree /var/subversion/demo

7.) Make the repository available to apache
sudo vi /etc/apache2/mods-available/dav_svn.conf

Add the ff:
  DAV svn
  SVNPath /var/subversion/demo
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/svn.passwd
  Require valid-user
  *take note that we are using apache's svn.passwd for authentication
 8.) Restart apache and you should be able to access the repository from the url
sudo service apache2 restart

9.) Create a new user
sudo htpasswd -c /etc/apache2/svn.passwd usera
*note make sure you remove -c parameter on 2nd invocation since it will delete the file if it exists

10.) Now you can access the repository in the url:
*If you have rapidsvn installed, you can view the same url

Now for the second part, how to install and configure websvn
1.) Install websvn (select apache2, and proceed accordingly)
sudo apt-get install websvn

2.) Move the newly installed websvn folder into /var/www
sudo cp -r /usr/share/websvn/ /var/www/

3.) Make that folder available to apache2, by editing the same file earlier dav_svn.conf, and add the below lines:
sudo vi /etc/apache2/mods-available/dav_svn.conf
<Location /websvn>
Options FollowSymLinks
order allow,deny
allow from all
AuthType Basic
AuthName "Subversion Repository"
*be careful with the spacing it's sensitive

4.) Restart apache2
sudo service apache2 restart

5.) Access from url : http://localhost/websvn, it should now be available.

6.) You can install enscript, for syntax highlighting:
sudo apt-get install enscript

7.) If you want to add more repository, just edit this file:
sudo vi /etc/websvn/ 
*by default mine has:
//please edit /etc/websvn/config.php
//or user dpkg-reconfigure websvn
$config->addRepository("root", "file:///var/subversion/demo");

And now we're done :-)


ubuntu 1480339955094976583

Post a Comment Default Comments


manish said...

I am getting following error: when i am accessing http://localhost/svn/demo


You don't have permission to access /svn/demo on this server.

Error Log
[Mon Sep 10 02:23:54 2012] [error] [client] (13)Permission denied: access to /svn/demo denied

Please take a look.Thanks in advance.

Anonymous said...

Looks like a file permission error for me, did you execute:
sudo chown www-data:www-data -R /var/subversion?

Atul said...

Nice blog ..
helps me a lot to install

Anonymous said...

Good post about how install svn. I have question about componet websvn.
If work with files for example .txt then all right. If work with files .doc then appear troubles when i want see old version document (file.doc). System offers download a zip arhive ( I try open arhive and find only files with extension .xml
How right need look old version files in the system SVN?

Anonymous said...

http://localhost/svn/demo is not working

Anonymous said...

I cannot access demo, it says Not Found. Not sure what's wrong. I did everything followed steps above. There must be missing something. Maybe some another additional apt required?

czetsuya said...

Hi, did you successfully install the demo repository?

sudo svnadmin create /var/subversion/demo