您的位置:首页 > 其它

阿里云搭建SVN服务器

2015-05-07 13:56 411 查看
阿里云搭建SVN服务器1:安装svn

apt-get 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 /home/svnrepos
理论上,仓库可以建立在任何目录中。

注意:重启svnserve 执行 svnserve -d -r /home

这样在eclipse客户端把工程导入svn的时候 url需要填写

svn://ip/svnrepos/project_name

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

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

4. 修改配置文件

编辑 svnserve.conf

vi /home/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 /home/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 /home/svnrepos/conf/authz

修改或者输入下面2行:

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

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

7.客户端连接
svn co svn://ip/oplinux
用户名密码:rsync

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

1)设置WEB服务器根目录为/alidata/www/webroot 2)checkout一份SVN svn co svn://localhost/alidata/www/svndata/myproject /alidata/www/webroot修改权限为WEB用户 chown -R www:www /alidata/www/webroot/myproject3)建立同步脚本 cd /alidata/www/svndata/oplinux/hooks/cp post-commit.tmpl post-commit编辑post-commit,在文件最后添加以下内容 export LANG=en_US.UTF-8SVN=/usr/bin/svnWEB=/alidata/www/webroot/$SVN update $WEB –username myname –password mynamechown -R www:www $WEB增加脚本执行权限 chmod +x post-commit这样,我们上传svn后,生产站点就能立马显示出来了,自动化程度高了很多。
来源: </article/6222361.html>

来自为知笔记(Wiz)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: