Chinaunix首页 | 论坛 | 博客
  • 博客访问: 259404
  • 博文数量: 74
  • 博客积分: 1470
  • 博客等级: 上尉
  • 技术积分: 793
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-25 21:01
文章分类

全部博文(74)

文章存档

2011年(1)

2010年(32)

2009年(32)

2008年(9)

我的朋友

分类: LINUX

2009-07-25 15:13:39

今天在配置svn的时候,总是时出现错误

svn: Could not open the requested SVN filesystem

google找了很多方法也不行,最后折腾了好长时间才弄好,记录一下安装和配置的过程:

1. 安装apache2和subversion:
sudo apt-get install apache2
sudo apt-get install subversion
sudo apt-get install libapache2-svn


2. 配置svn服务器端:
首先,创建svn空间的目录位置,
$ sudo mkdir /home/username/svn
然后,开始建立一个新的库目录,
$ cd /home/username/svn
$ sudo mkdir repo
$ sudo chown -R root:www-data repo
$ sudo svnadmin create /home/username/svn/repo
//用svn开始建立一个新的库

3. 导入文件:

svn import /home/username/projects/base file:///home/username/svn/repo -m "initial import"

4.使用svn客户端:
这里只介绍两种方式,假设工作目录位于/home/username/work/下.
$ svn co //这是当客户端与服务器端在同台机器上时,这么访问.
另外,为了使客户端访问库时简化目录,可以在服务器端启用daemon,
$ svnserve -d --foreground -r /home/username/svn
这样客户端的访问可以简化为,
$ svn co svn://localhost/repo

如果可以看到类似如下内容,就说明svn服务器端已经建立好了:

A repo/genRule
A repo/genRule/parsefile.h
A repo/genRule/genrule
A repo/genRule/list.h
A repo/genRule/genrule.c
A repo/genRule/parsefile.c
A repo/genRule/Makefile
A repo/util.h
A repo/kthread.c
A repo/clist.h
A repo/kthread.h
A repo/Makefile
Checked out revision 1.

 
以上是通过svn来进行文件的下载,那么想通过http在其他机器上进行svn co就得用Apache了。
 
4. 配置apache2
  • 配置Apache2的配置文件/etc/apache2/mods-available/dav_svn.conf 

<Location /svn>
DAV svn

#SVNPath
SVNParentPath /home/username/svn       #not /home/username/svn/repo
AutoType Basic
AutoName "My Respository"
AutoUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>

注意:
上面/home/username/svn 是svn空间所在的目录,这里是在SVNParentPath下而不是SVNPath下,
/etc/apache2/mods-available/dav_svn.conf 中有关于SVNParentPath和SVNPath的解释:

# Set this to the path to your repository #SVNPath /home/xulei/svn/

# Alternatively, use SVNParentPath if you have multiple repositories under

# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).

# You need either SVNPath and SVNParentPath, but not both. SVNParentPath /home/xulei/svn


也就是说当你的svn空间目录下有好几个svn库,那么就用SVNParentPath。
另外,一定是svn空间目录/home/username/svn,而不是库目录/home/username/svn/repo,
如果写成库目录,就会出现如下错误:
svn: Could not open the requested SVN filesystem


  • 创建一个认证用户(下面的命令是创建一个用户名为xulei的用户,第二次再添加其他用户时不用-c选项):
sudo htpasswd2 -c /etc/apache2/dav_svn.passwd xulei

  • 使Apache2的某些模块有效

sudo a2enmod dav dav_fs dav_svn


  • 最后重启apache2
sudo /etc/init.d/apache2 restart

  • 在浏览器中输入:就可以看见svn版本库里面的文件了

参考:
在ubuntu上配置svn:http://www.blogjava.net/glava/archive/2006/10/23/76831.html

Debian/Ubuntu下配置Subversion Server:http://blog.csdn.net/pythoner/archive/2008/11/04/3220311.aspx

svn server的建立和配置:http://blog.csdn.net/jerichen/archive/2009/04/24/4107299.aspx

How to setup a Ubuntu development server  - part 1:http://ariejan.net/2006/12/01/how-to-setup-a-ubuntu-development-server-part-1/

阅读(2060) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~