阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

RHEL6.4下搭建Apache和Subversion(SVN)

131次阅读
没有评论

共计 4808 个字符,预计需要花费 13 分钟才能阅读完成。

1、说明

RHEL6.4 系统下搭建 Apache+SVN

2、实现
1)在服务器上安装配置 SVN 服务;
2)SVN 服务支持 svnserve 独立服务模式访问;
3)SVN 服务支持 Apache 的 http 模式访问。

3、安装 svn 服务器
[root@reedOracle ~]# yum install -y subversion
[root@reedoracle ~]# rpm -qa|grep subversion
subversion-1.6.11-15.el6_7.x86_64

4、安装 apache 服务器
[root@reedoracle ~]# yum install -y httpd
[root@reedoracle ~]# rpm -qa|grep http
httpd-2.2.15-56.el6.CentOS.3.x86_64

5、配置 SVN 版本库
[root@reedoracle ~]# mkdir /svn
[root@reedoracle ~]# svnadmin create /svn/reed
[root@reedoracle ~]# cd /svn/reed/
[root@reedoracle reed]# ll
total 24
drwxr-xr-x 2 root root 4096 Apr  6 05:09 conf
drwxr-sr-x 6 root root 4096 Apr  6 05:09 db
-r–r–r– 1 root root    2 Apr  6 05:09 format
drwxr-xr-x 2 root root 4096 Apr  6 05:09 hooks
drwxr-xr-x 2 root root 4096 Apr  6 05:09 locks
-rw-r–r– 1 root root  229 Apr  6 05:09 README.txt

6、用户密码 passwd 配置
[root@reedoracle reed]# cd conf/
[root@reedoracle conf]# ll
total 12
-rw-r–r– 1 root root 1080 Apr  6 05:09 authz
-rw-r–r– 1 root root  309 Apr  6 05:09 passwd
-rw-r–r– 1 root root 2279 Apr  6 05:09 svnserve.conf
[root@reedoracle conf]# vim passwd
[root@reedoracle conf]# grep ‘^[^#]’ passwd
[users]
admin=123
reed=123
deer=123

7、权限控制 authz 配置
[root@reedoracle conf]# vim authz
[root@reedoracle conf]# grep ‘^[^#]’ authz
[aliases]
[groups]
[/]
*=r
admin=rw
[/public]
*=rw
[/reed]
admin=rw
reed=rw
*=
[/deer]
admin=rw
deer=rw
*=

8、服务 svnserve.conf 配置
[root@reedoracle conf]# vim svnserve.conf
[root@reedoracle conf]# grep ‘^[^#]’ svnserve.conf
[general]
anon-access = none  #禁止匿名访问,设置为 none。默认为 read,参数:read,write,none
password-db = passwd
authz-db = authz
realm = /svn/reed    #每个 SVN 项目的认证名,会在认证提示里显示,建议写项目名称。
[sasl]
[root@reedoracle conf]#

9、启动 SVN 服务
[root@reedoracle conf]# svnserve -d -r /svn

10、使用 checkout 导出文件
[root@reedoracle deer]# svn co svn://127.0.0.1/reed
Authentication realm: <svn://127.0.0.1:3690> /svn/reed
Password for ‘root’:
Authentication realm: <svn://127.0.0.1:3690> /svn/reed
Username: deer
Password for ‘deer’:
———————————————————————–
ATTENTION!  Your password for authentication realm:
<svn://127.0.0.1:3690> /svn/reed
can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.
You can avoid future appearances of this warning by setting the value
of the ‘store-plaintext-passwords’ option to either ‘yes’ or ‘no’ in
‘/root/.subversion/servers’.
———————————————————————–
Store password unencrypted (yes/no)? yes
A    reed/deer
A    reed/public
Checked out revision 1.
[root@reedoracle reed]# ls
deer  public
[root@reedoracle reed]# svn up .
A    public/restartsvn.sh
Updated to revision 2.
[root@reedoracle reed]#

11、配置 svn 支持 http 访问
通过 Http 协议访问版本库是 Subversion 的亮点之一。使用 Http 协议意味着只需要打开浏览器,输入 URL 即可轻松的浏览整个版本库。灵活通常带来复杂性,Http 方式相对于 svnserve 方式来说需要更多的配置。
由于 Subversion 需要版本化的控制,因此标准的 Http 协议不能满足需求。要让 Apache 与 Subversion 协同工作,需要使用 WebDAV(Web 分布式创作和版本控制)。WebDAV 是 HTTP 1.1 的扩展,关于 WebDAV 的规范和工作原理,可以参考 IETF RFC 2518。
为了使 Subversion 与 dav 模块通信,需要安装 mod_dav_svn 插件。
11.1、安装 mod_dav_svn
 [root@reedoracle conf]# yum install mod_dav_svn

11.2、配置 subversion.conf 
[root@reedoracle conf.d]# grep ‘^[^#]’ subversion.conf
LoadModule dav_svn_module    modules/mod_dav_svn.so
LoadModule authz_svn_module  modules/mod_authz_svn.so
<Location /reed>
DAV svn
SVNPath /svn/reed
AuthType Basic  # 使用基本认证方式,即用户名、密码认证 
AuthName “svn reed”  # 在认证对话框中出现的提示信息 
AuthUserFile /svn/reed/svnuser  # 指定 http 存放用户名信息的文件路径 
AuthzSVNAccessFile /svn/reed/conf/authz #AuthzSVNAccessFile 指向的是 authz 的策略文件
Satisfy Any
Require valid-user # 限定只有用户输入正确的用户名和密码后才能访问该标签所指向的路径 
</Location>

11.3、创建账号密码认证文件
/svn/reed/conf/authz 文件是 svnserve 独立服务器使用的认证文件,密码没有加密,明文显示。
/svn/reed/svnuser 文件是 Apache 的 http 模式使用的认证文件,密码使用 MD5 加密。
authz 和 svnuser 文件中,账号密码必须设置相同。
123456789101112 [root@reedoracle conf.d]# htpasswd -c  /svn/reed/svnuser admin
New password:
Re-type new password:
Adding password for user admin
[root@reedoracle conf.d]# htpasswd  /svn/reed/svnuser reed
New password:
Re-type new password:
Adding password for user reed
[root@reedoracle conf.d]# htpasswd  /svn/reed/svnuser deer
New password:
Re-type new password:
Adding password for user deer

12、启动 httpd 服务
[root@reedoracle conf.d]# /etc/init.d/httpd start
Starting httpd: httpd: apr_sockaddr_info_get() failed for reedoracle
httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
[OK]

13、测试
13.1、通过客户端访问

13.2、通过浏览器访问

Ubuntu 14.04 下搭建 SVN 服务器 SVN://  http://www.linuxidc.com/Linux/2015-01/111956.htm

CentOS 7 下安装 iF.svnadmin 实现 Web 方式管理 SVN(源码安装)http://www.linuxidc.com/Linux/2016-08/134214.htm

CentOS7.2 编译安装 SVN1.9.5 客户端  http://www.linuxidc.com/Linux/2017-03/141387.htm

SVN 服务器搭建步骤及使用实战 http://www.linuxidc.com/Linux/2017-01/139282.htm

Windows 下 SVN 服务器搭建和使用 + 客户端重新设置密码 http://www.linuxidc.com/Linux/2013-05/85189p5.htm

CentOS 6.6 搭建 SVN 服务器 http://www.linuxidc.com/Linux/2016-12/137864.htm

CentOS 7.2 下 Nginx+MySQL+PHP-FPM+SVN 配置 Walle 自动化部署系统详解 http://www.linuxidc.com/Linux/2016-11/137703.htm

CentOS 7.1 下 SVN 安装与配置 http://www.linuxidc.com/Linux/2016-12/138637.htm

CentOS 下 SVN 仓库部署 http://www.linuxidc.com/Linux/2017-03/142183.htm

Subversion (SVN) 的详细介绍:请点这里
Subversion (SVN) 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-04/142589.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计4808字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中