SVN: Subversion + mod_dav_svn in custom apache

speedok

Verified User
Joined
Nov 12, 2005
Messages
14
Location
Netherlands
Aloha,

I try to get subversion and mod_dav_svn running in custombuild. With yum i install both and that seems to be fine.

Then in custombuild i placed file custom/ap2/configure.apache (copy from the base)

Next followed the instructions at http://www.directadmin.com/help/item.php?id=191 to add a module

like add line --with-mod_dav_svn and recompiled apache, sadly no luck. I also tried --with-dav_svn_module / --enable-mod_dav_svn nothing seems to work.

I must overlooked something (maybe the name isn't right?), hope someone can point me in the right direction.

Alllready thanks.
 
You got it wrong: subversion must be compiled against the Apache headers to create the mod_dav_svn module; Apache doesn't have a mod_dav_svn module itself, and you can't install subversion with yum.

  • deinstall subversion
  • set clean=no in CustomBuild's options.conf
  • recompile apache with the original configure script (delete yours), all required modules are already activated
  • download and extract the subversion source tarball
  • run "./configure --prefix=/usr --with-apxs=/usr/sbin/apxs --with-apr=/usr/bin/apr-config", "make" and "make install" in it
  • there should be a file named mod_dav_svn.so in /usr/lib/apache, and you should be able to run "svn help"
  • I use this config:
Add this to /etc/httpd/conf/extra/httpd-includes.conf:
Code:
# All SVN directives
Include conf/extra/httpd-svn.conf
Create /etc/httpd/conf/extra/httpd-svn.conf:
Code:
LoadModule dav_svn_module /usr/lib/apache/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib/apache/mod_authz_svn.so

<IfModule dav_svn_module>
<IfModule authz_svn_module>
<Location /svn>
    DAV svn
    SVNParentPath /svn

    AuthzSVNAccessFile /svn/authz
    Satisfy Any
    Require valid-user
    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile /svn/passwd
</Location>
</IfModule>
</IfModule>

The authz module will let you use advanced access config, for USVN or manual access management.
Create your repos in /svn with svnadmin.
Any repository will be accessible via http://<IP/host>/svn/<repo>.
 
Hi Tillo,

Thanks - I've got a working SVN server, thanks to you. There were a few problems along the way (I will put them at the bottom of this post) but Tillo, can you help with this one thing? *begs*

If I use SVN on the server - for example, svn co http://www.domain.com/svn/projects, I get this:
Code:
svn: Unrecognized URL scheme for 'http://www.domain.com/svn/projects'

Apparently this means something like my SVN client doesn't recognise HTTP? How do I fix this?





Finally (this isn't for you Tillo, this is for anyone else who runs in to similar problems to me!) this is the exact process I ran - it is exactly what Tillo said but a few extra things I had to do (maybe my server is different?):

Code:
snip; the stuff in my next post includes neon-devel - use that instead!
 
Last edited:
Subversion needs the Neon HTTP library to build the http handler.
Just like you had to install expat-devel (and you also could have installed sqlite-devel) look for libneon-devel or libneon27-devel (the latest).
This is written in warnings during the configure process, but unfortunately they didn't think of users that don't know what the Neon library is and what Subversion uses it for.
 
Thanks Tillo - works great! So in the end this is what I did.

Only thing is, I tried yum install sqlite-devel, but it still wanted sqlite-amalgamation? :confused:

Anyway here is the final list of what I did!

Code:
# install libexpat and libneon
yum install expat-devel
yum install neon-devel

# make a dir for your svn bits
mkdir /etc/customsvn
cd /etc/customsvn

# get svn and unpack
wget http://subversion.tigris.org/downloads/subversion-1.6.2.tar.gz
tar xzf subversion-1.6.2.tar.gz
mv subversion-1.6.2/* .
rm -r subversion-1.6.2

# get sqlite amalgamation, grab sqlite.c
mkdir sqlite-amalgamation
cd sqlite-amalgamation
wget http://www.sqlite.org/sqlite-amalgamation-3.6.13.tar.gz
tar xzf sqlite-amalgamation-3.6.13.tar.gz
mv sqlite-3.6.13/sqlite3.c .

# delete everything else
rm -rf sqlite-*
cd ..

# configure, make, install
./configure --prefix=/usr --with-apxs=/usr/sbin/apxs --with-apr=/usr/bin/apr-config
make
make install

# this should work now
svn help

# remove loadmodule from httpd.conf
nano /etc/httpd/conf/httpd.conf
  --> Add comments to these lines, we will do it in another conf:
  #LoadModule dav_svn_module     /usr/lib/apache/mod_dav_svn.so
  #LoadModule authz_svn_module   /usr/lib/apache/mod_authz_svn.so

# add an include to a new conf file
nano /etc/httpd/conf/extra/httpd-includes.conf
  --> paste Tillos config
  # All SVN directives
  Include conf/extra/httpd-svn.conf

# create the new conf file, put the loadmodules etc in here
nano /etc/httpd/conf/extra/httpd-svn.conf
  --> paste Tillos config
  LoadModule dav_svn_module /usr/lib/apache/mod_dav_svn.so
  LoadModule authz_svn_module /usr/lib/apache/mod_authz_svn.so
  
  <IfModule dav_svn_module>
  <IfModule authz_svn_module>
  <Location /svn>
      DAV svn
      SVNParentPath /svn
  
      AuthzSVNAccessFile /svn/authz
      Satisfy Any
      Require valid-user
      AuthType Basic
      AuthName "Subversion repository"
      AuthUserFile /svn/passwd
  </Location>
  </IfModule>
  </IfModule>

# restart just to make sure all is good
service httpd restart

# make an svn dir to match your config
mkdir /svn
cd /svn

# create a repo there
svnadmin create projects

# copy the authz file svnadmin made (or write your own)
# and add user to passwd file (specified in your httpd-svn config)
cp projects/conf/authz .
htpasswd -cm passwd testuser
# give testuser read/write access to all repos
nano authz
  --> Add at end of file
  [/]
  testuser = rw

# give apache ownership of svn or commit wont work!
chown -R apache:apache /svn

# finally, restart
service httpd restart

Thanks so much Tillo :) Really appreciated!
 
Excellent instructions

I followed the instructions provided and these worked great. Thanks guys. There should be a wiki with this information. Very valuable. :)
 
I followed (I think all of them, but not 100% sure anymore...) the instructions in this thread, but I keep having problems with subversion (version 1.6.3)

Installation wasn't difficult, but it doesn't work over http. For checkout, import, any operation, I only get 403 forbidden.

It is possible to view the repo using a browser though. Logging in is not the problem, that part works.

Apache is owner of the repo dir.

One thing that might be different: I put the apache config part in a virtual host file, so you can only reach the repo through this site. This is the contents of the file I include for this site:
Code:
LoadModule dav_svn_module /usr/lib/apache/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib/apache/mod_authz_svn.so

<IfModule dav_svn_module>
<IfModule authz_svn_module>
<Location /svn>
        DAV svn
        SVNParentPath /var/www/svn
        Require valid-user
        AuthType Basic
        AuthName "Subversion Repo"
        AuthUserFile /etc/svn-passwd
        AuthzSVNAccessFile /etc/svn-access
</Location>
</IfModule>
</IfModule>

This is a line from the error.log that might give some info, but I'm not sure what to do with it (removed user and domain):
client denied by server configuration: /home/[user]/domains/[domain]/public_html/svn

By the way, it is possible to do imports etc. from the command line using the file protocol, so it must be something in apache I guess.

Any help or ideas???
 
If you really are using the same hostname to connect through both the browser and the SVN client, obtaining a different result, the only thing I could think of is that you have a security module that isn't correctly configured to permit SVN commands (WebDAV and some more), like the default configuration of mod_security[12]. Same thing will occur with a reverse proxy that limits requests to HTTP-only commands.
SVN clients use GET, PROPGET and some other commands for any request (being it a checkout, import or whatever), while a browser will just use GET.

If you don't have any security module or reverse proxy, try to read more carefully the error and access logs and find any difference between the two clients requests (beside the reply codes).
 
Last edited:
If you really are using the same hostname to connect through both the browser and the SVN client, obtaining a different result, the only thing I could think of is that you have a security module that isn't correctly configured to permit SVN commands (WebDAV and some more), like the default configuration of mod_security[12]. Same thing will occur with a reverse proxy that limits requests to HTTP-only commands.
SVN clients use GET, PROPGET and some other commands for any request (being it a checkout, import or whatever), while a browser will just use GET.

If you don't have any security module or reverse proxy, try to read more carefully the error and access logs and find any difference between the two clients requests (beside the reply codes).

As far as I know there is no mod_security, but I can't check that right now. In the error log I didn't see much. The line I copied in my previous message above could be from some testing, as I don't see any other lines in error.log. In access.log I saw a bit more, but as far as I can remember, most svn requests got 207 as status code, so at least they seemed to get through?

Reverse proxy sounds like it does just what I'm experiencing, but I guess the requests then shouldn't show up in the apache access log. Is this correct?
 
I got the following error when restarting apache:
Cannot load /usr/lib/apache/mod_dav_svn.so into server: libsvn_repos-1.so.0: cannot open shared object file: No such file or directory
this can be solved with ldconfig:
Code:
> ldconfig
> service httpd restart
 
Great Howto CalamityAce
Thanks alot, that need to go into the HOWTO forum section.

I have been wanting to set this kinf of thing up... and this is the perfect help to start !

Thx
Sky
 
Hello. I have a problem after make:

Code:
/usr/bin/ld: cannot find -lexpat
collect2: ld returned 1 exit status
make: *** [subversion/svn/svn] Error 1

in this command:

Code:
cd subversion/svn && /bin/sh /etc/customsvn/libtool --tag=CC --silent --mode=link gcc  -g -O2  -g -O2 -pthread   -rpath /usr/lib -o svn  add-cmd.o blame-cmd.o cat-cmd.o changelist-cmd.o checkout-cmd.o cleanup-cmd.o commit-cmd.o conflict-callbacks.o copy-cmd.o delete-cmd.o diff-cmd.o export-cmd.o help-cmd.o import-cmd.o info-cmd.o list-cmd.o lock-cmd.o log-cmd.o main.o merge-cmd.o mergeinfo-cmd.o mkdir-cmd.o move-cmd.o notify.o propdel-cmd.o propedit-cmd.o propget-cmd.o proplist-cmd.o props.o propset-cmd.o resolve-cmd.o resolved-cmd.o revert-cmd.o status-cmd.o status.o switch-cmd.o tree-conflicts.o unlock-cmd.o update-cmd.o util.o ../../subversion/libsvn_client/libsvn_client-1.la ../../subversion/libsvn_wc/libsvn_wc-1.la ../../subversion/libsvn_ra/libsvn_ra-1.la ../../subversion/libsvn_delta/libsvn_delta-1.la ../../subversion/libsvn_diff/libsvn_diff-1.la ../../subversion/libsvn_subr/libsvn_subr-1.la /etc/httpd/lib/libaprutil-1.la     -lexpat -liconv /etc/httpd/lib/libapr-1.la -lrt -lcrypt  -lpthread -ldl

I don't know what is wrong?
 
Last edited:
svn: Version mismatch

I get this after following the process above. Granted I downloaded the current version 1.6.11. However I'm not sure why any reference to version 1.4.2 is there. I don't recall ever installing or attempting to install Subversion before. I should clarify that I get this message when trying any svn command such as svn help.

:confused:

Code:
svn: Version mismatch in 'svn_diff': found 1.4.2, expected 1.6.11
svn: Version mismatch in 'svn_delta': found 1.4.2, expected 1.6.11
svn: Version mismatch in 'svn_ra': found 1.4.2, expected 1.6.11
svn: Version mismatch in 'svn_wc': found 1.4.2, expected 1.6.11
svn: Version mismatch in 'svn_client': found 1.4.2, expected 1.6.11
svn: Version mismatch in 'svn_subr': found 1.4.2, expected 1.6.11
 
Uninstalled subversion then recompiled and it worked.

Solved!!!

As you may have guessed there was an older version of subversion already on the server. So the error made sense. The problem is that there is no make uninstall built for subversion. So I manually uninstalled.

I did this
Code:
rm -rf /usr/lib/libsvn_*
rm -rf /usr/lib64/libsvn_*
rm -rf /usr/bin/svn*

Then I went back and recompiled and all works now. Hope this helps someone else.
 
Since /usr/lib64 is used mostly by distribution packaging systems, I suggest you remove the whole subversion package (with rpm -e, dpkg -P, emerge -C etc) or you will have it automatically reinstalled one day as an upgrade.
 
Excellent info! thanks Tillo. I think that Subversion was installed when CentOS was installed as an extra package. I'll blame the datacenter even though I should have known. ;)
 
Error during httpd restart

I got the following error when restarting apache:

this can be solved with ldconfig:
Code:
> ldconfig
> service httpd restart

Hello thechronic, I've got a similar error.

I followed yours and the tillo's instructions till the command "service httpd restart"

Code:
> service httpd restart

But it returned the following error:

Code:
>Stopping httpd:                                            [  OK  ]
Starting httpd: [Sat May 29 09:53:18 2010] [warn] module php5_module is already 
loaded, skipping httpd: Syntax error on line 169 of /etc/httpd conf/httpd.conf: 
Syntax error on line 1 of /etc/httpd/conf/extra/httpd-includes.conf: Syntax error 
on line 1 of /etc/httpd/conf/extra/httpd-svn.conf: 
Cannot load /usr/lib/apache/mod_dav_svn.so into 
server: /usr/lib/libsvn_fs_base-1.so.0: undefined symbol: db_create

I've tried with command "ldconfig" but it's returning the same error.

Could you or somebody help me to solve it?

Thanks in advance!
 
You probably have some conflicting Berkeley DB libraries... recompile Subversion with --without-berkeley-db, the BDB repository type is obsolete anyway.
 
I can not seem to get my repos to work.
I removed ALL authentication for testing purpose.

Apache svn:
https://svn.netcode.nl/svn/test1/

Viewing it in browser is not a problem.

However; when I want to checkout using TortoiseSVN to my windows machine, I get: "access to '/svn/test1/!svn/vcc/default' forbidden"

apache logs:
Code:
MyIP - - [31/Dec/2010:14:57:52 +0100] "PROPFIND /svn/test1/!svn/bc/0 HTTP/1.1" 207 676 "-" "SVN/1.6.15 (r1038135)/TortoiseSVN-1.6.12.20536 neon/0.29.5"
MyIP  - - [31/Dec/2010:14:57:52 +0100] "OPTIONS /svn/test1 HTTP/1.1" 200 2470 "-" "SVN/1.6.15 (r1038135)/TortoiseSVN-1.6.12.20536 neon/0.29.5"
MyIP  - - [31/Dec/2010:14:57:52 +0100] "PROPFIND /svn/test1 HTTP/1.1" 207 676 "-" "SVN/1.6.15 (r1038135)/TortoiseSVN-1.6.12.20536 neon/0.29.5"
MyIP  - - [31/Dec/2010:14:57:52 +0100] "PROPFIND /svn/test1 HTTP/1.1" 207 676 "-" "SVN/1.6.15 (r1038135)/TortoiseSVN-1.6.12.20536 neon/0.29.5"
MyIP  - - [31/Dec/2010:14:57:52 +0100] "PROPFIND /svn/test1/!svn/vcc/default HTTP/1.1" 207 580 "-" "SVN/1.6.15 (r1038135)/TortoiseSVN-1.6.12.20536 neon/0.29.5"
MyIP  - - [31/Dec/2010:14:57:52 +0100] "PROPFIND /svn/test1/!svn/bln/0 HTTP/1.1" 207 596 "-" "SVN/1.6.15 (r1038135)/TortoiseSVN-1.6.12.20536 neon/0.29.5"
MyIP  - - [31/Dec/2010:14:57:52 +0100] "PROPFIND /svn/test1 HTTP/1.1" 207 676 "-" "SVN/1.6.15 (r1038135)/TortoiseSVN-1.6.12.20536 neon/0.29.5"
MyIP  - - [31/Dec/2010:14:57:52 +0100] "PROPFIND /svn/test1/!svn/vcc/default HTTP/1.1" 207 580 "-" "SVN/1.6.15 (r1038135)/TortoiseSVN-1.6.12.20536 neon/0.29.5"
MyIP  - - [31/Dec/2010:14:57:52 +0100] "PROPFIND /svn/test1/!svn/bln/0 HTTP/1.1" 207 596 "-" "SVN/1.6.15 (r1038135)/TortoiseSVN-1.6.12.20536 neon/0.29.5"
MyIP  - - [31/Dec/2010:14:57:52 +0100] "REPORT /svn/test1/!svn/vcc/default HTTP/1.1" 404 634 "-" "SVN/1.6.15 (r1038135)/TortoiseSVN-1.6.12.20536 neon/0.29.5"

I see error codes I did not even know they existed ^-^
 
Back
Top