百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>服务器> centos上搭建SVN并将项目同步到PHP项目的系统根名目的办法详解
分享文章到:

centos上搭建SVN并将项目同步到PHP项目的系统根名目的办法详解

发布时间:09/01 来源:未知 浏览: 关键词:
下面由Centos入门教程栏目给大家介绍centos上搭建SVN并将项目同步到PHP项目的系统根名目的办法,但愿对需要的伴侣有所帮忙!

一、SVN安置

这里采纳yum安置方式:

1、rpm -qa subversion //检查可否安置了低版本的SVN

2、yum remove subversion //假如储备旧版本,卸载旧版本SVN

3、开端安置yum -y install subversion

安置好后查看版本svnserve --version

4、创立版本仓库:

mkdir -p /data/svn/project                                
svnadmin create /data/svn/project/

查看/data/svn/project 文件夹可以发明有conf, db,format,hooks, locks, README.txt等文件,说明一个SVN库已经创立。

5、配置权限

   cd /data/svn/project/conf/            //进入配置名目
     vim svnserve.conf                    //编纂配置文件,参加下面五行内容
```
[general]
### The anon-access and auth-access options control access to the``
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete 
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
# anon-access = read
# auth-access = write
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
realm = /data/svn/project
```

6、编纂密码文件,增加会员test 密码123456:

vim 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
test = 123456

7、编纂权限文件,增加会员test权限

vim authz
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
[/]
test = rw

8、配置防火墙

vi /etc/sysconfig/iptables

参加:

```
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp -dport 3690 -j ACCEPT
```

重新启动防火墙:service iptables restart

9、启动SVN:svnserve -d -r /data/svn/

查看端口状态:netstat -ln | grep 3690

二、给svn增加钩子同步文件到PHP测试环境 (这里PHP项目名目为/var/www/html/project/)

1、进入版本库下的hooks名目

cd /data/svn/project/hooks/

2、将post-commit.tmpl 复制为 post-commit

cp post-commit.tmpl post-commit

3、给post-commit可施行权限

chmod 0777 post-commit

4、编纂post-commit,注释掉#mailer.py......这一行,增加下面四行,编码问题,假如错误的话大概致使没法同步 成功,可选的有en_US.UTF-8、zh_CN.UTF-8、zh_CN.GB2312,可以一个个试。

vi post-commit
#mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf
export.GB2312
SVN=/usr/bin/svn
STATIC_DIR=/var/www/html/project/
${SVN} update  ${STATIC_DIR} --username "test" --password "123456"

5、在提交此前,停止一次checkout代码到指定名目

svn checkout svn://localhost/project /var/www/html/project/

注:假如不断出错:“由于连接方在一段时间后没有准确答复或连接的主机没有反响,连接尝试失败”;大概是网络端口开放设定问题,由于端口问题致使没法成功checkout项目,可以进入阿里云看看看看有没有同意3690的端口,假如没有3690的端口就增加一条平安组规则。

更多centos技术文章,请当centos教程栏目!

以上就是centos上搭建SVN并将项目同步到PHP项目的系统根名目的办法详解的具体内容,更多请关注百分百源码网其它相关文章!

打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有151人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板