集成 Apache 和 SVN
Posted abc0012383
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了集成 Apache 和 SVN相关的知识,希望对你有一定的参考价值。
1.查看系统环境
1 [[email protected] /]# systemctl status firewalld.service 2 ● firewalld.service - firewalld - dynamic firewall daemon 3 Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) 4 Active: inactive (dead) 5 Docs: man:firewalld(1) 6 [[email protected] /]# getenforce 7 Disabled 8 [[email protected] /]# uname -a 9 Linux Docker 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux 10 [[email protected] /]# cat /etc/redhat-release 11 CentOS Linux release 7.4.1708 (Core) 12 [[email protected] /]#
2.安装软件包和Apache SVN模块
1 yum install httpd mod_dav_svn subversion
3. 验证安装
1 [[email protected] /]# httpd -version 2 Server version: Apache/2.4.6 (CentOS) 3 Server built: Apr 20 2018 18:10:38 4 [[email protected] /]# svnserve --version 5 svnserve, version 1.7.14 (r1542130) 6 compiled Apr 11 2018, 02:40:28
4.验证Apache SVN模块是否安装成功,需要检查mod_dav_svn.so和mod_authz_svn.so
1 [[email protected] modules]# pwd 2 /etc/httpd/modules 3 [[email protected] modules]# ll | egrep "mod_dav_svn.so|mod_authz_svn.so" 4 -rwxr-xr-x 1 root root 19504 Apr 11 10:44 mod_authz_svn.so 5 -rwxr-xr-x 1 root root 181344 Apr 11 10:44 mod_dav_svn.so
5. 使用svnadmin命令创建SVN仓库repos
1 [[email protected] /]# mkdir /var/www/svn 2 [[email protected] /]# cd /var/www/svn/ 3 [[email protected] svn]# svnadmin create repos 4 [[email protected] svn]# tree -d repos/ 5 repos/ 6 ├── conf 7 ├── db 8 │ ├── revprops 9 │ │ └── 0 10 │ ├── revs 11 │ │ └── 0 12 │ ├── transactions 13 │ └── txn-protorevs 14 ├── hooks 15 └── locks 16 17 10 directories
6.修改repos目录属主和属组
1 [[email protected] svn]# chown -R apache:apache repos/ 2 [[email protected] svn]# ll 3 total 4 4 drwxr-xr-x 6 apache apache 4096 May 15 16:57 repos
7. 复制/var/www/svn/repos/conf 下的authz文件到 /var/www/svn下,并创建用户认证passwd文件,设置隐藏属性
1 [[email protected] svn]# cp /var/www/svn/repos/conf/authz /var/www/svn/ 2 [[email protected] svn]# cd /var/www/svn/repos 3 [[email protected] repos]# touch .passwd
8.通过htpasswd命令建立SVN用户svnuser并将用户信息保存在passwd文件中
1 [[email protected] repos]# htpasswd ./.passwd svnuser 2 New password: 3 Re-type new password: 4 Adding password for user svnuser 5 [[email protected] repos]# cat .passwd 6 svnuser:$apr1$ThE7aO2O$CQo.OIs.8TOqUFaFr7b3H0
9.修改authz文件并设置相应权限:
在[groups]下添加组
[/] 相当于/var/www/svn这个目录,赋予权限给用户组
[repos:/] 是指repos库
[repos:/desgin]是repos下的desgin目录
1 [[email protected] svn]# vim authz 2 [[email protected] svn]# grep -v "^#" authz 3 4 [groups] 5 admin_group=svnuser,svnuser2 6 project_group=svnuser3,svnuser4 7 project2_group=svnuser5,svnuser6 8 9 [/] 10 @admin_group=rw 11 12 [repos:/] 13 @project_group=rw 14 15 [repos:/desgin] 16 @project_group=rw 17 18 [repos2:/] 19 @project2_group=rw
10.关联Apache与SVN,创建subversion.conf文件
[[email protected] /]# vim /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 /documents> DAV svn SVNParentPath /var/www/svn SVNListParentPath On AuthType Basic AuthName "Project SVN" AuthUserFile /var/www/svn/repos/.passwd Require valid-user AuthzSVNAccessFile /var/www/svn/authz </Location>
11.启动Apache,输入ip地址+目录名即可看到SVN仓库
1 [[email protected] /]# systemctl start httpd.service
以上是关于集成 Apache 和 SVN的主要内容,如果未能解决你的问题,请参考以下文章
Jenkins +Maven+Tomcat+SVN +Apache项目持续集成构建
Jenkins+Maven+Svn搭建持续集成环境持续集成和自动部署