ubuntu svn服务搭建记录

ubuntu svn服务搭建及钩子设置

记录下,方便自己以后查看,为了方便直接在root下操作:

1.下载subversion
apt-get install subversion

2.创建svn仓库(project 为仓库名称)
mkdir -p /home/svn/project
svnadmin create /home/svn/project

3.配置conf下的三个文件authz,passwd,svnserve.conf
编辑svnserve.conf, 编辑完后如下
2 ### use it to allow access to this repository. (If you only allow
3 ### access through http: and/or file: URLs, then this file is
4 ### irrelevant.)
5
6 ### Visit http://subversion.apache.org/ for more information.
7
8 [general]
9 ### The anon-access and auth-access options control access to the
10 ### repository for unauthenticated (a.k.a. anonymous) users and
11 ### authenticated users, respectively.
12 ### Valid values are “write”, “read”, and “none”.
13 ### Setting the value to “none” prohibits both reading and writing;
14 ### “read” allows read-only access, and “write” allows complete
15 ### read/write access to the repository.
16 ### The sample settings below are the defaults and specify that anonymous
17 ### users have read-only access to the repository, while authenticated
18 ### users have read and write access to the repository.
19 anon-access = none
20 auth-access = write
21 ### The password-db option controls the location of the password
22 ### database file. Unless you specify a path starting with a /,
23 ### the file’s location is relative to the directory containing
24 ### this configuration file.
25 ### If SASL is enabled (see below), this file will NOT be used.
26 ### Uncomment the line below to use the default password file.
27 password-db = passwd
28 ### The authz-db option controls the location of the authorization
29 ### rules for path-based access control. Unless you specify a path
30 ### starting with a /, the file’s location is relative to the
31 ### directory containing this file. The specified path may be a
32 ### repository relative URL (^/) or an absolute file:// URL to a text
33 ### file in a Subversion repository. If you don’t specify an authz-db,
34 ### no path-based access control is done.
35 ### Uncomment the line below to use the default authorization file.
36 authz-db = authz
37 ### The groups-db option controls the location of the groups file.
38 ### Unless you specify a path starting with a /, the file’s location is
39 ### relative to the directory containing this file. The specified path
40 ### may be a repository relative URL (^/) or an absolute file:// URL to a
41 ### text file in a Subversion repository.

编辑authz
[groups]
22 # harry_and_sally = harry,sally
23 # harry_sally_and_joe = harry,sally,&joe
24 admin = xlp
25
26 [/]
27 @admin = rw

编辑passwd
### This file is an example password file for svnserve.
2 ### Its format is similar to that of svnserve.conf. As shown in the
3 ### example below it contains one section labelled [users].
4 ### The name and password for each user follow, one account per line.
5
6 [users]
7 # harry = harryssecret
8 # sally = sallyssecret
9 xlp = 123456

4.开启svn服务
svnserve -d -r /home/svn

checkout
svn co svn://127.0.0.1/project /var/www/html/laravel

svn服务开机自启动
cd /etc/init.d
vi svnd.sh 添加下面内容(我的svn目录在/srv/svn下)
1 #!/bin/sh
2 /usr/bin/svnserve -d -r /home/svn

然后 update-rc.d svnd.sh defaults

设置钩子自动更新到目标目录
cd /home/svn/project/hooks
touch post-commit 创建钩子
touch svn_hook.log 创建日志文件
1 #!/bin/sh
2
3 export LANG=zh_CN.UTF-8
4
5 REPOS=”$1”
6 REV=”$2”
7
8 SVN=/usr/bin/svn
9 WEB_PATH=/var/www/html/laravel
10 LOG=/home/svn/project/hooks/svn_hook.log
11
12 $SVN update $WEB_PATH –username xlp –password 123456 –non-interactive
13
14 if [ $? -eq 0 ]
15 then
16      echo `date` “\t \$REPOS \$REV” >> \$LOG
17 fi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值