SVN version management system installation and svnadmin encoding problem-yellowcong

The management environment of Centso+Apache+Subversion+Jsvnadmin is built. I have done Github's environment GitLab installation before - yellowcong

1. Apache installation

1.1 Installation

# 安装 httpd
yum install httpd httpd-devel

#启动服务
service httpd start 

#设置开机启动
chkconfig httpd on

#查看是否开机启动
systemctl list-unit-files |grep httpd

write picture description here

1.2 Configure port and ServerName

Set the port number and configure the ServerName. Because there is no dns service configuration, you need to modify the ServerName

#修改配置文件
vi /etc/httpd/conf/httpd.conf

#配置ServerName
Servername localhost:80

write picture description here

after modification
write picture description here

1.3 Open port 80

If you find that there is no iptables file, it means that iptables is not installed. You can check my iptables installation tutorial, http://blog.csdn.net/yelllowcong/article/details/78229862 After the installation is complete, perform the following operations

#编辑iptables
vim /etc/sysconfig/iptables

#开放80端口
-A INPUT -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT

#重启服务
restart  iptables.service

#查看80端口是否开放
iptables -L -n

write picture description here

1.4 Server check

In the browser, enter the ip address to see if the apache service is started
write picture description here

2. SVN installation

2.1 Install subversion

subversion, you need to install the dependent modules mod, dev, sun

#安装subversion
yum install mod_dav_svn subversion

#安装完成后,需要重启 apache服务
service httpd restart 

write picture description here

2.2 Check whether subversion is installed (there is a problem)

#查看是否安装好了这些模块
ls /etc/httpd/modules/ | grep svn

#查看svn的版本
svn --version  

svn modules in the /etc/httpd/modules/ directory
write picture description here

Version Information
write picture description here

2.3 Create a library

Create a svn library for storing code, this library will be used in the configuration process

mkdir /svn

2.4 Configure subversion.conf

#进入到配置文件目录 
vim /etc/httpd/conf.d/subversion.conf

#添加下面的到subversion.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 "Authorization"
        AuthUserFile /svn/passwd.http  //用户授权
        AuthzSVNAccessFile /svn/authz //访问控制
        Require valid-user
</Location>
RedirectMatch ^(/svn)$ $1/

#创建用户授权和访问控制空文件
touch /svn/passwd.http
touch /svn/authz

##重启apache服务
service httpd restart

Access the warehouse list through " http://localhost/svn/ ". If you want " http://localhost/svn " to work, you need to add redirection settings: RedirectMatch ^(/svn) 1/ , of course, methods such as RewriteEngine can also be used.

write picture description here

Service started successfully
write picture description here

3. jsvnadmin installation

Before installing jsvadmin, you need to install tomcat. If not, you can check the tutorial: http://blog.csdn.net/yelllowcong/article/details/75944304

3.1 Download the installation package

#下载安装包, 这个安装包是我从外国网站下的,真不容易啊
wget http://yellowcong.qiniudn.com/svnadmin-3.0.5.zip

#解压到指定的文件夹
unzip svnadmin-3.0.5.zip -d svnadmin

#删除包
rm svnadmin-3.0.5.zip

write picture description here

The decompressed directory structure, we need the svnadmin.war package inside
write picture description here

3.2 Install the war package


#停止tomcat,然后解压war包
unzip  svnadmin.war -d svnadmin

#删除war包
rm svnadmin.war

write picture description here

The directory structure of the war package after decompression, we need to modify the file jdbc.properties in the WEB-INF directory
write picture description here

3.3 Configure jdbc.properties

Configure database port, database, database username and password

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=root

write picture description here

3.4 Import table

If Mysql will not be installed, you can view my tutorial, http://blog.csdn.net/yelllowcong/article/details/75934201

Need to import scripts db/mysql5.sql and db/lang/en.sql

write picture description here

#创建数据库,一定要是utf8的,不然,会后悔的,会遇后面的错误
create database if not exists svnadmin default character set utf8;

#使用数据库
use svnadmin

#导入数据
source /usr/local/svnadmin/db/mysql5.sql
source /usr/local/svnadmin/db/lang/en.sql

#查看表
show tables 

Import Data
write picture description here

View table data
write picture description here

4. Start Tomcat

#启动服务
./startup.sh

#查看日志信息
tail -f -n 100 logs/catalina.out

write picture description here

Common mistakes

The server opens xx:port/svnadmin, but it reports an error, embarrassing

发生错误,请联系 QQ 56099823 或 报告一个Issue,以下是错误信息:
org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 28 25: } 26: %&gt; 27: 28: 29:

write picture description here

Looking at the log file of tomcat, it is found that it can probably be located, which is caused by the encoding problem of the database.

java.sql.SQLException: Incorrect string value: '\xE4\xB8\xAD\xE6\x96\x87' for column 'lbl' at row 1

write picture description here

Solution

Re-import the database, use utf8 encoding, the problem is solved

#创建数据库,一定要是utf8的,不然,会后悔的,会遇后面的错误
create database if not exists svnadmin default character set utf8;

#使用数据库
use svnadmin

#导入数据
source /usr/local/svnadmin/db/mysql5.sql
source /usr/local/svnadmin/db/lang/en.sql

Problem solved perfectly
write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324512552&siteId=291194637