Linux操作系统下配置subversion跟我来

ouhzrM 2008-01-20

1.准备工作
在CentOS5或Fedora 8版本,httpd和subversion默认安装,通过web访问svn还需要apache的mod_dav_svn、mod_authz_svn模块,如果没加载重新安装;

2.创建仓库
mkdir /home/svnrepo
svnadmin create --fs-type fsfs /home/svnrepo/ecshop
svnadmin create --fs-type fsfs /home/svnrepo/discuz6
chmod 700 /home/svnrepo

3.添加用户
//创建MD5加密的密码文件authfile,-c:create,-m:以MD5加密
htpasswd -c -m /home/svnrepo/authfile pujing
//添加第二个用户
htpasswd -m /home/svnrepo/authfile bushi

4.权限分配
#vi /home/svnrepo/authz.conf
[ecshop:/]
bushi = r
pujing = rw
[discuz6:/]
bushi =
pujing = r
#[/]
#* = r
#[groups]
#svn1-developers = bushi,pujing
#svn2-developers = bushi
#[svn1:/]
#@svn1-developers = rw

5.配置apache
#vi /etc/httpd/conf/httpd.conf

在Loadmodule后或最末加入

DAV svn
SVNParentPath /home/svnrepo/
AuthzSVNAccessFile /home/svnrepo/authz.conf
AuthType Basic
AuthName "svn repository"
AuthUserFile /home/svnrepo/authfile
Require valid-user

#service httpd restart

6.import文件到版本仓库
svn import -m"the first import" /var/www/html/ecshop file:///home/svnrepo/ecshop

7.访问
http://192.168.1.139/svn/ecshop

8.commit到版本库,同时更新web测试环境
#cd /home/svnrepo/ecshop/hooks
#cp post-commit.tmpl post-commit //去掉.tmpl
#chmod 755 post-commit
#vi post-commit
//在post-commit文件最后加入三行
SVN=/usr/bin/svn
WEB=/home/website/ecshop
$SVN update --username pujing --password 123456 $WEB

9.其他。

相关推荐

leehbhs / 0评论 2020-03-04