参考资料:
svn攻略: http://blog.****.net/colinchan/article/details/1865154
错误解决:http://hi.baidu.com/anglem/item/f3e82b0ac057c2d572e67670
创建版本库:http://www.if-not-true-then-false.com/2010/install-svn-subversion-server-on-fedora-centos-red-hat-rhel/
步骤:
1、httpd安装
2、svn安装
3、配置
4、使用
5、Tortoise SVN使用方法
1、httpd安装
编译安装apr/apr-util等依赖包
下载apache源码,安装如下:
注意:安装附加参数 dav
- ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config --enable-modules=so
--enable- dav --enable-maintainer-mode --enable-rewrite
注:
我在尝试apache 2.2.27 时正常,尝试apache2.4.9 编译完成之后,修改httpd.conf ,重启,经常提示错误!,同时apache 2.2.27 按照如上configuration
之后,查看Apache目录,modules没有编译生成的.so 文件....很是神奇!!?
- make
- make install
检查dav_module 是否安装
2、svn安装
准备工作:
1、 下载neon,解压到subversion文件夹中,重命名为neon
2、下载sqlite,提取其中sqlite3.c 文件放置于subversion sqlite-amalgamation文件夹中
- ./configure --prefix=/usr/local/svn --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --with-ssl --with-zlib --enable-maintainer-mode
- make
- make install
安装之后,查看svn版本信息如下:
3、配置
- 拷贝svn模块到apache模块目录下
cp /data/subversion-1.4.5/subversion/mod_dav_svn/.libs/mod_dav_svn.so /usr/local/apache2/modules/
cp /data/subversion-1.4.5/subversion/mod_authz_svn/.libs/mod_authz_svn.so /usr/local/apache2/modules/ - 编辑httpd.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
放置如下信息,与httpd.conf 最后:
<Location /svn>
DAV svn
SVNParentPath /data/svn
</Location>
- 运行htpasswd添加用户和密码
/usr/local/apache2/bin/htpasswd -cm /data/svn/svn-auth-file chenmin
/usr/local/apache2/bin/htpasswd -m /data/svn/svn-auth-file admin - 再次编辑httpd.conf
<Location /svn>
DAV svn
SVNParentPath /data/svn
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /data/svn/svn-auth-file
Require valid-user
AuthzSVNAccessFile /data/svn/svn-access-file
</Location>
注:
我的SVN配置:
- 其中svn-auth-file是认证文件,存储用户名和密码,svn-access-file是访问权限文件,规定各个目录的访问者的权限, 示例的权限分配的文件的格式如下。
[groups] admin = john, kate
devteam1 = john, rachel, sally
devteam2 = kate, peter, mark
docs = bob, jane, mike
training = zak # Default access rule for ALL repositories
# Everyone can read, admins can write
[/]
* = r
@admin = rw # Allow developers complete access to their project repos [proj1:/]
@devteam1= rw [proj2:/]
@devteam2 = rw [bigproj:/]
@devteam1 = rw
@devteam2 = rw
trevor = rw # Give the doc people write access to all the docs folders [/trunk/doc]
@docs = rw # Give trainees write access in the training repository only [TrainingRepos:/]
@training = rw
我的权限管理设置如下:(svn-access-file)
我的密码管理如下:(svn-auth-file)
权限配置文件中,关键的几个概念是:目标和权限,也就是为谁分配什么样的权限。读为r,写为w,如果没有权限那么什么也不写即可。
4、使用:
创建版本库:
5、Tortoise SVN使用
参考地址:http://blog.****.net/xjbzju/article/details/6737328
注意:
使用svn服务器时,tortoise访问服务器的权限配置在具体项目的仓库中,另外使用tortoise前,需要启动svnserve 方法:
/usr/local/svn/svnserve -d -r /home/svn/repos
即配置如上文件authz、passwd、svnserve.conf
authz配置用户访问权限:
passwd配置用户名密码:
svnserve.conf 配置:
注:
使用中更改项目文件db 的权限,否则可能会出现 “不能打开/home/svn/repos/db/txn-current-lock 权限不足”的错误
解决办法:
chmod -R 777 db/