搭建svn服务+web端图形化管理iF.SVNAdmin
-
- 软件包安装
-
-
-
- 1.安装apache
- 2.安装svn服务器(其中,mod_dav_svn是apache服务器访问svn的一个模块)
- 3.查询安装是否成功
-
-
- 配置
-
-
-
- 在apache下配置svn
- 建立SVN Server仓库
- 配置安装PHP 和 iF.SVNadmin
-
-
- 启动服务
-
-
-
- 修改/etc/sysconfig/svnserve
- 启动apache服务
-
-
- 解决apache服务启动失败的问题
转自 http://www.cnblogs.com/Sungeek/p/6905102.html ,在原文基础上,增加了一些问题的解决
软件包安装
1.安装apache
[[email protected] /]# yum install httpd -y
-y的含义, --assumeyes answer yes for all questions 可以通过 yum help查询
2.安装svn服务器(其中,mod_dav_svn是apache服务器访问svn的一个模块)
[[email protected] /]# yum install mod_dav_svn subversion -y
3.查询安装是否成功
查询apache版本
[[email protected] /]# httpd -version
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 5 2018 01:47:09
查询svn版本
[[email protected] /]# svnserve --version
svnserve, version 1.7.14 (r1542130)
compiled Apr 11 2018, 02:40:28
Copyright (C) 2013 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/
The following repository back-end (FS) modules are available:
* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.
Cyrus SASL authentication is available.
[[email protected] /]# ls /etc/httpd/modules/ | grep svn
mod_authz_svn.so
mod_dav_svn.so
配置
在apache下配置svn
编辑subversion.conf文件
[[email protected] /]# vim /etc/httpd/conf.d/subversion.conf
添加如下内容(去掉注释内容,否则启动apche报错)
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 #svn的根目录SSLRequireSSL
AuthType Basic #Basic认证方式
AuthName "Authorization SVN" #认证时显示的信息
AuthUserFile /var/www/svn/passwd #用户文件&密码
AuthzSVNAccessFile /var/www/svn/authz #访问权限控制文件
Require valid-user #要求真实用户,不能匿名
</Location>
建立SVN Server仓库
通过如下命令建立svn仓库
创建仓库目录
[[email protected] /]# mkdir /var/www/svn
创建svn仓库 sungeek
[[email protected] /]# svnadmin create /var/www/svn/sungeek
[[email protected] /]# ls /var/www/svn/sungeek
conf db format hooks locks README.txt
[[email protected] /]# chown -R apache.apache /var/www/svn
创建用户文件passwd和权限控制文件authz
[[email protected] /]# touch /var/www/svn/passwd
[[email protected] /]# touch /var/www/svn/authz
配置安装PHP 和 iF.SVNadmin
由于iF.SVNAdmin使用php写的,因此我们需要安装php
[[email protected] /]# yum install php -y
安装iF.SVNAdmin
[[email protected] /]# wget http://sourceforge.net/projects/ifsvnadmin/files/svnadmin-1.6.2.zip
[[email protected] /]# unzip iF.SVNAdmin-stable-1.6.2
[[email protected] /]# cp -r iF.SVNAdmin-stable-1.6.2/ /var/www/html/svnadmin
[[email protected] /]# rm -rf svnadmin-1.6.2.zip
[[email protected] /]# rm -rf iF.SVNAdmin-stable-1.6.2/
[[email protected] /]# cd /var/www/html
[[email protected] html]# chown -R apache.apache svnadmin
[[email protected] html]# cd /var/www/html/svnadmin
[[email protected] svnadmin]# chmod -R 777 data
启动服务
如果开启了防火墙, 需要开启httpd访问权限
[[email protected] /]# firewall-cmd --permanent --add-service=http
success
[[email protected] /]# firewall-cmd --permanent --add-service=https
success
[[email protected] /]# firewall-cmd --reload
success
修改/etc/sysconfig/svnserve
通过查看文件/usr/lib/systemd/system/svnserve.service, 了解到svnserver的配置文件是/etc/sysconfig/svnserve
[[email protected] /]# vim /etc/sysconfig/svnserve
OPTIONS="-r /var/svn" 改为 OPTIONS="-r /var/www/svn"
# OPTIONS is used to pass command-line arguments to svnserve.
#
# Specify the repository location in -r parameter:
OPTIONS="-r /var/www/svn"
启动apache服务
启动apache服务
[[email protected] /]# systemctl start httpd.service
设置apache服务开机启动
[[email protected] /]# systemctl enable httpd.service
重启apache服务
[[email protected] /]# systemctl start httpd.service
启动webserver服务后,浏览器地址输入http://ip/svnadmin出现配置界面,输入下图中配置信息,输入每个配置信息可以点击旁边的Test测试是否输入正确,最后保存配置
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsICM38FdsYkRGZkRG9lcvx2bjxiNx8VZ6l2cs0TP31UeJRUTwMmeNBDOsJGcohVYsR2MMBjVtJWd0ckW65UbM5WOHJWa5kHT20ESjBjUIF2X0hXZ0xCMx81dvRWYoNHLrdEZwZ1Rh5WNXp1bwNjW1ZUba9VZwlHdssmch1mclRXY39CXldWYtlWPzNXZj9mcw1ycz9WL49zZuBnL5MjM2IDM0QTM0IDNwkTMwIzLc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
友情提示:无论登录页还是进入页面右上角都可以切换为中文显示。
解决apache服务启动失败的问题
**注意:**启动apache服务可能出现多个问题,导致启动失败
就我的这次经验来看,一共解决了三个问题才使服务正常启动。
1.配置文件错误。
命令行输入如下
[[email protected] /]# systemctl start httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
按照提示键入
[[email protected] /]# systemctl status httpd.service
输出一大堆,完全看不出问题出现在哪里。
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed(Result: exit-code) since Wed 2018-05-23 16:31:04 CST; 13s ago
Docs: man:httpd.service(8)
Process: 8267 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 8267 (code=exited, status=1/FAILURE)
Status: "Reading configuration..."
于是查看系统日志
[[email protected] /]# cat /var/log/messagesca
找到启动apache的日志信息
Apr 23 21:00:15 iZbp1hvbibqwiui44dxo6bZ systemd: Starting The Apache HTTP Server...
Apr 23 21:00:15 iZbp1hvbibqwiui44dxo6bZ httpd: [Tue Apr 23 21:00:15.300992 2019] [so:warn] [pid 21468] AH01574: module dav_svn_module is already loaded, skipping
Apr 23 21:00:15 iZbp1hvbibqwiui44dxo6bZ httpd: [Tue Apr 23 21:00:15.301080 2019] [so:warn] [pid 21468] AH01574: module authz_svn_module is already loaded, skipping
Apr 23 21:00:15 iZbp1hvbibqwiui44dxo6bZ httpd: AH00526: Syntax error on line 6 of /etc/httpd/conf.d/subversion.conf:
Apr 23 21:00:15 iZbp1hvbibqwiui44dxo6bZ httpd: Invalid command '\xe3\x80\x80\xe3\x80\x80DAV', perhaps misspelled or defined by a module not included in the server configuration
Apr 23 21:00:15 iZbp1hvbibqwiui44dxo6bZ systemd: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 23 21:00:15 iZbp1hvbibqwiui44dxo6bZ kill: kill: cannot find process ""
Apr 23 21:00:15 iZbp1hvbibqwiui44dxo6bZ systemd: httpd.service: control process exited, code=exited status=1
Apr 23 21:00:15 iZbp1hvbibqwiui44dxo6bZ systemd: Failed to start The Apache HTTP Server.
Apr 23 21:00:15 iZbp1hvbibqwiui44dxo6bZ systemd: Unit httpd.service entered failed state.
Apr 23 21:00:15 iZbp1hvbibqwiui44dxo6bZ systemd: httpd.service failed.
AH00526: Syntax error on line 6 of /etc/httpd/conf.d/subversion.conf: 说明配置文件的第六行有问题。
找到配置文件,发现中文注释忘记去掉。修改后再次启动
[[email protected] /]# systemctl start httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
还是报错
Apr 24 09:46:00 iZbp1hvbibqwiui44dxo6bZ systemd-logind: New session 3523 of user root.
Apr 24 09:46:00 iZbp1hvbibqwiui44dxo6bZ systemd: Started Session 3523 of user root.
Apr 24 09:46:05 iZbp1hvbibqwiui44dxo6bZ systemd-logind: Removed session 3523.
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ systemd: Starting The Apache HTTP Server...
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ httpd: [Wed Apr 24 09:46:18.667828 2019] [so:warn] [pid 9636] AH01574: module dav_svn_module is already loaded, skipping
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ httpd: [Wed Apr 24 09:46:18.667915 2019] [so:warn] [pid 9636] AH01574: module authz_svn_module is already loaded, skipping
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ httpd: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.16.53.56. Set the 'ServerName' directive globally to suppress this message
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ httpd: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ httpd: no listening sockets available, shutting down
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ httpd: AH00015: Unable to open logs
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ systemd: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ kill: kill: cannot find process ""
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ systemd: httpd.service: control process exited, code=exited status=1
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ systemd: Failed to start The Apache HTTP Server.
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ systemd: Unit httpd.service entered failed state.
Apr 24 09:46:18 iZbp1hvbibqwiui44dxo6bZ systemd: httpd.service failed.
发现两条错误信息
- httpd: Could not reliably determine the server’s fully qualified domain name, using 172.16.53.56. Set the ‘ServerName’ directive globally to suppress this message
第一条错误说明 使用172.16.53.56无法可靠地确定服务器的完全限定域名。全局设置’ServerName’指令来禁止此消息
- (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80.
第二条错误应该是由于端口被占用导致的
查看80端口使用:
[[email protected] log]# netstat -antlp | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 660/nginx: worker p
发现nginx占用了80端口,可以停止nginx,笔者选择修改apache的默认端口
指定ServerName 并 修改apache默认端口
[[email protected] /]# find / -name httpd
/run/httpd
/etc/sysconfig/httpd
/etc/logrotate.d/httpd
/etc/httpd
/var/cache/httpd
/var/log/httpd
/usr/share/httpd
/usr/lib64/httpd
/usr/sbin/httpd
/usr/libexec/initscripts/legacy-actions/httpd
[[email protected] /]# cd /etc/httpd
[[email protected] httpd]# ll
total 12
drwxr-xr-x 2 root root 4096 Apr 24 10:06 conf
drwxr-xr-x 2 root root 4096 Apr 24 10:53 conf.d
drwxr-xr-x 2 root root 4096 Apr 23 20:42 conf.modules.d
lrwxrwxrwx 1 root root 19 Apr 23 20:20 logs -> ../../var/log/httpd
lrwxrwxrwx 1 root root 29 Apr 23 20:20 modules -> ../../usr/lib64/httpd/modules
lrwxrwxrwx 1 root root 10 Apr 23 20:20 run -> /run/httpd
[[email protected] httpd]# cd conf
[[email protected] conf]# ll
total 28
-rw-r--r-- 1 root root 11750 Apr 24 10:06 httpd.conf
-rw-r--r-- 1 root root 13077 Nov 5 09:47 magic
[[email protected] conf]# vim httpd.conf
找到serverName ,打开注释,并改为 localhost:5555
找到Listen 80 修改为 Listen 5555
再次启动
[ro[email protected] conf]# systemctl start httpd.service
防火墙开放5555端口
[[email protected] conf]# firewall-cmd --zone=public --add-port=5555/tcp --permanent
[roo[email protected] conf]# firewall-cmd --complete-reload
浏览器地址输入http://ip/svnadmin ,成功!