CentOS7+apache+svn+jsvnadmin 搭建HTTP版本SVN(超详细篇,自己踩的坑,记录下来)
时间:2018-12-03 13:56 来源:linux.it.net.cn 作者:IT
CentOS7+apache+svn+jsvnadmin 搭建HTTP版本SVN(超详细篇,自己踩的坑,记录下来)
1,环境
Centos7.4 (我这里是VMware14创建的虚拟机环境)+mysql5.6.40(没有的话在后续步骤有安装,有的话不用管,mysql版本不限制)
2,步骤
先说明,
1,系统以普通用户身份登录,需要管理员身份操作时再切换换来
2,输入指令最好手动输入,复制粘贴容易出现空格问题,有些地方不能有空格的,在复制网页内容时容易加上空格,导致报错
3,本文纯手打,个别错别字请不要在意,这套流程是我重新开的一个虚拟机一步步做的,我想应该是可以一步成功的!
安装apache
# yum install httpd
[root@liubity-fbs-db /]# yum -y install httpd
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirror.bit.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-80.el7.centos.1 将被 安装
--> 正在处理依赖关系 httpd-tools = 2.4.6-80.el7.centos.1,它被软件包 httpd-2.4.6-80.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 /etc/mime.types,它被软件包 httpd-2.4.6-80.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 libaprutil-1.so.0()(64bit),它被软件包 httpd-2.4.6-80.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 libapr-1.so.0()(64bit),它被软件包 httpd-2.4.6-80.el7.centos.1.x86_64 需要
--> 正在检查事务
---> 软件包 apr.x86_64.0.1.4.8-3.el7_4.1 将被 安装
---> 软件包 apr-util.x86_64.0.1.5.2-6.el7 将被 安装
---> 软件包 httpd-tools.x86_64.0.2.4.6-80.el7.centos.1 将被 安装
---> 软件包 mailcap.noarch.0.2.1.41-2.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=========================================================================================================================================================================================================================================
Package 架构 版本 源 大小
=========================================================================================================================================================================================================================================
正在安装:
httpd x86_64 2.4.6-80.el7.centos.1 updates 2.7 M
为依赖而安装:
apr x86_64 1.4.8-3.el7_4.1 base 103 k
apr-util x86_64 1.5.2-6.el7 base 92 k
httpd-tools x86_64 2.4.6-80.el7.centos.1 updates 90 k
mailcap noarch 2.1.41-2.el7 base 31 k
事务概要
=========================================================================================================================================================================================================================================
安装 1 软件包 (+4 依赖软件包)
总下载量:3.0 M
安装大小:10 M
Downloading packages:
(1/5): apr-1.4.8-3.el7_4.1.x86_64.rpm | 103 kB 00:00:00
(2/5): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00
(3/5): httpd-2.4.6-80.el7.centos.1.x86_64.rpm | 2.7 MB 00:00:01
(4/5): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:01
(5/5): httpd-tools-2.4.6-80.el7.centos.1.x86_64.rpm | 90 kB 00:00:01
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 1.2 MB/s | 3.0 MB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : apr-1.4.8-3.el7_4.1.x86_64 1/5
正在安装 : apr-util-1.5.2-6.el7.x86_64 2/5
正在安装 : httpd-tools-2.4.6-80.el7.centos.1.x86_64 3/5
正在安装 : mailcap-2.1.41-2.el7.noarch 4/5
正在安装 : httpd-2.4.6-80.el7.centos.1.x86_64 5/5
验证中 : mailcap-2.1.41-2.el7.noarch 1/5
验证中 : httpd-tools-2.4.6-80.el7.centos.1.x86_64 2/5
验证中 : apr-util-1.5.2-6.el7.x86_64 3/5
验证中 : apr-1.4.8-3.el7_4.1.x86_64 4/5
验证中 : httpd-2.4.6-80.el7.centos.1.x86_64 5/5
已安装:
httpd.x86_64 0:2.4.6-80.el7.centos.1
作为依赖被安装:
apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-80.el7.centos.1 mailcap.noarch 0:2.1.41-2.el7
完毕!
开启apache服务(Centos7 开启服务换成了systemctl 命令)
# systemctl start httpd
查看apache是否启动
# systemctl status httpd
[root@liubity-fbs-db /]# systemctl start httpd
[root@liubity-fbs-db /]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since 五 2018-07-20 15:28:43 CST; 13s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 46879 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─46879 /usr/sbin/httpd -DFOREGROUND
├─46880 /usr/sbin/httpd -DFOREGROUND
├─46881 /usr/sbin/httpd -DFOREGROUND
├─46882 /usr/sbin/httpd -DFOREGROUND
├─46883 /usr/sbin/httpd -DFOREGROUND
└─46884 /usr/sbin/httpd -DFOREGROUND
7月 20 15:28:43 liubity-fbs-db systemd[1]: Starting The Apache HTTP Server...
7月 20 15:28:43 liubity-fbs-db systemd[1]: Started The Apache HTTP Server.
[root@liubity-fbs-db /]#
设置开机自自动apache服务
# systemctl enable httpd
(取消开机自自动 systemctl disable httpd)
修改 /etc/httpd/conf/httpd.conf 文件
# vim /etc/httpd/conf/httpd.conf
找到ServerName 并修改成
ServerName localhost:80
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80
防火墙中打开80端口:顺便把3306端口,等下你要开发的tomcat端口也打开(我的tomcat端口修改为90)
#firewall-cmd --zone=public --add-port=80/tcp --permanent
#firewall-cmd --zone=public --add-port=3306/tcp --permanent
#firewall-cmd --zone=public --add-port=90/tcp --permanent
重新加载firewall服务
#firewall-cmd --reload
查看开发的端口情况
#firewall-cmd --list-ports
[root@liubity-fbs-db /]# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
[root@liubity-fbs-db /]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[root@liubity-fbs-db /]# firewall-cmd --zone=public --add-port=90/tcp --permanent
success
[root@liubity-fbs-db /]# firewall-cmd --reload
success
[root@liubity-fbs-db /]# firewall-cmd --list-ports
80/tcp 3306/tcp 90/tcp
[root@liubity-fbs-db /]#
完成操作之后可以在浏览器输入你的服务器IP,可以看到如下图 说明apache启动成功!
安装SVN服务
# yum install mod_dav_svn subversion
依赖关系解决
=========================================================================================================================================================================================================================================
Package 架构 版本 源 大小
=========================================================================================================================================================================================================================================
正在安装:
mod_dav_svn x86_64 1.7.14-14.el7 base 102 k
subversion x86_64 1.7.14-14.el7 base 1.0 M
为依赖而安装:
gnutls x86_64 3.3.26-9.el7 base 677 k
neon x86_64 0.30.0-3.el7 base 165 k
nettle x86_64 2.7.1-8.el7 base 327 k
pakchois x86_64 0.4-10.el7 base 14 k
subversion-libs x86_64 1.7.14-14.el7 base 922 k
trousers x86_64 0.3.14-2.el7 base 289 k
事务概要
=========================================================================================================================================================================================================================================
安装 2 软件包 (+6 依赖软件包)
总下载量:3.4 M
安装大小:11 M
Is this ok [y/d/N]: y
Downloading packages:
(1/8): gnutls-3.3.26-9.el7.x86_64.rpm | 677 kB 00:00:00
(2/8): mod_dav_svn-1.7.14-14.el7.x86_64.rpm | 102 kB 00:00:00
(3/8): subversion-1.7.14-14.el7.x86_64.rpm | 1.0 MB 00:00:00
(4/8): trousers-0.3.14-2.el7.x86_64.rpm | 289 kB 00:00:00
(5/8): subversion-libs-1.7.14-14.el7.x86_64.rpm | 922 kB 00:00:00
(6/8): neon-0.30.0-3.el7.x86_64.rpm | 165 kB 00:00:01
(7/8): pakchois-0.4-10.el7.x86_64.rpm | 14 kB 00:00:01
(8/8): nettle-2.7.1-8.el7.x86_64.rpm | 327 kB 00:00:03
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 1.0 MB/s | 3.4 MB 00:00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : pakchois-0.4-10.el7.x86_64 1/8
正在安装 : nettle-2.7.1-8.el7.x86_64 2/8
正在安装 : trousers-0.3.14-2.el7.x86_64 3/8
正在安装 : gnutls-3.3.26-9.el7.x86_64 4/8
正在安装 : neon-0.30.0-3.el7.x86_64 5/8
正在安装 : subversion-libs-1.7.14-14.el7.x86_64 6/8
正在安装 : mod_dav_svn-1.7.14-14.el7.x86_64 7/8
正在安装 : subversion-1.7.14-14.el7.x86_64 8/8
验证中 : trousers-0.3.14-2.el7.x86_64 1/8
验证中 : mod_dav_svn-1.7.14-14.el7.x86_64 2/8
验证中 : neon-0.30.0-3.el7.x86_64 3/8
验证中 : subversion-1.7.14-14.el7.x86_64 4/8
验证中 : subversion-libs-1.7.14-14.el7.x86_64 5/8
验证中 : nettle-2.7.1-8.el7.x86_64 6/8
验证中 : pakchois-0.4-10.el7.x86_64 7/8
验证中 : gnutls-3.3.26-9.el7.x86_64 8/8
已安装:
mod_dav_svn.x86_64 0:1.7.14-14.el7 subversion.x86_64 0:1.7.14-14.el7
作为依赖被安装:
gnutls.x86_64 0:3.3.26-9.el7 neon.x86_64 0:0.30.0-3.el7 nettle.x86_64 0:2.7.1-8.el7 pakchois.x86_64 0:0.4-10.el7 subversion-libs.x86_64 0:1.7.14-14.el7 trousers.x86_64 0:0.3.14-2.el7
完毕!
[root@liubity-fbs-db /]#
必须安装mod_dav_svn模块
查看测试是否安装svn模块
# ls /etc/httpd/modules/ | grep svn
[root@liubity-fbs-db /]# ls /etc/httpd/modules/ | grep svn
mod_authz_svn.so
mod_dav_svn.so
[root@liubity-fbs-db /]#
# svn --version
svn,版本 1.7.14 (r1542130)
编译于 Apr 11 2018,02:40:28
版权所有 (C) 2013 Apache 软件基金会。
此软件包含了许多人的贡献,请查看文件 NOTICE 以获得更多信息。
Subversion 是开放源代码软件,请参阅 http://subversion.apache.org/ 站点。
可使用以下的版本库访问模块:
* ra_neon : 通过 WebDAV 协议使用 neon 访问版本库的模块。
- 处理“http”方案
- 处理“https”方案
* ra_svn : 使用 svn 网络协议访问版本库的模块。 - 使用 Cyrus SASL 认证
- 处理“svn”方案
* ra_local : 访问本地磁盘的版本库模块。
- 处理“file”方案
[root@liubity-fbs-db /]#
安装完svn后要重启apache
#systemctl reload httpd
到这里SVN 安装完成
创建svn库主目录(多库模式,一份配置文件管理多个库)
# mkdir /svn/
[root@liubity-fbs-db /]# mkdir /svn
[root@liubity-fbs-db /]# cd /svn
[root@liubity-fbs-db svn]# ls
[root@liubity-fbs-db svn]# pwd
/svn
[root@liubity-fbs-db svn]#
进入 /etc/httpd/conf.d 目录
#cd /etc/httpd/conf.d
#ls
[root@liubity-fbs-db svn]# cd /etc/httpd/conf.d
[root@liubity-fbs-db conf.d]# ls
autoindex.conf README userdir.conf welcome.conf
[root@liubity-fbs-db conf.d]#
没有subversion.conf配置文件的话自己添加(如果有的话就不要自己添加)
如果此时的pwd 显示就在此目录下的话直接vim命令就可以
#vim subversion.conf
#Include /svn/httpd.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn/>
DAV svn
SVNListParentPath on
SVNParentPath /svn
AuthType Basic
AuthName "Subversionrepositories"
AuthUserFile /svn/passwd.http
AuthzSVNAccessFile /svn/authz
Require valid-user
</Location>
RedirectMatch ^(/svn)$ $1/
把内容负责进去 (检查要一样哦,记得第一行输入#或者空着,从第二行开始输入,自己踩的坑,得说明一下,不然会报405错误)
(vim操作 按esc键 输入:wq! 保存退出)
切换到/svn 目录下并创建passwd.http 和authz文件
#touch passwd.http
#touch authz
[root@liubity-fbs-db conf.d]# cd /svn
[root@liubity-fbs-db svn]# pwd
/svn
[root@liubity-fbs-db svn]# touch passwd.http
[root@liubity-fbs-db svn]# touch authz
[root@liubity-fbs-db svn]# ls
authz passwd.http
[root@liubity-fbs-db svn]#
安装jsvnadmin
jsvnadmin就是一个web项目
那么首先要安装tomcat 我用的是tomcat8.5. 我安装在/usr/local/tools目录下面
[root@liubity-fbs-db svn]# cd /usr/local
[root@liubity-fbs-db local]# ls
bin etc games include lib lib64 libexec sbin share src
[root@liubity-fbs-db local]# mkdir tools
[root@liubity-fbs-db local]# ls
bin etc games include lib lib64 libexec sbin share src tools
[root@liubity-fbs-db local]# cd tools
[root@liubity-fbs-db tools]# ls
[root@liubity-fbs-db tools]# wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.5.32/bin/apache-tomcat-8.5.32.tar.gz
下载好之后 解压
#tar -zxvf apache-tomcat-8.5.32
重命名
#mv apache-tomcat-8.5.32 svn-tomcat
进入tomcat的conf文件夹修改访问端口(改为我们刚才设置的90端口)
[root@liubity-fbs-db tools]# pwd
/usr/local/tools
[root@liubity-fbs-db tools]# ls
apache-tomcat-8.5.32.tar.gz svn-tomcat
[root@liubity-fbs-db tools]# cd svn-tomcat
[root@liubity-fbs-db svn-tomcat]# ls
bin conf lib LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp webapps work
[root@liubity-fbs-db svn-tomcat]# cd conf
[root@liubity-fbs-db conf]# ls
catalina.policy catalina.properties context.xml jaspic-providers.xml jaspic-providers.xsd logging.properties server.xml tomcat-users.xml tomcat-users.xsd web.xml
[root@liubity-fbs-db conf]# vim server.xml
<Connector port="90" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF8"/>
改好之后退出 删除webapps下的所有内容
[root@liubity-fbs-db conf]# cd ..
[root@liubity-fbs-db svn-tomcat]# ls
bin conf lib LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp webapps work
[root@liubity-fbs-db svn-tomcat]# cd webapps
[root@liubity-fbs-db webapps]# ls
docs examples host-manager manager ROOT
[root@liubity-fbs-db webapps]# rm -rf *
[root@liubity-fbs-db webapps]# ls
[root@liubity-fbs-db webapps]#
把svnadmin.war放进去
svnadmin-3.0.5.zip 需要的朋友点击这里https://pan.baidu.com/s/13jNqv7m-G6UcTCRpJ2hKUQ 密码 okm2
[root@liubity-fbs-db webapps]# ls
svnadmin.war
到这里如果不想自己下载解压工具的话就自己先把tomcat开启一遍,让tomcat解压war包
当然 启动tomcat需要java环境
到官网下载JDK 我用的jdk1.8
上传到服务器的/usr/local目录下
解压
#tar -zxvf jdk(你下载的jdk名称)
[root@liubity-fbs-db local]# ls
bin etc games include jdk1.8.0_171 jdk-8u171-linux-i586.tar.gz lib lib64 libexec sbin share src tools
[root@liubity-fbs-db local]# mv jdk1.8.0_171 jdk1.8
[root@liubity-fbs-db local]# ls
bin etc games include jdk1.8 jdk-8u171-linux-i586.tar.gz lib lib64 libexec sbin share src tools
[root@liubity-fbs-db local]#
配置java环境变量
#vim /etc/profile
添加如下内容到文件末尾
#java_env
JAVA_HOME=/usr/local/tools/java
JRE_HOME=$JAVA_HOME/jre
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/jre/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
export JAVA_HOME JRE_HOME PATH CLASSPATH
保存退出 (:wq!)(主要JAVA_HOME是你解压之后的文件夹的绝对路径名)
重启文件
#source /etc/profile
查看java是否成功安装
#java -version
[root@liubity-fbs-db local]# java --version
-bash: /usr/local/jdk1.8/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
我这里有个小问题 有个依赖没安装
解决办法 :#yum -y install glibc.i686
安装完之后再次查看有如下信息说明安装正确
[root@liubity-fbs-db local]# java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) Client VM (build 25.171-b11, mixed mode)
[root@liubity-fbs-db local]#
到这里java环境就安装好了 ,我们启动tomcat
# /usr/local/tools/svn-tomcat/bin/startup.sh
这里请按自己的实际目录来
[root@liubity-fbs-db local]# /usr/local/tools/svn-tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tools/svn-tomcat
Using CATALINA_HOME: /usr/local/tools/svn-tomcat
Using CATALINA_TMPDIR: /usr/local/tools/svn-tomcat/temp
Using JRE_HOME: /usr/local/jdk1.8/jre
Using CLASSPATH: /usr/local/tools/svn-tomcat/bin/bootstrap.jar:/usr/local/tools/svn-tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@liubity-fbs-db local]#
再次进入webapps目录 ,可以看到有个svnadmin文件夹
[root@liubity-fbs-db webapps]# pwd
/usr/local/tools/svn-tomcat/webapps
[root@liubity-fbs-db webapps]# ls
svnadmin svnadmin.war
[root@liubity-fbs-db webapps]#
编辑 /svnadmin/WEB-FIN/jdbc.properties文件
[root@liubity-fbs-db webapps]# cd svnadmin
[root@liubity-fbs-db svnadmin]# ls
chagelang.jsp error.jsp header.jsp i18nadd.jsp i18n.jsp login.jsp META-INF pjauth.jsp pjgr.jsp pjgrusr.jsp pj.jsp pjusr.jsp rep.jsp resources usr.jsp WEB-INF
[root@liubity-fbs-db svnadmin]# cd WEB-INF
[root@liubity-fbs-db WEB-INF]# ls
applicationContext.xml classes jdbc.properties lib web.xml
[root@liubity-fbs-db WEB-INF]# vim jdbc.properties
[root@liubity-fbs-db WEB-INF]#
修改 MySQL.jdbc.password=mysql (mysql 是你的数据库密码) 如下
db=MySQL
#MySQL
MySQL.jdbc.driver=com.mysql.jdbc.Driver
MySQL.jdbc.url=jdbc:mysql://127.0.0.1:3306/svnadmin?characterEncoding=utf-8
MySQL.jdbc.username=root
MySQL.jdbc.password=mysql
其他内容删掉!
此时访问你的svnadmin项目还不能成功 因为还差数据库没安装(如果你安装了的话 要导入数据)
安装MySQL 参考https://www.cnblogs.com/007sx/p/7083143.html
安装过程按照这个参考文档没问题,我也是这么来安装的,很方便
Starting mysqld (via systemctl): [ 确定 ]
[root@liubity-fbs-db local]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n]
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n]
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n]
... Success!
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up...
[root@liubity-fbs-db local]#
说明一下, 设置root密码时 我设置的是mysql,这个密码就是 刚才上面配置文件要的密码
其他的都按ENTER键就好了
安装完之后呢 创建数据库svnadmin
把刚才svnadmin.zip文件解压出来的 db 文件夹中的mysql5.sql 文件内容写入打svnadmin数据库 (不会请百度哦!)
完成工作之后重启tomcat
#/usr/local/tools/svn-tomcat/bin/shutdown.sh
# /usr/local/tools/svn-tomcat/bin/startup.sh
这时可以看到如下图片 说明服务启动OK
这时 切入到/svn目录
[root@liubity-fbs-db local]# cd /svn
[root@liubity-fbs-db svn]# ls
authz httpd.conf liubity_fbs passwd.http
[root@liubity-fbs-db svn]#
发现多了一个liubity_fbs的目录 (这个目录是由刚才在
创建的
我们删除这个目录,用svnadmin指令创建它
相关指令如下(这里要使用root权限了)
[root@liubity-fbs-db svn]# ls
authz httpd.conf liubity_fbs passwd.http
[root@liubity-fbs-db svn]# rm -rf liubity_fbs
[root@liubity-fbs-db svn]# ls
authz httpd.conf passwd.http
[root@liubity-fbs-db svn]# svnadmin create liubity_fbs
[root@liubity-fbs-db svn]# ls
authz httpd.conf liubity_fbs passwd.http
[root@liubity-fbs-db svn]# chown apache.apache liubity_fbs
[root@liubity-fbs-db svn]# chmod 777 liubity_fbs
[root@liubity-fbs-db svn]# ls
authz httpd.conf liubity_fbs passwd.http
[root@liubity-fbs-db svn]#
操作之后多了一个权限等级777 属于apche 的liubity_fbs的文件夹
drwxrwxrwx. 6 apache apache 86 7月 20 17:16 liubity_fbs
到这里就完成了全部工作
如下图
最后的最后,给svn-tomcat加个开机启动
#vim /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
##java_env
export JAVA_HOME=/usr/local/jdk1.8
##startup svn-tomcat
/usr/local/tools/svn-tomcat/bin/startup.sh
说明
1,这里的JAVA_HOME要重新写入一遍,值为你的JDK安装目录
2,如果设置之后没有自启动,很可能是没有给/etc/rc.d/rc.local文件给予执行权限
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
提示得很清楚了,具体操作
#chmod +x /etc/rc.d/rc.local
查看是否赋予了权限
[root@liubity-fbs-db ~]# ll /etc/rc.d/rc.local
-rwxr-xr-x. 1 root root 586 7月 23 11:05 /etc/rc.d/rc.local
有3个X说明赋予了执行权限
最后问题汇总:
可能出现的问题
1.认证失败
说明apache用户没有权限操作 你创立的文件夹
请执行
#chown apache.apache 文件夹名
#chmod 777 文件夹名
还有一种情况是 在admin用户没有读写权限,请在项目中给他赋予权限
2 405问题
一般是 /etc/httpd/conf/httpd.conf 文件有问题 或者 /etc/httpd/conf.d/subversion.conf文件有问题
3 500问题
如果是web端直接创建的文件夹可能会出现500问题 请删除文件用 svnadmin create 文件夹名 来建立仓库
(责任编辑:IT)
CentOS7+apache+svn+jsvnadmin 搭建HTTP版本SVN(超详细篇,自己踩的坑,记录下来)
1,环境
Centos7.4 (我这里是VMware14创建的虚拟机环境)+mysql5.6.40(没有的话在后续步骤有安装,有的话不用管,mysql版本不限制)
2,步骤
先说明,
1,系统以普通用户身份登录,需要管理员身份操作时再切换换来
2,输入指令最好手动输入,复制粘贴容易出现空格问题,有些地方不能有空格的,在复制网页内容时容易加上空格,导致报错
3,本文纯手打,个别错别字请不要在意,这套流程是我重新开的一个虚拟机一步步做的,我想应该是可以一步成功的!
安装apache
# yum install httpd
[root@liubity-fbs-db /]# yum -y install httpd
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirror.bit.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-80.el7.centos.1 将被 安装
--> 正在处理依赖关系 httpd-tools = 2.4.6-80.el7.centos.1,它被软件包 httpd-2.4.6-80.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 /etc/mime.types,它被软件包 httpd-2.4.6-80.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 libaprutil-1.so.0()(64bit),它被软件包 httpd-2.4.6-80.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 libapr-1.so.0()(64bit),它被软件包 httpd-2.4.6-80.el7.centos.1.x86_64 需要
--> 正在检查事务
---> 软件包 apr.x86_64.0.1.4.8-3.el7_4.1 将被 安装
---> 软件包 apr-util.x86_64.0.1.5.2-6.el7 将被 安装
---> 软件包 httpd-tools.x86_64.0.2.4.6-80.el7.centos.1 将被 安装
---> 软件包 mailcap.noarch.0.2.1.41-2.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=========================================================================================================================================================================================================================================
Package 架构 版本 源 大小
=========================================================================================================================================================================================================================================
正在安装:
httpd x86_64 2.4.6-80.el7.centos.1 updates 2.7 M
为依赖而安装:
apr x86_64 1.4.8-3.el7_4.1 base 103 k
apr-util x86_64 1.5.2-6.el7 base 92 k
httpd-tools x86_64 2.4.6-80.el7.centos.1 updates 90 k
mailcap noarch 2.1.41-2.el7 base 31 k
事务概要
=========================================================================================================================================================================================================================================
安装 1 软件包 (+4 依赖软件包)
总下载量:3.0 M
安装大小:10 M
Downloading packages:
(1/5): apr-1.4.8-3.el7_4.1.x86_64.rpm | 103 kB 00:00:00
(2/5): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00
(3/5): httpd-2.4.6-80.el7.centos.1.x86_64.rpm | 2.7 MB 00:00:01
(4/5): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:01
(5/5): httpd-tools-2.4.6-80.el7.centos.1.x86_64.rpm | 90 kB 00:00:01
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 1.2 MB/s | 3.0 MB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : apr-1.4.8-3.el7_4.1.x86_64 1/5
正在安装 : apr-util-1.5.2-6.el7.x86_64 2/5
正在安装 : httpd-tools-2.4.6-80.el7.centos.1.x86_64 3/5
正在安装 : mailcap-2.1.41-2.el7.noarch 4/5
正在安装 : httpd-2.4.6-80.el7.centos.1.x86_64 5/5
验证中 : mailcap-2.1.41-2.el7.noarch 1/5
验证中 : httpd-tools-2.4.6-80.el7.centos.1.x86_64 2/5
验证中 : apr-util-1.5.2-6.el7.x86_64 3/5
验证中 : apr-1.4.8-3.el7_4.1.x86_64 4/5
验证中 : httpd-2.4.6-80.el7.centos.1.x86_64 5/5
已安装:
httpd.x86_64 0:2.4.6-80.el7.centos.1
作为依赖被安装:
apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-80.el7.centos.1 mailcap.noarch 0:2.1.41-2.el7
完毕!
开启apache服务(Centos7 开启服务换成了systemctl 命令)
# systemctl start httpd
查看apache是否启动
# systemctl status httpd
[root@liubity-fbs-db /]# systemctl start httpd
[root@liubity-fbs-db /]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since 五 2018-07-20 15:28:43 CST; 13s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 46879 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─46879 /usr/sbin/httpd -DFOREGROUND
├─46880 /usr/sbin/httpd -DFOREGROUND
├─46881 /usr/sbin/httpd -DFOREGROUND
├─46882 /usr/sbin/httpd -DFOREGROUND
├─46883 /usr/sbin/httpd -DFOREGROUND
└─46884 /usr/sbin/httpd -DFOREGROUND
7月 20 15:28:43 liubity-fbs-db systemd[1]: Starting The Apache HTTP Server...
7月 20 15:28:43 liubity-fbs-db systemd[1]: Started The Apache HTTP Server.
[root@liubity-fbs-db /]#
设置开机自自动apache服务
# systemctl enable httpd
(取消开机自自动 systemctl disable httpd)
修改 /etc/httpd/conf/httpd.conf 文件
# vim /etc/httpd/conf/httpd.conf
找到ServerName 并修改成
ServerName localhost:80
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80
防火墙中打开80端口:顺便把3306端口,等下你要开发的tomcat端口也打开(我的tomcat端口修改为90)
#firewall-cmd --zone=public --add-port=80/tcp --permanent
#firewall-cmd --zone=public --add-port=3306/tcp --permanent
#firewall-cmd --zone=public --add-port=90/tcp --permanent
重新加载firewall服务
#firewall-cmd --reload
查看开发的端口情况
#firewall-cmd --list-ports
[root@liubity-fbs-db /]# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
[root@liubity-fbs-db /]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[root@liubity-fbs-db /]# firewall-cmd --zone=public --add-port=90/tcp --permanent
success
[root@liubity-fbs-db /]# firewall-cmd --reload
success
[root@liubity-fbs-db /]# firewall-cmd --list-ports
80/tcp 3306/tcp 90/tcp
[root@liubity-fbs-db /]#
完成操作之后可以在浏览器输入你的服务器IP,可以看到如下图 说明apache启动成功!
安装SVN服务
# yum install mod_dav_svn subversion
依赖关系解决
=========================================================================================================================================================================================================================================
Package 架构 版本 源 大小
=========================================================================================================================================================================================================================================
正在安装:
mod_dav_svn x86_64 1.7.14-14.el7 base 102 k
subversion x86_64 1.7.14-14.el7 base 1.0 M
为依赖而安装:
gnutls x86_64 3.3.26-9.el7 base 677 k
neon x86_64 0.30.0-3.el7 base 165 k
nettle x86_64 2.7.1-8.el7 base 327 k
pakchois x86_64 0.4-10.el7 base 14 k
subversion-libs x86_64 1.7.14-14.el7 base 922 k
trousers x86_64 0.3.14-2.el7 base 289 k
事务概要
=========================================================================================================================================================================================================================================
安装 2 软件包 (+6 依赖软件包)
总下载量:3.4 M
安装大小:11 M
Is this ok [y/d/N]: y
Downloading packages:
(1/8): gnutls-3.3.26-9.el7.x86_64.rpm | 677 kB 00:00:00
(2/8): mod_dav_svn-1.7.14-14.el7.x86_64.rpm | 102 kB 00:00:00
(3/8): subversion-1.7.14-14.el7.x86_64.rpm | 1.0 MB 00:00:00
(4/8): trousers-0.3.14-2.el7.x86_64.rpm | 289 kB 00:00:00
(5/8): subversion-libs-1.7.14-14.el7.x86_64.rpm | 922 kB 00:00:00
(6/8): neon-0.30.0-3.el7.x86_64.rpm | 165 kB 00:00:01
(7/8): pakchois-0.4-10.el7.x86_64.rpm | 14 kB 00:00:01
(8/8): nettle-2.7.1-8.el7.x86_64.rpm | 327 kB 00:00:03
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 1.0 MB/s | 3.4 MB 00:00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : pakchois-0.4-10.el7.x86_64 1/8
正在安装 : nettle-2.7.1-8.el7.x86_64 2/8
正在安装 : trousers-0.3.14-2.el7.x86_64 3/8
正在安装 : gnutls-3.3.26-9.el7.x86_64 4/8
正在安装 : neon-0.30.0-3.el7.x86_64 5/8
正在安装 : subversion-libs-1.7.14-14.el7.x86_64 6/8
正在安装 : mod_dav_svn-1.7.14-14.el7.x86_64 7/8
正在安装 : subversion-1.7.14-14.el7.x86_64 8/8
验证中 : trousers-0.3.14-2.el7.x86_64 1/8
验证中 : mod_dav_svn-1.7.14-14.el7.x86_64 2/8
验证中 : neon-0.30.0-3.el7.x86_64 3/8
验证中 : subversion-1.7.14-14.el7.x86_64 4/8
验证中 : subversion-libs-1.7.14-14.el7.x86_64 5/8
验证中 : nettle-2.7.1-8.el7.x86_64 6/8
验证中 : pakchois-0.4-10.el7.x86_64 7/8
验证中 : gnutls-3.3.26-9.el7.x86_64 8/8
已安装:
mod_dav_svn.x86_64 0:1.7.14-14.el7 subversion.x86_64 0:1.7.14-14.el7
作为依赖被安装:
gnutls.x86_64 0:3.3.26-9.el7 neon.x86_64 0:0.30.0-3.el7 nettle.x86_64 0:2.7.1-8.el7 pakchois.x86_64 0:0.4-10.el7 subversion-libs.x86_64 0:1.7.14-14.el7 trousers.x86_64 0:0.3.14-2.el7
完毕!
[root@liubity-fbs-db /]#
必须安装mod_dav_svn模块
查看测试是否安装svn模块
# ls /etc/httpd/modules/ | grep svn
[root@liubity-fbs-db /]# ls /etc/httpd/modules/ | grep svn
mod_authz_svn.so
mod_dav_svn.so
[root@liubity-fbs-db /]#
# svn --version
svn,版本 1.7.14 (r1542130)
编译于 Apr 11 2018,02:40:28
版权所有 (C) 2013 Apache 软件基金会。
此软件包含了许多人的贡献,请查看文件 NOTICE 以获得更多信息。
Subversion 是开放源代码软件,请参阅 http://subversion.apache.org/ 站点。
可使用以下的版本库访问模块:
* ra_neon : 通过 WebDAV 协议使用 neon 访问版本库的模块。
- 处理“http”方案
- 处理“https”方案
* ra_svn : 使用 svn 网络协议访问版本库的模块。 - 使用 Cyrus SASL 认证
- 处理“svn”方案
* ra_local : 访问本地磁盘的版本库模块。
- 处理“file”方案
[root@liubity-fbs-db /]#
安装完svn后要重启apache
#systemctl reload httpd
到这里SVN 安装完成
创建svn库主目录(多库模式,一份配置文件管理多个库)
# mkdir /svn/
[root@liubity-fbs-db /]# mkdir /svn
[root@liubity-fbs-db /]# cd /svn
[root@liubity-fbs-db svn]# ls
[root@liubity-fbs-db svn]# pwd
/svn
[root@liubity-fbs-db svn]#
进入 /etc/httpd/conf.d 目录
#cd /etc/httpd/conf.d
#ls
[root@liubity-fbs-db svn]# cd /etc/httpd/conf.d
[root@liubity-fbs-db conf.d]# ls
autoindex.conf README userdir.conf welcome.conf
[root@liubity-fbs-db conf.d]#
没有subversion.conf配置文件的话自己添加(如果有的话就不要自己添加)
如果此时的pwd 显示就在此目录下的话直接vim命令就可以
#vim subversion.conf
#Include /svn/httpd.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn/>
DAV svn
SVNListParentPath on
SVNParentPath /svn
AuthType Basic
AuthName "Subversionrepositories"
AuthUserFile /svn/passwd.http
AuthzSVNAccessFile /svn/authz
Require valid-user
</Location>
RedirectMatch ^(/svn)$ $1/
把内容负责进去 (检查要一样哦,记得第一行输入#或者空着,从第二行开始输入,自己踩的坑,得说明一下,不然会报405错误)
(vim操作 按esc键 输入:wq! 保存退出)
切换到/svn 目录下并创建passwd.http 和authz文件
#touch passwd.http
#touch authz
[root@liubity-fbs-db conf.d]# cd /svn
[root@liubity-fbs-db svn]# pwd
/svn
[root@liubity-fbs-db svn]# touch passwd.http
[root@liubity-fbs-db svn]# touch authz
[root@liubity-fbs-db svn]# ls
authz passwd.http
[root@liubity-fbs-db svn]#
安装jsvnadmin
jsvnadmin就是一个web项目
那么首先要安装tomcat 我用的是tomcat8.5. 我安装在/usr/local/tools目录下面
[root@liubity-fbs-db svn]# cd /usr/local
[root@liubity-fbs-db local]# ls
bin etc games include lib lib64 libexec sbin share src
[root@liubity-fbs-db local]# mkdir tools
[root@liubity-fbs-db local]# ls
bin etc games include lib lib64 libexec sbin share src tools
[root@liubity-fbs-db local]# cd tools
[root@liubity-fbs-db tools]# ls
[root@liubity-fbs-db tools]# wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.5.32/bin/apache-tomcat-8.5.32.tar.gz
下载好之后 解压
#tar -zxvf apache-tomcat-8.5.32
重命名
#mv apache-tomcat-8.5.32 svn-tomcat
进入tomcat的conf文件夹修改访问端口(改为我们刚才设置的90端口)
[root@liubity-fbs-db tools]# pwd
/usr/local/tools
[root@liubity-fbs-db tools]# ls
apache-tomcat-8.5.32.tar.gz svn-tomcat
[root@liubity-fbs-db tools]# cd svn-tomcat
[root@liubity-fbs-db svn-tomcat]# ls
bin conf lib LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp webapps work
[root@liubity-fbs-db svn-tomcat]# cd conf
[root@liubity-fbs-db conf]# ls
catalina.policy catalina.properties context.xml jaspic-providers.xml jaspic-providers.xsd logging.properties server.xml tomcat-users.xml tomcat-users.xsd web.xml
[root@liubity-fbs-db conf]# vim server.xml
<Connector port="90" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF8"/>
改好之后退出 删除webapps下的所有内容
[root@liubity-fbs-db conf]# cd ..
[root@liubity-fbs-db svn-tomcat]# ls
bin conf lib LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp webapps work
[root@liubity-fbs-db svn-tomcat]# cd webapps
[root@liubity-fbs-db webapps]# ls
docs examples host-manager manager ROOT
[root@liubity-fbs-db webapps]# rm -rf *
[root@liubity-fbs-db webapps]# ls
[root@liubity-fbs-db webapps]#
把svnadmin.war放进去
svnadmin-3.0.5.zip 需要的朋友点击这里https://pan.baidu.com/s/13jNqv7m-G6UcTCRpJ2hKUQ 密码 okm2
[root@liubity-fbs-db webapps]# ls
svnadmin.war
到这里如果不想自己下载解压工具的话就自己先把tomcat开启一遍,让tomcat解压war包
当然 启动tomcat需要java环境
到官网下载JDK 我用的jdk1.8
上传到服务器的/usr/local目录下
解压
#tar -zxvf jdk(你下载的jdk名称)
[root@liubity-fbs-db local]# ls
bin etc games include jdk1.8.0_171 jdk-8u171-linux-i586.tar.gz lib lib64 libexec sbin share src tools
[root@liubity-fbs-db local]# mv jdk1.8.0_171 jdk1.8
[root@liubity-fbs-db local]# ls
bin etc games include jdk1.8 jdk-8u171-linux-i586.tar.gz lib lib64 libexec sbin share src tools
[root@liubity-fbs-db local]#
配置java环境变量
#vim /etc/profile
添加如下内容到文件末尾
#java_env
JAVA_HOME=/usr/local/tools/java
JRE_HOME=$JAVA_HOME/jre
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/jre/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
export JAVA_HOME JRE_HOME PATH CLASSPATH
保存退出 (:wq!)(主要JAVA_HOME是你解压之后的文件夹的绝对路径名)
重启文件
#source /etc/profile
查看java是否成功安装
#java -version
[root@liubity-fbs-db local]# java --version
-bash: /usr/local/jdk1.8/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
我这里有个小问题 有个依赖没安装
解决办法 :#yum -y install glibc.i686
安装完之后再次查看有如下信息说明安装正确
[root@liubity-fbs-db local]# java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) Client VM (build 25.171-b11, mixed mode)
[root@liubity-fbs-db local]#
到这里java环境就安装好了 ,我们启动tomcat
# /usr/local/tools/svn-tomcat/bin/startup.sh
这里请按自己的实际目录来
[root@liubity-fbs-db local]# /usr/local/tools/svn-tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tools/svn-tomcat
Using CATALINA_HOME: /usr/local/tools/svn-tomcat
Using CATALINA_TMPDIR: /usr/local/tools/svn-tomcat/temp
Using JRE_HOME: /usr/local/jdk1.8/jre
Using CLASSPATH: /usr/local/tools/svn-tomcat/bin/bootstrap.jar:/usr/local/tools/svn-tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@liubity-fbs-db local]#
再次进入webapps目录 ,可以看到有个svnadmin文件夹
[root@liubity-fbs-db webapps]# pwd
/usr/local/tools/svn-tomcat/webapps
[root@liubity-fbs-db webapps]# ls
svnadmin svnadmin.war
[root@liubity-fbs-db webapps]#
编辑 /svnadmin/WEB-FIN/jdbc.properties文件
[root@liubity-fbs-db webapps]# cd svnadmin
[root@liubity-fbs-db svnadmin]# ls
chagelang.jsp error.jsp header.jsp i18nadd.jsp i18n.jsp login.jsp META-INF pjauth.jsp pjgr.jsp pjgrusr.jsp pj.jsp pjusr.jsp rep.jsp resources usr.jsp WEB-INF
[root@liubity-fbs-db svnadmin]# cd WEB-INF
[root@liubity-fbs-db WEB-INF]# ls
applicationContext.xml classes jdbc.properties lib web.xml
[root@liubity-fbs-db WEB-INF]# vim jdbc.properties
[root@liubity-fbs-db WEB-INF]#
修改 MySQL.jdbc.password=mysql (mysql 是你的数据库密码) 如下
db=MySQL
#MySQL
MySQL.jdbc.driver=com.mysql.jdbc.Driver
MySQL.jdbc.url=jdbc:mysql://127.0.0.1:3306/svnadmin?characterEncoding=utf-8
MySQL.jdbc.username=root
MySQL.jdbc.password=mysql
其他内容删掉!
此时访问你的svnadmin项目还不能成功 因为还差数据库没安装(如果你安装了的话 要导入数据)
安装MySQL 参考https://www.cnblogs.com/007sx/p/7083143.html
安装过程按照这个参考文档没问题,我也是这么来安装的,很方便
Starting mysqld (via systemctl): [ 确定 ]
[root@liubity-fbs-db local]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n]
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n]
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n]
... Success!
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up...
[root@liubity-fbs-db local]#
说明一下, 设置root密码时 我设置的是mysql,这个密码就是 刚才上面配置文件要的密码
其他的都按ENTER键就好了
安装完之后呢 创建数据库svnadmin
把刚才svnadmin.zip文件解压出来的 db 文件夹中的mysql5.sql 文件内容写入打svnadmin数据库 (不会请百度哦!)
完成工作之后重启tomcat
#/usr/local/tools/svn-tomcat/bin/shutdown.sh
# /usr/local/tools/svn-tomcat/bin/startup.sh
这时可以看到如下图片 说明服务启动OK
这时 切入到/svn目录
[root@liubity-fbs-db local]# cd /svn
[root@liubity-fbs-db svn]# ls
authz httpd.conf liubity_fbs passwd.http
[root@liubity-fbs-db svn]#
发现多了一个liubity_fbs的目录 (这个目录是由刚才在
创建的
我们删除这个目录,用svnadmin指令创建它
相关指令如下(这里要使用root权限了)
[root@liubity-fbs-db svn]# ls
authz httpd.conf liubity_fbs passwd.http
[root@liubity-fbs-db svn]# rm -rf liubity_fbs
[root@liubity-fbs-db svn]# ls
authz httpd.conf passwd.http
[root@liubity-fbs-db svn]# svnadmin create liubity_fbs
[root@liubity-fbs-db svn]# ls
authz httpd.conf liubity_fbs passwd.http
[root@liubity-fbs-db svn]# chown apache.apache liubity_fbs
[root@liubity-fbs-db svn]# chmod 777 liubity_fbs
[root@liubity-fbs-db svn]# ls
authz httpd.conf liubity_fbs passwd.http
[root@liubity-fbs-db svn]#
操作之后多了一个权限等级777 属于apche 的liubity_fbs的文件夹
drwxrwxrwx. 6 apache apache 86 7月 20 17:16 liubity_fbs
到这里就完成了全部工作
如下图
最后的最后,给svn-tomcat加个开机启动
#vim /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
##java_env
export JAVA_HOME=/usr/local/jdk1.8
##startup svn-tomcat
/usr/local/tools/svn-tomcat/bin/startup.sh
说明
1,这里的JAVA_HOME要重新写入一遍,值为你的JDK安装目录
2,如果设置之后没有自启动,很可能是没有给/etc/rc.d/rc.local文件给予执行权限
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
提示得很清楚了,具体操作
#chmod +x /etc/rc.d/rc.local
查看是否赋予了权限
[root@liubity-fbs-db ~]# ll /etc/rc.d/rc.local
-rwxr-xr-x. 1 root root 586 7月 23 11:05 /etc/rc.d/rc.local
有3个X说明赋予了执行权限
最后问题汇总:
可能出现的问题
1.认证失败
说明apache用户没有权限操作 你创立的文件夹
请执行
#chown apache.apache 文件夹名
#chmod 777 文件夹名
还有一种情况是 在admin用户没有读写权限,请在项目中给他赋予权限
2 405问题
一般是 /etc/httpd/conf/httpd.conf 文件有问题 或者 /etc/httpd/conf.d/subversion.conf文件有问题
3 500问题
如果是web端直接创建的文件夹可能会出现500问题 请删除文件用 svnadmin create 文件夹名 来建立仓库
|