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

[经验分享] centos6.6基于apache环境SVN配置

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-8-6 10:31:26 | 显示全部楼层 |阅读模式
版本:Centos6.6_64
环境:apache已安装
yum install mod_dav_svn subversion
安装完成后一般会出现配置文件如果没有出现的话也可以自己创建
修改或者创建 Subversion config file /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>   (apache下的位置)
      DAV svn
      SVNPath /home/svn/myproject   (指明资源库的路径)
      SVNParentPath /home/svn   (如果有多个库,使用该选项)
      SVNListParentPath on     (打开这个选项可以列出ParentPath下面的所有库)
      AuthType Basic   (认证类型为基本认证 )
      AuthName "Subversion Repository"    (认证名称,将在IE界面弹出一个对话框,其标题)
      AuthUserFile /etc/apache2/dav_svn.passwd    (认证密码文件)
      # AuthzSVNAcessFile /etc/apache2/dav_svn.authz     (目录权限文件)
      Require valid-user    (要求验证用户,即不能匿名访问)
    </Location>

apprepo example:
[iyunv@AY140624153909325b49Z ~]# cat /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn
   AuthType Basic
   AuthName "Subversion repositories"         
   AuthUserFile /etc/svn-auth-users             账户和密码
   AuthzSVNAccessFile /etc/svn-access-control   用户权限控制
   Require valid-user
</Location>
[iyunv@AY140624153909325b49Z ~]#

创建库访问用户:
## Create testuser ##
首次创建需要加 -c 参数
htpasswd - cm /etc/svn-auth-users testuser
New password :
Re - type new password :
Adding password for user testuser

## Create testuser2 ##
htpasswd - m /etc/svn-auth-users testuser2
New password :
Re - type new password :
Adding password for user testuser2


====================================================================
Create and configure SVN repository
mkdir /var/www/svn
cd /var/www/svn

svnadmin create testrepo
chown - R apache .apache testrepo
创建完成后:
[admin@localhost myapp]$ ll
总用量 28
drwxr-xr-x. 2 apache apache 4096 7月  30 15:10 conf
drwxr-xr-x. 3 apache apache 4096 7月  30 15:29 dav
drwxr-sr-x. 6 apache apache 4096 7月  30 15:47 db
-r--r--r--. 1 apache apache    2 7月  30 15:10 format
drwxr-xr-x. 2 apache apache 4096 7月  30 15:10 hooks
drwxr-xr-x. 2 apache apache 4096 7月  30 15:10 locks
-rw-r--r--. 1 apache apache  229 7月  30 15:10 README.txt
[admin@localhost myapp]$

cd conf/

[admin@localhost conf]$ ll
总用量 12
-rw-r--r--. 1 apache apache 1080 7月  30 15:10 authz            
-rw-r--r--. 1 apache apache  309 7月  30 15:10 passwd
-rw-r--r--. 1 apache apache 2279 7月  30 15:10 svnserve.conf
[admin@localhost conf]$




如果防火墙在开启状态,那么就要修改CONTEXT值。
## If you have SELinux enabled (you can check it with "sestatus" command) ##
## then change SELinux security context with chcon command ##
chcon - R - t httpd_sys_content_t /var/www/svn/testrepo
## Following enables commits over http ##
chcon - R - t httpd_sys_rw_content_t/var/www/svn/testrepo

重启apache服务
restart apache:
/etc/init.d/httpd restart
/etc/rc.d/init.d/httpd restart



note:
Goto http://localhost/svn/testrepo address and you should see something like following, write username and password:
url:http://localhost/svn/testrepo


如果此处出现用户名和密码验证失败
现象:输入用户名和密码之后点击LOGIN跳转不过去


解决:
首先检查svnserve.conf文件,看有没有把password-db = passwd前对#去掉,并且要顶格;
authz-db = authz同理,修改realm = My First Repository,改为自己的服务器地址,
前面的#号也要去掉,顶格然后要注意authz文件里目录格式是否正确,要用/配置权限的时候要顶格.

编辑:访问控制文件
[admin@localhost tmp]$ cat svn-access-control
[groups]
devgroup = testuser,testuser2
testgroup = tester

[/]
* = r
@devgroup = rw
devgroup = rw

[testrepo:/]
@devgroup = rw
@testgroup =r

[testrepo:/trunk]
@devgroup = rw
@testgroup =r

[testrepo:/tags]
@devgroup = rw
@testgroup =r

[testrepo:/]
@testgroup =r

[testrepo:/trunk]
@testgroup =r

[testrepo:/tags]
@testgroup =r
[admin@localhost tmp]$





Configure repository 配置库文件

To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve.conf file:
## Disable anonymous access ## anon-access = none ## Enable access control ## authz-db = authz
## Disable anonymous access ##
anon - access = none
## Enable access control ##
authz - db = authz




添加代码库:
Create trunk, branches and tags structure under myapprepo
Create “template” directories with following command:
mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}
Then import template to project repository using “svn import” command:
svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/myapprepo/
Adding /tmp/svn-structure-template/trunk
Adding /tmp/svn-structure-template/branches
Adding /tmp/svn-structure-template/tags Committed revision
Committed revision 4.
=======================================================================
参考:http://www.if-not-true-then-fals ... entos-red-hat-rhel/




运维网声明 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-94677-1-1.html 上篇帖子: Apache Commons组件集合 下篇帖子: 五种开源协议的比较(BSD,Apache,GPL,LGPL,MIT) [转载]
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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