Notice:
 
 


Install SVN with Web Access on Ubuntu

Posted By: Eric Lin
Category: Linux - Ubuntu
Tags: feisty , gutsy , subversion , svn , ubuntu
Posted Date: 2007-01-06 11:04 AM
No of Comments: 18
Clicks: 13830
For future reference, I have copied the article from How To Geek website.

This article covers installing subversion with the apache module so that it can be easily accessed from other systems on a public network. If you want a more secure svn server, you could use svnserve+ssh, which isn't covered in this article.

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 /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 gedit /etc/apache2/mods-enabled/dav_svn.conf


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

<Location /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 /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� probably best to leave it at the default.

# 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>


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.

Example:

sudo htpasswd2 -cm /etc/apache2/dav_svn.passwd firedog
New password:
Re-type new password:
Adding password for user firedog


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:



You now have a working subversion server!

I have followed the above tutorial and installed SVN server on my home Ubuntu computer without problems. Hopefully this article can help someone else who needs help.



  Michael on 2007-01-26 @ 05:43 AM says:  
Worked for me! :-)
  Wilfredo Sanchez on 2007-01-31 @ 03:29 PM says:  
Can you send me more information How install and configure SVN server with web access. Thanks.
  lordt on 2007-01-31 @ 11:59 PM says:  
Perfect!
  dms on 2007-02-12 @ 10:10 PM says:  
GREAT THX 4 reposting!!!
  Ozren on 2007-02-20 @ 09:05 AM says:  
Done that, but bla.mysite.bla/svn shows "The page cannot be found". Restarted lampp also - same thing. What am I missing?
  Mike Templaton on 2007-02-23 @ 04:21 AM says:  
Very great tutorial. It works for me. Thanks a lot

http://www.adanoo.com
  Brad on 2007-02-27 @ 11:52 PM says:  
This look interesting, but I've never used Subversion before (though I do understand the concept of a revision control system). What do I do on the "Revision 0: /" page hostname/svn/) to start committing things to the repository?

http://augmentedfourth.blogspot.com
  Eric on 2007-02-28 @ 10:00 AM says:  
You can't commit things to the repository from the "Revision 0: /" page, you can only browse the files in the browser. And you have to commit files from command line or have a GUI version of subversion installed, similar to the WinCVS software. Does this help?

http://www.edreaminghome.com
  Brad on 2007-02-28 @ 04:25 PM says:  
Ah, I see. I guess I'll just have to hunker down and read man pages for a while before I can figure it all out... Thanks!

http://augmentedfourth.blogspot.com
  Oliver Cronk on 2007-05-31 @ 08:03 AM says:  
Brad you might want to look at TortoiseSVN if you want to work with the repository easily from Windows.

http://blog.cronky.net
  Anderson on 2007-04-05 @ 12:25 PM says:  
I have tested using Ubuntu Server 7.04 Beta... it works perfect! Thank you A LOT !!!
  lineman60 on 2007-04-26 @ 01:57 PM says:  
The SVN walk thugh was greate, Thank you. However now i am looking for how to use it with my current IDE
  Diego on 2007-05-12 @ 07:38 PM says:  
Perfecto segui los pasos y todo anduve bien, pero configure al svn server con la opcion "Require valid-user" y anda bien, pero luego de un tiempo no me reconoce el usuario y la contraseña, alguna idea sobre el problema ? Muchas gracias

www.wbsoluitons.com.ar
  Eybye on 2008-02-17 @ 02:59 PM says:  
Worked for me on Ubuntu server 7.10. Thanks a lot!
  Timbo on 2008-02-24 @ 12:55 AM says:  
Nice post: I had it working in minutes on debian 4.0 with clean install from net install iso and apt.
  Adam on 2008-04-24 @ 06:45 AM says:  
htpasswd2 has been renamed to htpasswd on Ubuntu.

http://link-to-me.org
  Deniz on 2008-09-25 @ 11:20 PM says:  
You should mention that # should be uncommented at the end of the dav_svn.config file :)
  Eric Lin on 2008-09-28 @ 03:36 AM says:  
Thanks for your comment on my blog, but I don't recall that I have to uncomment the # at the end of the config file, at least it wasn't the case for gusty and feisty, I am not sure about hardy though.

http://www.ecodereviewer.com

Leave Your Comment

Please fill in your details and comment below.

What are the LAST THREE CHARACTERS you saw above?