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:
- 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.
- 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.
- 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
- 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
-
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.
- 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.
- 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
- 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.




Comments: 34
Reviews: 12
Average rating:
Highest rating: 5
Lowest rating: 4
COMMENT: BEN COLLINS-SUSSMAN

MAY 4, 02:42:04 AM
COMMENT: RAMON TAYAG
MAY 4, 02:52:18 AM
[/] 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

MAY 4, 02:52:21 AM
[/]
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: MICHAEL SCHULZE
JUN 16, 02:05:18 PM
Thanks! «
COMMENT: MICHAEL SCHULZE
JUN 19, 05:38:24 PM
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
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: SÉLIM BICHARA
JUL 18, 07:05:27 AM
COMMENT: RICHARD DALE
JUL 27, 11:25:38 PM
COMMENT: KOKUL
AUG 14, 11:07:18 AM
I'm using RHEL4 not Fedora...
Plz help me....
Thanks in advance
Kokul «
COMMENT: SNIFRO
SEP 5, 04:05:05 PM
COMMENT: ARVIN

SEP 7, 05:06:26 PM
you save my life!!!
«
COMMENT: CHANDRASEKHAR


NOV 14, 06:35:26 AM
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
NOV 16, 02:16:16 AM
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
NOV 16, 上午 04:41:43
COMMENT: MOHD FAIZAL
FEB 13, 10:35:44 AM
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: J Y TRAYNOR

MAR 23, 04:51:23 PM
Much obliged the tutorial was very clear and precise.
Didn't encounter any problems
Thanks again
«
COMMENT: ANDRE

MAY 14, 01:41:46 AM
COMMENT: SUBHANJAN

MAY 25, 10:37:11 AM
My username and passwords are not being accepted giving Authorization Required errors.I am using RHEL 4.
Any helps.
With Regards.
Subhanjan «
COMMENT: LOAN
MAY 30, 10:23:05 AM
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
OCT 6, 03:25:52 PM
COMMENT: PAUL
DEC 27, 08:18:55 PM
COMMENT: GREG
DEC 27, 08:20:22 PM
COMMENT: RIP CHASER
DEC 27, 11:17:43 PM
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

FEB 24, 2008 - 02:59:02 PM
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: PHANIKIRAN
APR 25, 2008 - 05:00:07 AM
COMMENT: BUDDHA
SEP 13, 2008 - 10:46:22 PM
COMMENT: MAHBUB

JUN 21, 2009 - 08:17:58 AM
COMMENT: LINUX
FEB 9, 2010 - 09:47:24 AM
Thanks a lot
Be continue
RElly «
COMMENT: SARVESH


MAY 29, 2010 - 12:40:43 PM
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.
COMMENT: SRINU
JAN 21, 2011 - 07:08:30 AM
when i restarting httpd
then it says
DAV not allowed here
plz help me «