设为首页 收藏本站
查看: 515|回复: 0

[经验分享] CentOS下的SVN服务器搭建过程以及分析

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-3-4 09:07:50 | 显示全部楼层 |阅读模式
1.yum安装svn
yum install -y subversion   

等待一会儿,显示下边的内容。
Dependency Installed:  
  gnutls.i686 0:2.8.5-10.el6_4.2               libproxy.i686 0:0.3.0-4.el6_3                    
  libproxy-bin.i686 0:0.3.0-4.el6_3            libproxy-python.i686 0:0.3.0-4.el6_3            
  neon.i686 0:0.29.3-3.el6_4                   pakchois.i686 0:0.4-3.2.el6                     
  perl-URI.noarch 0:1.40-2.el6                  

Complete!  

2.验证是否安装完成
svnserve --version   

这是我的显示内容。
svnserve,版本 1.6.11 (r934486)  
   编译于 Apr 11 2013,17:28:04  

版权所有 (C) 2000-2009 CollabNet。  
Subversion 是开放源代码软件,请参阅 http://subversion.tigris.org/ 站点。  
此产品包含由 CollabNet(http://www.Collab.Net/) 开发的软件。  

下列版本库后端(FS) 模块可用:   

* fs_base : 模块只能操作BDB版本库。  
* fs_fs : 模块与文本文件(FSFS)版本库一起工作。  

Cyrus SASL 认证可用。  

3.创建svn版本库
mkdir /var/svn #我这里把版本库放在了var目录下的svn文件夹,方便管理  
svnadmin create /var/svn/repo0 #我这里将svn作为所有版本库的目录,并创建了一个名为repo0的版本库  

4.配置当前的版本库
创建版本库后,在当前版本库目录中会生成下面的文件,其中我们关心的是配置文件。
[iyunv@localhost svn]# ls  
repo0  
[iyunv@localhost svn]# cd repo0  
[iyunv@localhost repo0]# ls  
conf  db  format  hooks  locks  README.txt  
[iyunv@localhost repo0]# pwd  
/var/svn/repo0  
[iyunv@localhost repo0]# cd conf  
[iyunv@localhost conf]# ls -a  
.  ..  authz  passwd  svnserve.conf  

说明:
            (1)svnserve.conf:  svn服务综合配置文件。
            (2)passwd: 用户名口令文件。
            (3)authz: 权限配置文件。
4.1 修改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  
repouser0 = user0passwd  
rock=rockpasswd  

其中对应的是 用户名=密码 ,其中等号两边的空格不是必须的。
4.2修改authz文件
[aliases]  
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average  
#这里实现了别名的定义  
[groups]  
# harry_and_sally = harry,sally  
# harry_sally_and_joe = harry,sally,&joe  
team0=erpouser0 #将上面创建的分成两个组  
team1=rock  
# [/foo/bar]  
# harry = rw  
# &joe = r #上面的别名定义在这里实现 &在这里理解为指针就很容易了  
# * =  
# [repository:/baz/fuz]  
# @harry_and_sally = rw  
# * = r  
[repo0:/]  
@team0=r  
@team1=rw  
# 第一个小组只有读取的权限,第二个小组有读写的权限  
# 单个版本库的权限配置在这个文件中实现  

4.3 修改svnserve.conf
vim svnserve.conf  
[general]  
### These options control access to the repository for unauthenticated  
### and authenticated users.  Valid values are "write", "read",  
### and "none".  The sample settings below are the defaults.  
anon-access = none #没有登录的用户不能访问   
auth-access = write #登录的用户可以写入  
### The password-db option controls the location of the password  
### database file.  Unless you specify a path starting with a /,  
### the file's location is relative to the directory containing  
### this configuration file.  
### If SASL is enabled (see below), this file will NOT be used.  
### Uncomment the line below to use the default password file.  
password-db = passwd #密码文件为当前目录下的passwd  
### The authz-db option controls the location of the authorization  
### rules for path-based access control.  Unless you specify a path  
### starting with a /, the file's location is relative to the the  
### directory containing this file.  If you don't specify an  
### authz-db, no path-based access control is done.  
### Uncomment the line below to use the default authorization file.  
authz-db = authz #验证文件为当前目录下的authz  

5 停止和启动svn
5.1启动svn
svnserve -d -r /var/svn/  

5.2关闭svn
ps -aux |grep svn  
kill -9 进程id  

6 导入工程
$ mkdir MyProject   
$ mkdir MyProject/trunk   
$ mkdir MyProject/branches   
$ mkdir MyProject/tags   
svn import MyProject svn://192.168.1.109/repo0/MyProject -m "first import project"   

7导出工程
svn co svn://192.168.1.109/repo0/MyProject   

8 总结
在互联网如此发达的今天,几乎你想要找什么技术文章都能找到,但是,你会发现,完全一样【标点都一样】的文章,出现在大大小小的网站,在想找到第二篇不同视点的文章,太难了。拿来主义很疯狂,我们这些技术人员需要的,更是创新。开源精神,从我做起。写技术博客,更多的是多自己的一种修行,一种提高,实践是最好的老师。


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-15399-1-1.html 上篇帖子: 启动PHP报错ERROR: [pool www] cannot get uid for user '@php_fpm_user@' 下篇帖子: AIX用户(组)管理 服务器
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表