阿里云搭建SVN服务器

参照http://www.cnblogs.com/yun007/p/3685170.html


1:安装svn

yum install subversion

 

2. 开启svn服务器

svnserve -d

检查是否开启:ps aux | grep svnserve

若出现如下内容:

wkr 6537 0.0 0.0 13784 956 ? Ss 16:18 0:00 svnserve -d
wkr 7593 0.0 0.0 5784 864 pts/0 S+ 21:57 0:00 grep –color=auto svnserve

表示服务已开启。(注意:一定要有第1行,只有第2行说明服务未启动)

停止svn服务:  killall svnserve

 3. 建立仓库

svnadmin create /mnt/svnrepos
理论上,仓库可以建立在任何目录中。

注意:重启svnserve  执行 svnserve -d  -r /mnt --listen-port 3691

这样在svn客户端checkout的时候 url需要填写

svn://ip:3691/svnrepos

如果启动的时候带如下参数:svnserve -d  -r  /mnt/svnrepos

客户端:svn://ip  这样子会报错。验证失败

4. 修改配置文件

编辑 svnserve.conf

vi /mnt/svnrepos/conf/svnserve.conf

 把anon-access = read 改为 none,auth_access = write 

 password-db = passwd  authz-db = authz 的注释去掉,还有[general]的注释也要去掉(这个默认没有注释)。
注:当你去掉注释的时候,不要简单的把前面的#去掉,要把前面的空格一块去掉,不然在Eclipse中使用的时候会出现配置文件格式错误的问题。

注意:如果authz-db = authz 这个注释掉了,则不需要配置/home/svnrepos/conf/authz

 

5. 修改帐户文件

vi  /mnt/svnrepos/conf/passwd

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
# harry = harryssecret
# sally = sallyssecret
user1 = pass1  # 输入你定义的用户名和密码,密码显然没有加密

6. 修改授权文件

gedit /mnt/svnrepos/conf/authz

修改或者输入下面2行:

[svnrepos:/]      ##格式为    版本库名称  + :/
user1 = rw

其中,repos1是仓库名称,user1是用户名,rw代表读写。


7.实现SVN与WEB同步,可以CO一个出来,也可以直接配在仓库中

 
1)设置WEB 服务器根目录为/home/wwwroot/legalhoop_svn
 
2)checkout一份SVN
 
svn co svn://localhost:3691/svnrepos /home/wwwroot/legalhoop_svn
修改权限为root用户
 
chown -R root:root /home/wwwroot/legalhoop_svn
3)建立同步脚本
 
执行linux命令
chown -R root:root /home/wwwroot/legalhoop_svn
chmod +x /mnt/svnrepos/hooks/post-commit


cp post-commit.tmpl post-commit
编辑post-commit,在文件最后添加以下内容
 
#!/bin/sh
export LANG=en_US.UTF-8
SVN="/usr/bin/svn"
WEB="/home/wwwroot/legalhoop_svn"
$SVN update $WEB –username user1 –password pass1

这样,我们上传svn后,生产站点就能立马显示出来了,自动化程度高了很多。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值