Los Techies : Blogs about software and anything tech!

Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server


This article covers installing subversion with the apache module so that it can be easily accessed from other systems on a public network.  The next post will show how to set this up with svn+ssh, which is considered more secure.
To install subversion, open a terminal and run the following command:

sudo apt-get install subversion libapache2-svn

We're going to create the subversion repository in /svn, although you should choose a location that has a good amount of space.

sudo svnadmin create /home/svn

Next we'll need to edit the configuration file for the subversion webdav module. You can use a different editor if you'd like.

sudo vim /etc/apache2/mods-enabled/dav_svn.conf

The Location element in the configuration file dictates the root directory where subversion will be accessible from, for instance: http://www.server.com/svn

<Location /home/svn>

The DAV line needs to be uncommented to enable the dav module

#Uncomment this to enable the repository
DAV svn

The SVNPath line should be set to the same place your created the repository with the svnadmin command.

#Set this to the path to your repository
SVNPath /home/svn

The next section will let you turn on authentication. This is just basic authentication, so don't consider it extremely secure. The password file will be located where the AuthUserFile setting sets it to

#Uncomment the following 3 lines to enable Basic Authentication
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd

To create a user on the repository use, the following command:

sudo htpasswd2 -cm /etc/apache2/dav_svn.passwd <username>

UPDATE: If using newer version of apache-utils, use the following (Thanks Ian - comment below)

sudo htpasswd -cm /etc/apache2/dav_svn.passwd <username>

Note that you should only use the -c option the FIRST time that you create a user. After that you will only want to use the -m option, which specifies MD5 encryption of the password, but doesn't recreate the file.

Restart apache by running the following command:

sudo /etc/init.d/apache2 restart

Now if you go in your browser to http://www.server.com/svn, you should see that the repository is enabled for anonymous read access, but commit access will require a username.


If you want to force all users to authenticate even for read access, add the following line right below the AuthUserFile line from above. Restart apache after changing this line.

Require valid-user

Now if you refresh your browser, you'll be prompted for your credentials.
Welcome to the stability of Linux.
Welcome to the best source control system out there.

Kick It on DotNetKicks.com
Posted May 01 2007, 07:53 PM by Jason Meridth
Filed under: ,

Comments

maarten wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 05-08-2007 5:21 AM

Thanks for the information! An extra hint: don't forget to uncomment the closing tag

</Location> at the end of the file /etc/apache2/mods-enabled/dav_svn.conf

that corresponds to the opening tag <Location /home/svn>

Nexact wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 05-11-2007 4:49 PM

Great Howto.

poroimes wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 05-15-2007 8:55 AM

And if you want to access your repository from http://www.server.com/svn, change "<Location /home/svn>" => "<Location /svn>"

poromies wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 05-15-2007 9:21 AM

I noticed one more thing...

If you want your repository to be authenticated remember to uncomment following lines from /etc/apache2/mods-enabled/dav_svn.conf too

<LimitExcept GET PROPFIND OPTIONS REPORT>

Require valid-user

</LimitExcept>

Jason Meridth wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 05-15-2007 9:31 AM

Thanks for the input everyone.  I don't claim to be an expert.  All input is welcome.

Shahryar Ghazi wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 06-27-2007 1:05 PM

is accessing the repository through dav secure??

Instala????o do Subversion no Ubuntu 7.04 - Feisty Fawn « Beyond Click wrote Instala????o do Subversion no Ubuntu 7.04 - Feisty Fawn &laquo; Beyond Click
on 08-08-2007 7:51 AM

Pingback from  Instala????o do Subversion no Ubuntu 7.04 - Feisty Fawn &laquo; Beyond Click

Ian wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 08-19-2007 10:57 AM

Just to clarify - the line

sudo htpasswd2 -cm /etc/apache2/dav_svn.passwd <username>

should be

sudo htpasswd -cm /etc/apache2/dav_svn.passwd <username>

in newer versions of apache2-utils

UWeyeguy wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 09-17-2007 10:35 AM

All I get is:

Revision 0: /

Powered by Subversion version 1.4.3 (r23084).

Russ wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 09-20-2007 10:05 PM

Me too.  All I'm getting is

Revision 0: /

Powered by Subversion version 1.4.3 (r23084).

Jason Meridth wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 09-21-2007 6:23 AM

Hopefully you were prompted for security (username/password).  If not, please check your security setup again.

Usually when you see that it means your subversion install was complete.  Now start using the subversion command line operations to interact with your repsitory.  

Look here for more operations information:

http://svnbook.red-bean.com/en/1.1/ch09.html">svnbook.red-bean.com/.../ch09.html

The excellent resource out there:

http://svnbook.red-bean.com/

schambers wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 09-21-2007 10:10 AM

Here's another link that has some more information on setting up Trac for project management on Ubuntu and some other stuff.

ariejan.net/.../how-to-setup-a-ubuntu-development-server-part-1

Good post Jason!

I actually am running subversion at work on a VMWare Ubuntu server. At home I have a stand alone box that is running it with a self-signed SSL certificate because I can access it over the web

schambers wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 09-21-2007 11:08 AM

Whoops!

Wrong link. the one about Trac is part two:

ariejan.net/.../how-to-setup-a-ubuntu-development-server-part-2

Instala????o do Subversion no Ubuntu 7.04 - Feisty Fawn « Rog??rio [rs] wrote Instala????o do Subversion no Ubuntu 7.04 - Feisty Fawn &laquo; Rog??rio [rs]
on 09-29-2007 9:56 AM

Pingback from  Instala????o do Subversion no Ubuntu 7.04 - Feisty Fawn &laquo; Rog??rio [rs]

JDS wrote re: Installing Subversion on Ubuntu 7.04 (Feisty Fawn) Server
on 02-07-2008 12:59 PM

If all you get is "Revision 0: /" then the thing, including Apache/WEBDAV SVN part, is working.

However, there is nothing in your repository yet!

A VERY IMPORTANT STEP: Immediately after creating a repository, import data into the repo.

Follow the steps in the RedBean book, mentioned in other comments.

Daily Digest for 2008-09-02 | Pedro Trindade wrote Daily Digest for 2008-09-02 | Pedro Trindade
on 09-03-2008 2:58 AM

Pingback from  Daily Digest for 2008-09-02 | Pedro Trindade

Daily Digest for 2008-09-02 | Pedro Trindade wrote Daily Digest for 2008-09-02 | Pedro Trindade
on 09-03-2008 3:08 AM

Pingback from  Daily Digest for 2008-09-02 | Pedro Trindade

Pedro Trindade » Blog Archive » Daily Digest for 2008-09-02 wrote Pedro Trindade &raquo; Blog Archive &raquo; Daily Digest for 2008-09-02
on 09-03-2008 5:46 AM

Pingback from  Pedro Trindade  &raquo; Blog Archive   &raquo; Daily Digest for 2008-09-02

Pedro Trindade » Blog Archive » Daily Digest for 2008-09-02 wrote Pedro Trindade &raquo; Blog Archive &raquo; Daily Digest for 2008-09-02
on 09-03-2008 5:52 AM

Pingback from  Pedro Trindade  &raquo; Blog Archive   &raquo; Daily Digest for 2008-09-02

Copyright Los Techies 2008, 2009. All rights reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems