administration mode
Pssst...Ferdy is the creator of JungleDragon, an awesome wildlife community. Visit JungleDragon

 

Article: Installing SubVersion on FC 4 »

FERDY CHRISTANT - APR 1, 2006 (02:46:24 PM)

Introduction

A while ago I complained about the incredibly painful process of trying to install SubVersion on my Suse 9.3 Linux setup. A process that I failed to complete. I still have not given up installing SubVersion though, I really want my source code and other important files to be version managed conveniently. Therefore, in my ignorant persistence, I decided to go for a different distribution (Fedora Core 4) and give it a try there. Fedora seems to have a much larger community, therefore i expected the troubleshooting to be much easier. Although still not a very intuitive process, I now have SubVersion working on Fedora Core 4. This article will describe my installation log.

Prerequisites

For this article I'm assuming you have a working installation of Fedora Core 4, including the Apache web server. If you need any help getting to this point, this is a very extensive tutorial. In addition, I have also configured Samba, to enable remote Windows access to my code, but this is not a requirement for this tutorial.

Installation

In all honesty, this article is largely based on this tutorial. However, working through it myself, I found some things can be done better, some steps I did not have to do at all, and some steps simply did not work the way I expected. This article is my interpretation of the tutorial, which works for me.

As I said, installing SubVersion really is not a simple process. In fact it is, integrating it with Apache is what makes it hard, or not intuitive to say the least. I got it working using the following set of steps:

  1. Install SubVersion

    Run the following command in the terminal to start the graphical package manager:
    system-config-packages
    Next, scroll down to "Development Tools" and click on "Details". From the list, select "SubVersion", close the dialog and click on "Update". Fedora will ask you to insert the media that contains the packages.
     
  2. Install mod_dav_svn

    mod_dav_svn is the package that is needed for SubVersion to use the DAV feature of the Apache web server. Install it by running the following command:
    yum install mod_dav_svn
    Yum may ask you a few dependency questions. Always enter "Y" to confirm. When this process completes successfully, SubVersion is installed. You can test this by running "svnadmin" from the terminal.
     
  3. Setting up directories

    SubVersion needs a directory structure to hold repositories, users and permissions. We like to have these all in a convenient place for easy administration. Use the command line to create the following directories:
    mkdir /svn
    mkdir /svn/repos
    mkdir /svn/users
    mkdir /svn/permissions

    Apache will need access to these directories, so issue the following command to recursively set the user id and group:
    chown -R apache.apache /svn
  4. Link Apache to SubVersion directories

    It is now time to tell the Apache web server where it can find the SubVersion repositories. For this we need to include a location tag in the file "/etc/httpd/subversion.conf", which was automatically created when we installed the SubVersion packages. There are ways to link Apache to a repository, by repository location, or by parent path location. Since we would like the ability to have multiple repositories (without having to edit the config files for each new one), let's use the parent path scenario. Add the following lines to the "subversion.conf" file:
    <Location /svn/repos>
    DAV svn
    # any "/svn/repos/foo" URL will map to a repository /svn/repos/foo
    SVNParentPath /svn/repos
    </Location>

    Save the config file and restart the Apache server:
    service httpd reload
  5. Creating our first repository

    We now have the basic configuration work done. Create a first test repository, and allow Apache to access it:
    svnadmin create /svn/repos/test
    chown -R apache.apache /svn/repos/test

    To test our basic installation, try to access "http://yourhostname/svn/repos/test/" in your browser. It should return you a revision number of the test repository.
     
  6. Securing the repositories

    While our current setup is working, anonymous version management is quite useless. Let's first prevent unauthorized users from accessing the online repositories. For this we first need to create a HTTP user:
    htpasswd -cb /svn/users/passwords username password
    Replace "username" and "password" with your desired username and password. I personally matched this with the account I use for Samba access, but you are free to choose. Next, we need to tell Apache where our HTTP users file is. Add the following lines between the location tags of the "subversion.conf" file we edited earlier:
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /svn/users/passwords
    Require valid-user

    Save the config file and restart the Apache server:
    service httpd reload
    To test our secured installation, try to access "http://yourhostname/svn/repos/test/" in your browser. It should now require you to log in. Use the username and password that you used when we created the HTTP user.
     
  7. Repository authorizations

    The last step is to define who is allowed to do what in the repositories. For this I'm following a very simple scenario, where a single user is allowed to read and write repositories. First, create a new file " /svn/permissions/svnauthz.conf", and insert the following lines:
    [/] fchristant = rw

    Save the file. Our last step is to tell Apache where to find the authorizations file. Add the following line between the location tags of the "subversion.conf" file we edited earlier:
    AuthzSVNAccessFile /svn/permissions/svnauthz.conf
    Save the config file and restart the Apache server:
    service httpd reload
     
  8. Roundup

    As a final check, here is the complete "subversion.conf" file:
    LoadModule dav_svn_module modules/mod_dav_svn.so
    LoadModule authz_svn_module modules/mod_authz_svn.so

    <Location /svn/repos>
    DAV svn
    # any "/svn/foo" URL will map to a repository /svn/repos/foo
    SVNParentPath /svn/repos
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /svn/users/passwords
    Require valid-user
    AuthzSVNAccessFile /svn/permissions/svnauthz.conf
    </Location>

Next steps

This completes the installation log for SubVersion. Note that this only covers the basics of SubVersion configuration. Here are some ideas for useful extensions:

  • Repository browsing. SubVersion allows for very limited online repository browsing. SubVersion extensions have much more features, such as the ability to browse all revisions and online file difference comparisons.
     
  • PHP integration. The ability to talk to SubVersion from a PHP script. One particular item of interest is being able to create new repositories using a web form.
     
  • Commit automation. SubVersion allows you to program certain events, such as post-commit. This allows for automated tasks to be executed each time a user commits a change to the repository. A simple example is sending out an email about the new revision. A more advanced example is doing an automated code review on the new code.

Share |

Comments: 34
Reviews: 12
Average rating: rating
Highest rating: 5
Lowest rating: 4

COMMENT: BEN COLLINS-SUSSMAN emailhomepage

MAY 4, 02:42:04 AM

comment » Psst: "Subversion" has no camel caps. It's "Subversion", not "SubVersion". ;-) «

COMMENT: RAMON TAYAG email

MAY 4, 02:52:18 AM

comment » Hi, good tutorial! I installed it on FC5, so I changed a few things. However, one part where I got stuck was #7.

[/] fchristant = rw should be two lines:

[/]

fchristant = rw

I found out asking in #svn in freenode :p

Thanks again, excellent tute! «

COMMENT: BEN COLLINS-SUSSMAN emailhomepage

MAY 4, 02:52:21 AM

comment » Oops! One more error. The authz file should be *two* lines:

[/]

username = rw

But somehow I think your blog stylesheet is messing up the display, it's showing up as a single line. That's already caused one of your readers a bunch of "403 authorization denied" errors until I spotted the fix. «

COMMENT: MIKE

JUN 13, 02:56:03 AM

comment » I don't have a subversion.conf file. When I try to create one with the Locate tag, I get parse errors on service httpd reload. Any thoughts? Thanks! «

COMMENT: MICHAEL SCHULZE

JUN 16, 02:05:18 PM

comment » Is there a possibility to use ldap(users and groups) instead of AuthUserFile?

Thanks! «

COMMENT: MICHAEL SCHULZE

JUN 19, 05:38:24 PM

comment » I have it.

If you need it, try the following in

/etc/httpd/conf.d/subversion.conf

DAV svn

SVNParentPath /misc/svn/repos

# Require SSL connection for password protection.

SSLRequireSSL

# Authentification

AuthType Basic

AuthName LDAP-Authentifizierung

AuthLDAPAuthoritative on

AuthLDAPEnabled on

# URL of LDAP-Server

AuthLDAPURL ldap://server-name/dc=XXX,dc=XXX?uid

AuthLDAPGroupAttribute memberUid

AuthLDAPGroupAttributeIsDN off

require group cn=svn,ou=group,dc=XXX,dc=XXX

#require valid-user

Substitute the XXX and server-name with your own server-name and the LDAP-Values.

Greets Michael «

COMMENT: RAMON TAYAG

JUL 15, 07:40:14 AM

comment » Hmm.. not I have a problem! I went to the page, and it asked for a username and password. Let's say I typed the wrong password, just to make my point. Then I got a 403 forbidden access error and I can't seem to get the browser to bring up the username and password auth box anymore.

Is it supposed to be like that? Make an error then you can't logon from that computer anymore?

Thanks «

COMMENT: RAMON TAYAG

JUL 15, 07:40:50 AM

comment » *now I have a problem «

COMMENT: SÉLIM BICHARA rating

JUL 18, 07:05:27 AM

comment » Very useful. Thank you «

COMMENT: RICHARD DALE homepage

JUL 27, 11:25:38 PM

comment » Note that on my FC4 system, the subversion.conf was located in /etc/httpd/conf.d/subversion.conf not /etc/httpd/subversion.conf «

COMMENT: KOKUL email

AUG 14, 11:07:18 AM

comment » I installed and configured apache using the above tutorial... But when i try to access it gives authentication failed....29

I'm using RHEL4 not Fedora...

Plz help me....

Thanks in advance

Kokul «

COMMENT: SNIFRO email

SEP 5, 04:05:05 PM

comment » I'm having trouble getting LDAP authentication to work at all. I get a 403 error without even getting prompted for username and password. Can anyone give an example /etc/httpd/conf.d/subversion.conf file? IS there any other file I have to edit? «

COMMENT: ARVIN homepagerating

SEP 7, 05:06:26 PM

comment » very very thnks!

you save my life!!! 01 «

COMMENT: CHANDRASEKHAR emailhomepagerating

NOV 14, 06:35:26 AM

comment » Hi to all,

I installed subversion and configured repository. Now, I am getting problem in my address bar I entered "http://www.test.com/svn/repos/". I got auth window and I entered my username and password after that I facing a problem

" Forbidden

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

Apache/2.2.0 (Fedora) Server at www.test.com Port 80" «

COMMENT: HSTAN rating

NOV 16, 02:16:16 AM

comment » Hi,

Just a word of reminder. For those who use encounter problem with Fedora in commit.

Try to set off the SELinux to check is this causing the problem....by

setenforce 0

If setting to "0" help....then type

chcon -R -h -t httpd_sys_content_t

setenforce 1

change only the to your actual path

try to commit again, remember to set it back by changing "0" to "1"

good luck. «

COMMENT: SCOTT SHU email

NOV 16, 上午 04:41:43

comment » Very good and useful document. Thanks! 01 «

COMMENT: MOHD FAIZAL email

FEB 13, 10:35:44 AM

comment » i have install the subversion on my FC5. i have successfully install the subversion and it running.

But there is some error when i want to checkout from the http.

the error are:

svn: PROPFIND request failed on '/svn/repos/test'

svn: PROPFIND of '/svn/repos/test': 403 Forbidden (http://192.168.42.245)

i have follow the username error on the previous post. «

COMMENT: HAKAN

MAR 13, 08:37:45 PM

comment » Works great on FC6. Thanks. «

COMMENT: J Y TRAYNOR emailrating

MAR 23, 04:51:23 PM

comment » Cheers

Much obliged the tutorial was very clear and precise.

Didn't encounter any problems

Thanks again 27 «

COMMENT: ANDRE emailrating

MAY 14, 01:41:46 AM

comment » The article was good, but the comments made it awesome. Thanks to all! 12 «

COMMENT: SUBHANJAN emailrating

MAY 25, 10:37:11 AM

comment » Hi,

My username and passwords are not being accepted giving Authorization Required errors.I am using RHEL 4.

Any helps.

With Regards.

Subhanjan «

COMMENT: LOAN email

MAY 30, 10:23:05 AM

comment » Please, help me!

i have done to set up subversion, now it run, but i don't add repository into svn server? because it

This is my command:

# svn mkdir http://rdserver/svn/repos/newdir -m "initial import"

Next

It request authentication for root in subversion, i enter my password, result not login beacause password it not true! «

COMMENT: VARMA rating

OCT 6, 03:25:52 PM

comment » Great tutorial really helped me a lot

01 «

COMMENT: PAUL

DEC 27, 08:18:55 PM

comment » This walk through worked great on FC6 as well. «

COMMENT: GREG rating

DEC 27, 08:20:22 PM

comment » This worked perfectly. And, you are correct, finding good material on this topic is greatest challenge «

COMMENT: RIP CHASER rating

DEC 27, 11:17:43 PM

comment » Worked great except that in needed to add lines:

LoadModule dav_module modules/mod_dav.so

LoadModule dav_svn_module modules/mod_dav_svn.so

LoadModule authz_svn_module modules/mod_authz_svn.so

to my httpd.conf file. They were not statically linked on my system. These 'includes' were needed for authorization of user for specific repositories. «

COMMENT: VIJAY emailhomepage

FEB 24, 2008 - 02:59:02 PM

comment » plz help

i am not able to create new repostroy repostery ( i am not aware with svn )

do anybody help me

how to create repostery and how to secure them «

COMMENT: FERDY

FEB 25, 2008 - 11:20:21 AM

comment » hi Vijay, just do a Google on the svnadmin command. «

COMMENT: PHANIKIRAN rating

APR 25, 2008 - 05:00:07 AM

comment » Excellent doc «

COMMENT: BUDDHA email

SEP 13, 2008 - 10:46:22 PM

comment » Thanks! I setup my path up differently. When I go http://localhost/svn/repos file is not found. Maybe Im missing something? 03 «

COMMENT: MAHBUB emailhomepage

JUN 21, 2009 - 08:17:58 AM

comment » Great article. Works fine in CentOS 5 18 «

COMMENT: LINUX

FEB 9, 2010 - 09:47:24 AM

comment » Really this is better for all Linux World

Thanks a lot

Be continue

RElly «

COMMENT: SARVESH emailhomepagerating

MAY 29, 2010 - 12:40:43 PM

comment » Hi

I opened that link but it give me an error after accepting the user name & password

http://example.com/svn/repos/myproject/

Error is

Forbidden

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

08 29 «

COMMENT: SRINU

JAN 21, 2011 - 07:08:30 AM

comment » hi sir

when i restarting httpd

then it says

DAV not allowed here

plz help me «

RATE THIS CONTENT (OPTIONAL)
Was this document useful to you?
 
rating Awesome
rating Good
rating Average
rating Poor
rating Useless
CREATE A NEW COMMENT
required field
required field HTML is not allowed. Hyperlinks will automatically be converted.