Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
subversion with apache2 how?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Adamal
Apprentice
Apprentice


Joined: 05 Dec 2003
Posts: 264
Location: California

PostPosted: Tue Jun 08, 2004 6:12 am    Post subject: subversion with apache2 how? Reply with quote

I am trying very hard to get subversion working with apache2 but I have no idea how to configure subversion. I've configured apache with DAV but I am getting a 403 forbidden when trying to browse to the folder.

Code:
Forbidden

You don't have permission to access /svn/ on this server.
Apache/2.0.49 (Gentoo/Linux) DAV/2 mod_ssl/2.0.49 OpenSSL/0.9.7d PHP/4.3.6 Server at [ServerName] Port 80


how do you setup subversion?
Back to top
View user's profile Send private message
Adamal
Apprentice
Apprentice


Joined: 05 Dec 2003
Posts: 264
Location: California

PostPosted: Tue Jun 08, 2004 7:32 am    Post subject: Reply with quote

Ok I've got it to work. I now can display the root directory, now how to I create folders and such. I've tried svn mkdir /var/...path to svn/newdirectory and I get the following error

Code:

root@ruggles svn # svn mkdir /var/www/localhost/htdocs/svn/project2
svn: '/var/www/localhost/htdocs/svn' is not a working copy


if I try it through the web this is what I get
Code:

root@ruggles svn # svn mkdir http://192.168.1.50/svn/project3

Log message unchanged or not specified
a)bort, c)ontinue, e)dit
c
svn: OPTIONS request failed on '/svn'
svn: OPTIONS of '/svn': 301 Moved Permanently (http://192.168.1.50)


Any help please!!!
Back to top
View user's profile Send private message
Jesore
Apprentice
Apprentice


Joined: 17 Jul 2002
Posts: 232
Location: Nürnberg Germany

PostPosted: Tue Jun 08, 2004 9:57 am    Post subject: Reply with quote

You first have to setup the repository.
Code:
svn create /path/to/repos


This generates the database. The whole directory has to be owned by the user that also runs apache. I'm a little afraid you got some parts about how subversion works wrong, it is not directory/file driven like CVS, all files are stored in a database (berkdb), so you can't create directories like you tried. After the initial DB creation, then your commands should work.

Jesore
Back to top
View user's profile Send private message
Adamal
Apprentice
Apprentice


Joined: 05 Dec 2003
Posts: 264
Location: California

PostPosted: Tue Jun 08, 2004 4:29 pm    Post subject: Reply with quote

Jesore wrote:
You first have to setup the repository.
Code:
svn create /path/to/repos


This generates the database. The whole directory has to be owned by the user that also runs apache. I'm a little afraid you got some parts about how subversion works wrong, it is not directory/file driven like CVS, all files are stored in a database (berkdb), so you can't create directories like you tried. After the initial DB creation, then your commands should work.

Jesore


Originally you are correct I created the svn as a regular folder. Here is what i have currently

in commonapache2.conf

Code:

<Location /svn/>
  DAV svn
  SVNPath /var/www/localhost/htdocs/svn/
  AuthType Basic
  AuthName "Subversion repository"
  AuthUserFile /var/lib/dav/svnusers
  Require valid-user
</Location>

<IfModule mod_dav_fs.c>
  # Location of the WebDAV lock database.
  DavLockDB /var/lib/dav/lockdb
</IfModule>


I have created the svn directory with the following commands
Code:

root@ruggles htdocs # svnadmin create /var/www/localhost/htdocs/svn
root@ruggles htdocs # chown -R apache:apache /var/www/localhost/htdocs/svn


now when I try to run the command
Code:

root@ruggles htdocs # svn mkdir /var/www/localhost/htdocs/svn/project


I get the following error
Code:

svn: '/var/www/localhost/htdocs/svn' is not a working copy
Back to top
View user's profile Send private message
lorenb
Apprentice
Apprentice


Joined: 24 Aug 2002
Posts: 207
Location: Toronto, ON

PostPosted: Tue Jun 08, 2004 4:39 pm    Post subject: Reply with quote

Looks like you are using the wrong syntax for svn mkdir

Try this:

Code:

svn mkdir -m "Making a new dir." http://localhost/svn/project
Back to top
View user's profile Send private message
Adamal
Apprentice
Apprentice


Joined: 05 Dec 2003
Posts: 264
Location: California

PostPosted: Tue Jun 08, 2004 4:42 pm    Post subject: Reply with quote

lorenb wrote:
Looks like you are using the wrong syntax for svn mkdir

Try this:

Code:

svn mkdir -m "Making a new dir." http://localhost/svn/project


Here is what I got from this one:

Code:
root@ruggles svn # svn mkdir -m "Making a new dir." http://localhost/svn/project1
svn: OPTIONS request failed on '/svn'
svn: OPTIONS of '/svn': 301 Moved Permanently (http://localhost)
Back to top
View user's profile Send private message
lorenb
Apprentice
Apprentice


Joined: 24 Aug 2002
Posts: 207
Location: Toronto, ON

PostPosted: Tue Jun 08, 2004 4:51 pm    Post subject: Reply with quote

Oops, forgot to include the repository name, try this:

Code:

svn mkdir -m "Making a new dir." http://localhost/svn/svn/project1
Back to top
View user's profile Send private message
lorenb
Apprentice
Apprentice


Joined: 24 Aug 2002
Posts: 207
Location: Toronto, ON

PostPosted: Tue Jun 08, 2004 4:54 pm    Post subject: Reply with quote

One other thing you could try, importing:

Code:

mkdir -p tmpdir/project1
cd tmpdir
svn import . http://localhost/svn/svn/ -m 'Initial layout'


Then if it works, you can check it out:

Code:

rm -rf tmpdir
svn checkout http://localhost/svn/svn/project1
Back to top
View user's profile Send private message
Adamal
Apprentice
Apprentice


Joined: 05 Dec 2003
Posts: 264
Location: California

PostPosted: Tue Jun 08, 2004 5:04 pm    Post subject: Reply with quote

lorenb wrote:
One other thing you could try, importing:

Code:

mkdir -p tmpdir/project1
cd tmpdir
svn import . http://localhost/svn/svn/ -m 'Initial layout'


Then if it works, you can check it out:

Code:

rm -rf tmpdir
svn checkout http://localhost/svn/svn/project1


No go here is what I got

Code:
root@ruggles tmpdir # svn import . http://localhost/svn/svn/ -m 'Initial layout'
Authentication realm: <http://localhost:80> Subversion repository
Password for 'root':
Authentication realm: <http://localhost:80> Subversion repository
Username: adam
Password for 'adam':
svn: PROPFIND request failed on '/svn'
svn: PROPFIND of '/svn': 301 Moved Permanently (http://localhost)


BTW thanks for your help so far.
Back to top
View user's profile Send private message
lorenb
Apprentice
Apprentice


Joined: 24 Aug 2002
Posts: 207
Location: Toronto, ON

PostPosted: Tue Jun 08, 2004 5:19 pm    Post subject: Reply with quote

Hmm. Strange. How about changing your apache config and remove the trailing slash.

Code:

SVNPath /var/www/localhost/htdocs/svn


Re-start apache and then try the import again. If it's not that, I'm not really sure what the problem is.

Check out Version Control with Subversion
Back to top
View user's profile Send private message
Adamal
Apprentice
Apprentice


Joined: 05 Dec 2003
Posts: 264
Location: California

PostPosted: Tue Jun 08, 2004 5:27 pm    Post subject: Reply with quote

No go.

I am at a loss. Is there any configuration help for Gentoo. Since gentoo has a different Apache format the normal docs just don't work.
Back to top
View user's profile Send private message
lorenb
Apprentice
Apprentice


Joined: 24 Aug 2002
Posts: 207
Location: Toronto, ON

PostPosted: Tue Jun 08, 2004 5:35 pm    Post subject: Reply with quote

Saw this in the Subversion FAQ:

Quote:

I can see my repository in a web browser, but 'svn checkout' gives me an error about "301 Moved Permanently". What's wrong?

It means your httpd.conf is misconfigured. Usually this error happens when you've defined the Subversion virtual "location" to exist within two different scopes at the same time.

For example, if you've exported a repository as <Location /www/foo>, but you've also set your DocumentRoot to be /www, then you're in trouble. When the request comes in for /www/foo/bar, apache doesn't know whether to find a real file named /foo/bar within your DocumentRoot, or whether to ask mod_dav_svn to fetch a file /bar from the /www/foo repository. Usually the former case wins, and hence the "Moved Permanently" error.

The solution is to make sure your repository <Location> does not overlap or live within any areas already exported as normal web shares.
Back to top
View user's profile Send private message
Adamal
Apprentice
Apprentice


Joined: 05 Dec 2003
Posts: 264
Location: California

PostPosted: Tue Jun 08, 2004 5:55 pm    Post subject: Reply with quote

lorenb wrote:
Saw this in the Subversion FAQ:

Quote:

I can see my repository in a web browser, but 'svn checkout' gives me an error about "301 Moved Permanently". What's wrong?

It means your httpd.conf is misconfigured. Usually this error happens when you've defined the Subversion virtual "location" to exist within two different scopes at the same time.

For example, if you've exported a repository as <Location /www/foo>, but you've also set your DocumentRoot to be /www, then you're in trouble. When the request comes in for /www/foo/bar, apache doesn't know whether to find a real file named /foo/bar within your DocumentRoot, or whether to ask mod_dav_svn to fetch a file /bar from the /www/foo repository. Usually the former case wins, and hence the "Moved Permanently" error.

The solution is to make sure your repository <Location> does not overlap or live within any areas already exported as normal web shares.


That was it. I moved my svn directy out of the /var/www/localhost/htdocs and it work great. Thanks for your help, you have no idea how much I appreciate it.
Back to top
View user's profile Send private message
gossi
n00b
n00b


Joined: 17 Jun 2004
Posts: 3

PostPosted: Thu Jun 17, 2004 7:06 am    Post subject: Reply with quote

I emerged subversion-1.0.4-r1 and configured it as it was written in the end of the ebuild:

  • created the repository with
    Code:
    ebuild /usr/portage/dev-util/subversion/subversion-1.0.4.ebuild config

  • created my userfile with
    Code:
    htpasswd2 -m -c /var/svn/conf/svnusers USERNAME

  • added the values
    Code:
    APACHE2_OPTS="-D SSL -D PHP4 -D DAV -D SVN"

    to /etc/conf.d/apache2


Seems I don't have to edit the apache2.conf because the ebuild created a file /etc/apache2/conf/modules.d/47_mod_dav_svn.conf
Code:

<IfDefine SVN>
        <IfModule !mod_dav_svn.c>
                LoadModule dav_svn_module       extramodules/mod_dav_svn.so
        </IfModule>
        <Location /svn/repos>
                DAV svn
                SVNPath /var/svn/repos
                AuthType Basic
                AuthName "Subversion repository"
                AuthUserFile /var/svn/conf/svnusers
                Require valid-user
        </Location>
</IfDefine>


I checked the rights in the directory /var/svn - they are all set to apache.

Everything I do now results in the same problems:
Code:

sk@homebase var $ svn mkdir -m "Making a new dir." http://localhost/svn/asdf/project1
Authentication realm: <http://localhost:80> Subversion repository
Password for 'sk':
svn: OPTIONS request failed on '/svn/asdf'
svn: OPTIONS of '/svn/asdf': 500 Internal Server Error (http://localhost)


I checked the apache logs:
Code:

==> /var/log/apache2/access_log <==
127.0.0.1 - - [17/Jun/2004:09:02:13 +0200] "OPTIONS /svn/asdf HTTP/1.1" 401 552 "-" "SVN/1.0.4 (r9844) neon/0.24.6"
127.0.0.1 - sk [17/Jun/2004:09:02:17 +0200] "OPTIONS /svn/asdf HTTP/1.1" 500 234 "-" "SVN/1.0.4 (r9844) neon/0.24.6"

==> /var/log/apache2/error_log <==
[Thu Jun 17 09:02:17 2004] [error] [client 127.0.0.1] (20014)Error string not specified yet: Can't open file '/var/svn/repos/asdf/format': No such file or directory
[Thu Jun 17 09:02:17 2004] [error] [client 127.0.0.1] Could not fetch resource information.  [500, #0]
[Thu Jun 17 09:02:17 2004] [error] [client 127.0.0.1] Could not open the requested SVN filesystem  [500, #2]
[Thu Jun 17 09:02:17 2004] [error] [client 127.0.0.1] (84)Invalid or incomplete multibyte or wide character: Could not open the requested SVN filesystem  [500, #2]


There is a /var/svn/repos/format file but no /var/svn/repos/asdf/format.
Back to top
View user's profile Send private message
Adamal
Apprentice
Apprentice


Joined: 05 Dec 2003
Posts: 264
Location: California

PostPosted: Thu Jun 17, 2004 5:08 pm    Post subject: Reply with quote

make sure you add the following to the apache2.conf

Code:
LoadModule dav_module                    modules/mod_dav.so
LoadModule dav_svn_module                /usr/lib/apache2-extramodules/mod_dav_svn.so


also remember to run svnadmin create <reponame>
Back to top
View user's profile Send private message
gossi
n00b
n00b


Joined: 17 Jun 2004
Posts: 3

PostPosted: Thu Jun 17, 2004 6:40 pm    Post subject: Reply with quote

Adding these lines is not nessecary with the ebuild: It installs 2 files in the apache2/conf/modules.d which are included in the apache2.conf. These files contain the lines you wrote.

Running the ebuild with the config command calls svnadmin and creates the repository in /var/svn/repos and even changes the access rights for the files to apache....

Using a webbrowser with http://homebase/svn/repos results in "Could not open the requested SVN filesystem" - it seems that the modules are loaded in apache...
Back to top
View user's profile Send private message
Adamal
Apprentice
Apprentice


Joined: 05 Dec 2003
Posts: 264
Location: California

PostPosted: Thu Jun 17, 2004 9:14 pm    Post subject: Reply with quote

Quote:
Using a webbrowser with http://homebase/svn/repos results in "Could not open the requested SVN filesystem" - it seems that the modules are loaded in apache...


If thats the error you got then you never ran
Code:
svnadmin create
with the name of the repository. You must have just tried to create the directory repos using mkdir.
Back to top
View user's profile Send private message
gossi
n00b
n00b


Joined: 17 Jun 2004
Posts: 3

PostPosted: Thu Jun 17, 2004 9:36 pm    Post subject: Reply with quote

Hm. It's working now... thanks :)
Back to top
View user's profile Send private message
Adamal
Apprentice
Apprentice


Joined: 05 Dec 2003
Posts: 264
Location: California

PostPosted: Thu Jun 17, 2004 10:03 pm    Post subject: Reply with quote

gossi wrote:
Hm. It's working now... thanks :)


Glad I could help. Took me a while to figure out all the ins and outs too.
Back to top
View user's profile Send private message
o5gmmob8
Guru
Guru


Joined: 17 Oct 2003
Posts: 507

PostPosted: Fri Sep 17, 2004 1:55 am    Post subject: subversion Reply with quote

Hi guys,

This may sound like a dumb question, but can I view, edit, and create files/directories across the web with a webdav and svn enabled apache, and will be simple as going to https://server/path_to_repository?

Walter
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum