基本步骤: 1、安装必需的subversion 2、创建版本库 3、配置用户和权限 4、钩子和svn常用命令说明

一、安装subversion 在这里我们使用yum来安装subversion,使用以下命令即可完成。

[root@localhost ~]# yum -y install subversion

二、创建版本库

[root@localhost ~]# mkdir -p /home/svn/project01
[root@localhost ~]# svnadmin create /home/svn/project01

三、版本库管理配置 进行刚才创建的版本库目录下的conf目录,可以看到有三个文件。

[root@localhost ~]# cd /home/svn/project01/conf
[root@localhost conf]# ls
authz passwd svnserve.conf

svnserve.conf 这个是版本库的配置文件 passwd 这个是记录用户帐号密码的文件 authz 这个则是记录组、权限和身份验证的文件 1、配置svnserve.conf文件 这里需要设置以下几处 anon-access = none 指定匿名权限,默认为可读,现设置匿名无权限 auth-access = write 用户有写权限 password-db = passwd 账号密码文件的路径,psswd文件也可复制一份,命名为 passwd.conf 这样可以知道是配置文件,也可以放到其它目录下 authz-db = authz 同上 注意去掉#注释以后配置一定要顶格写,下同。

[root@localhost conf]# vi svnserve.conf
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz

2、配置passwd 该文件中记录svn用户名密码,以 (帐号 = 密码)或 (帐号 : 密码)的形式进行储存。 多用户之前用换行区分。这里配置了一个用户名为test1密码为123456的svn 账户。

[root@localhost conf]# vi 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
test1 = 123456

3、authz文件的配置 [groups]表用于用户组的配置例如 “developers = test1,test2”这样就将这2个用户方在了developers组织之中。 建立组是为了方便给一组相同权限的用户分配权限。 [/] 指定是svn的根版本库 版本库目录格式: [<版本库>:/项目/目录] @<用户组名> = <权限> <用户名> = <权限>

[root@localhost conf]# vi authz

[groups]
# harry_and_sally = harry,sally
# developers = test1, test2 # [/foo/bar]
# harry = rw
# * = # [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[/]
test1 = rw
* =

这样svn版本库就算配置完成了。

运行 svn, (停止SVN服务器命令为:killall svnserve )

[root@localhost ~]# svnserve -d -r /home/svn/

我们继续说下其他常用的一些配置 1、开机自动运行 在/etc/rc.d/rc.local 添加 “/usr/bin/svnserve -d -r svn版本库目录” 即可

[root@localhost ~]# vi /etc/rc.d/rc.local

#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff. touch /var/lock/subsys/local
/usr/bin/svnserve -d -r /home/svn/

2、钩子自动更新 说明,在开发时经常需要提交代码,如果使用钩子自动更新的话,只要有人提交后就能自动更新到服务器上,非常方便哦。 首先必须对代码目录checkout

[root@localhost ~]# cd /var/www
[root@localhost www]# svn checkout svn://192.168.1.100/project01
Authentication realm: 21d46c22-96a8-465b-9d0b-58a1e04abdfd
Password for 'root':
Authentication realm: 21d46c22-96a8-465b-9d0b-58a1e04abdfd
Username: test1
Password for 'test1':
Checked out revision 0.

这样在 /var/www/ 中会生成一个目录 project01,我们可以把这个目录设置成站点来访问。

进入版本库hooks目录 将post-commit.tmpl 模板复制一份 取名post-commit 在末尾加上 svn up /home/svn/project01/ –username test1 –password 123456 并赋予执行权限。

[root@localhost ~]# cd /home/svn/project01/hooks/
[root@localhost hooks]# ls
post-commit.tmpl post-revprop-change.tmpl pre-commit.tmpl pre-revprop-change.tmpl start-commit.tmpl
post-lock.tmpl post-unlock.tmpl pre-lock.tmpl pre-unlock.tmpl
[root@localhost hooks]# cp post-commit.tmpl post-commit
[root@localhost hooks]# vim post-commit REPOS="$1"
REV="$2" svn up /home/svn/project01/ --username test1 --password 123456 [root@localhost hooks]# chmod +x post-commit

这样当用户提交文件的第时候,svn将会自动执行更新,使代码同步。

centos6.0 配置SVN的更多相关文章

  1. CentOS-6.*安装配置SVN

    安装说明 系统环境:CentOS-6.3 安装方式:yum install (源码安装容易产生版本兼容的问题) 安装软件:系统自动下载SVN软件 检查已安装版本 #检查是否安装了低版本的SVN [ro ...

  2. CentOS6.3配置SVN之subversion1.7.7

    今天配置了 SVN 记在这儿 备忘: 1. 下载 svn 软件包和依赖包 cd /mydata/soft wget http://labs.mop.com/apache-mirror/subversi ...

  3. Centos6.8配置svn

    svn的安装:yum -y install subversion 一.一个仓库放所有的项目 创建仓库,以后所有代码都放在这个下面,创建成功后在svn下面多了几个文件夹.1.创建仓库:svnadmin ...

  4. 在CentOS6.0上安装Oracle 11gR2 (11.2.0.1)以及基本的配置(一)

    首先安装CentOS6.0   就不用说了.安装即可.唯一需要注意的就是后面Oracle 11G Installation guide中的Checking the Software Requireme ...

  5. centOS6.0虚拟机ip配置

    1.首先使用虚拟机安装好centOS6.0系统 2.虚拟机网络配置:(选择桥接模式) 3. 第一步:首先关闭防火墙 1.将防火服务从启动列表移除 #chkconfig --del iptables # ...

  6. CentOS6.9快速安装配置svn

    CentOS6.9快速安装配置svn 环境介绍: 操作系统:CentOS release 6.9 (Final)192.168.65.130 (svn服务器)192.168.65.129 (svn客户 ...

  7. CentOs 6.6 安装配置 SVN

    ① 挂载光盘 mount /dev/cdrom /mnt/cdrom ② yum 安装 svn yum -y install subversion ③ 创建svn 版本库根目录 mkdir -p /w ...

  8. aliyun CentOS6.5 上 svn 安装笔记

    为了方便管理自己的一些学习资料.总结等,在CentOS6.5上安装SVN,记录过程如下: 1.1  安装方式  独立服务器  fsfs SVN服务器有2种运行方式:独立安装.SVN+Apache.独立 ...

  9. Centos/ubuntu配置SVN服务

    Centos安装svn yum -y install subversion ubuntu安装svn apt-get install subversion Centos配置svn root@hello: ...

随机推荐

  1. bzoj5288: [Hnoi2018]游戏

    我还是太年轻了... 考场上就是直接枚举预处理当前位置左右延伸到的最远距离,好像是水了20.. 然后噶爷爷居然随机一下就AC了????mengbier #include<cstdio> # ...

  2. Sublime text3 Emmet使用

    Emmet需要配置pyv8 进入 https://github.com/emmetio/pyv8-binaries 下载解压文件放入Sublime Installed Packages下面 就可以使用 ...

  3. maven、spring jdbc 与mysql

    做一个简单的有数据库的maven项目,目前还是没有前端,而且没有使用mybatis.之后会向项目中添加. 图片 对于上图的说明,第一个大的表格是未运行测试程序数据表的内容,第二个大的表格是运行测试程序 ...

  4. Python—使用xml.sax解析xml文件

    什么是sax? SAX是一种基于事件驱动的API. 利用SAX解析XML文档牵涉到两个部分:解析器和事件处理器. 解析器负责读取XML文档,并向事件处理器发送事件,如元素开始跟元素结束事件; 而事件处 ...

  5. [转]java多线程并发去调用一个类的静态方法安全性探讨

    文章转自:https://blog.csdn.net/weibin_6388/article/details/50750035 这篇文章主要讲多线程对静态方法访问的数据安全性 总结如下: 1,java ...

  6. Log4net根据日志等级输出到不同文件

    <?xml version="1.0" encoding="utf-8"?> <configuration> <configSec ...

  7. FluentAPI配置

    基本 EF 配置只要配置实体类和表.字段的对应关系.表间关联关系即可. 如何利用 EF的高级配置,达到更多效果:如果数据错误(比如字段不能为空.字符串超长等),会在 EF 层就会报错,而不会被提交给数 ...

  8. SQlException 对象名无效

  9. 基于 Web 的 Go 语言 IDE - Wide 1.3.0 发布!

    http://symphony.b3log.org/article/1437292757551 欢迎各位提意见.建议,参与到 Wide 开源项目中 :-)

  10. CF949B A Leapfrog in the Array 思维题,推理

    题意: Dima是一名初级程序员. 在他的工作中,他经常不断地重复以下操作:从数组中删除每个第二个元素. 有一天,他对这个问题的解决方案感到厌倦,他提出了以下华丽的算法. 假设有一长度为2n的数组,最 ...