Pedro Rainho

The important thing is never to stop questioning
posts - 118, comments - 55, trackbacks - 19

Install Subversion and WebSvn on Ubuntu Server

On my last post I wrote about Ubuntu server and Webmin and why I changed WHS with Ubuntu server. Today I'm going to write about Subversion and WebSVN on Ubuntu server. One of the things that I had in WHS was a source control where I stored my code and documents. For that I used VisualSVN. VisualSVN combines Subversion with a web interface of all repositories and also includes user management. To me VisualSVN is the all in one...Veryyy goood product and unfortunately for me VisualSVN is just for Windows :(.

So one of the things I did before move to Ubuntu Server was backup my Subversion repositories so I could restore them on Ubuntu Server.

In Ubuntu Server I had to do install a few packages and do a few steps in order to once again have source control and a web interface. So today I'm going to explain how to install Subversion and WebSVN on Ubuntu server.

The first thing to do is install Subversion and apache package for Subversion. All I need to do is:

sudo aptitude install subversion libapache2-svn

In the next step I need to create a directory where my repositories will be stored. In my case /var/sourcecontrol/svn/. The default location is /var/lib/svn/.

This command will create de directory where all my repositories will be:

sudo mkdir /var/sourcecontrol/svn

After create the directory I copied my entire repository backup from windows into this directory.

Note if I need to create new repositories I just had to do:

sudo svnadmin create /var/sourcecontrol/svn/newRepository

newRepository is the name of the new repository.

Next I need to change the owner of the files in order to access using apache. This can be done with this command:

sudo chown www-data:www-data  /var/sourcecontrol/svn/repositoryName -R

repositoryName is the name of the repository.

Next I just need to configure all my repositories to be access in apache. This can be done by editing the file /etc/apache2/mods-available/dav_svn.conf

To edit I just run the command:

sudo nano /etc/apache2/mods-available/dav_svn.conf

Scroll all the way down and add the following code for each repository:

<Location /repositoryName>   
DAV svn
SVNPath /var/sourcecontrol/svn/repositoryName
AuthType Basic
AuthName "Subversion repository repositoryName"
</Location>

Next restart the apache :

sudo /etc/init.d/apache2 restart

Open a browser and type http://[serverip]/repositoryName and the repository is now availably in browser.

Notice the /repositoryName in the location is the same as /repositoryName in the url.

After this step you can start doing some checkin's :P

The next step is to install WebSVN. WebSVN is a very good web interface to see all repositories.

The first thing to do is install the package. This can be done with the command:

sudo aptitude install websvn

To have syntax highlight in the source code just install enscript . This can be done with this command:

sudo aptitude install enscript

Now a few things you should know:

During the install of WebSVN three screens will appear:
1 - Select the webserver for configuration.
2 - Specify the path of the subversion repositories, in this case (/var/sourcecontrol/svn).
3 - If all repositories are in the same parent folder leave this in blank otherwise you will have to specify all repositories separated by comma.

The package WebSVN is installed into /usr/share/websvn/, it's necessary to copy to /var/www/. This can be done with the command:

sudo cp -r /usr/share/websvn/ /var/www/

After copy to /var/www it's necessary to edit the file /etc/apache2/mods-available/dav_svn.conf, again with the command:

sudo nano /etc/apache2/mods-available/dav_svn.conf

Next, scroll down and add the following

<Location /websvn/>
Options FollowSymLinks
order allow,deny
allow from all
AuthType Basic
AuthName "Subversion Repository"   
</Location>

Save the file and restart apache by doing:

sudo /etc/init.d/apache2 restart

Now just type http://[serverip]/websvn and you will see the WebSVN page and your repositories.

If for some reason your repositories have strange names in just edit the file /etc/websvn/svn_deb_conf.inc with the command :

sudo nano /etc/websvn/svn_deb_conf.inc

In this file you will have something like this:

<?php
// please edit /etc/websvn/config.php
// or use dpkg-reconfigure websvn
$config->parentPath("/var/sourcecontrol/svn/");
$config->addRepository("repositoryName\", file:///var/sourcecontrol/svn/repositoryName1);
$config->addRepository("repositoryName", "file:///var/sourcecontrol/svn/repositoryName2");
$config->setEnscriptPath("/usr/bin");
$config->setSedPath("/bin");
$config->useEnscript();
?>

Here it's possible specify the parent path of all repositories and specify each repository name and location. it's here also that it's specified the path on enscript installed before.

 

Hope you enjoy the source control and as much as I do :)

 

Special Thanks for Guerrix and his post on how to install subversion and websvn.

Print | posted on Saturday, February 06, 2010 7:07 PM

Feedback

# Jason&#8217;s Computer Science Blog - &raquo; Some Useful Information for Setting Up Subversion on Ubuntu

Jason&#8217;s Computer Science Blog - &raquo; Some Useful Information for Setting Up Subversion on Ubuntu
3/7/2011 8:25 AM |

# Some Useful Information for Setting Up Subversion on Ubuntu | Computer Networking Degree

Some Useful Information for Setting Up Subversion on Ubuntu | Computer Networking Degree
3/8/2011 7:13 AM |

# Installing WebSVN on Ubuntu &#8211; craigdodd.co.uk

Installing WebSVN on Ubuntu &#8211; craigdodd.co.uk
2/10/2012 5:15 AM |

# Tips For All

Tips For All
2/25/2012 2:12 PM |

Post Comment

Title  
Name  
Email
Url
Comment   

Powered by: