系统环境:
OS:Centos8
OS kernel:4.18.0-539.el8.x86_64
Testlink:1.9.20
MySQL Server version: 8.0.36
PHP 7.2.24 (cli)
1.下载Testlink
https://testlink.org/
下载完后上传至服务器
testlink-1.9.20.tar.gz
解压
tar -zxvf testlink-1.9.20.tar.gz
重命令为testlink
移动到/var/www/html目录下
[root@localhost html]# ls
info.php testlink
[root@localhost html]# pwd
/var/www/html
[root@localhost html]#
2.下载环境必备依赖工具
需要Mysql,PHP (版本不要过低)
若已经安装有低版本 先卸载
#查找
rpm -qa | egrep -i "mysql|php"
#卸载
rpm -e xxxxx.rpm
配置MySQL:
centos8安装mysql8.0.22教程(超详细)_centos8中mod_auth_mysql-优快云博客
配置epel :
CentOS8的yum源和EPEL源都设置为阿里云镜像的正确做法_centos8配置/etc/yum.repos.d/epel.repo-优快云博客
配置 remi:
CentOS 8/RHEL 8 REMI 仓库安装教程_(redhat-release >= 8.8 or centos-stream-release >=-优快云博客
下载以下依赖:
yum install httpd
yum install mysql
yum install php php-opcache php-devel php-mbstring php-mcrypt php-cli php-gd php-curl php-mysqlnd php-ldap php-zip php-fileinfo php-pecl-xdebug php-pecl-xhprof php-xml php-json
3. 环境配置
创建数据库
#输入你配置后的root密码登录数据库
mysql -u root -p
#创建数据库
create database testlink character set utf8;
#创建用户testlink,所有IP可以访问,密码testlink
create user 'testlink'@'%' identified by 'testlink';
#将数据库testlink下的所有(*)授权给testlink
grant all privileges on testlink.* to 'testlink'@'%';
#刷新
flush privileges;
后面网页安装testlink若有数据库报错 mysql8 版本以上才有此问题
最后网页安装testlink的时候有个数据库报错 是php-mysql身份插件验证的问题
修改user指定host的加密插件为mysql_native_password
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'testlink';
mysql> show variables like 'default_authentication_plugin';
+-------------------------------+-----------------------+
| Variable_name | Value |
+-------------------------------+-----------------------+
| default_authentication_plugin | mysql_native_password |
+-------------------------------+-----------------------+
1 row in set (0.00 sec)
mysql> select user,host,plugin from mysql.user;
+------------------+-----------+-----------------------+
| user | host | plugin |
+------------------+-----------+-----------------------+
| root | % | sha256_password |
| testlink | % | mysql_native_password |
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session | localhost | caching_sha2_password |
| mysql.sys | localhost | caching_sha2_password |
| redmine | localhost | mysql_native_password |
| testlink | localhost | mysql_native_password |
+------------------+-----------+-----------------------+
7 rows in set (0.00 sec)
mysql> show grants for 'testlink';
+--------------------------------------------------------+
| Grants for testlink@% |
+--------------------------------------------------------+
| GRANT USAGE ON *.* TO `testlink`@`%` |
| GRANT ALL PRIVILEGES ON `testlink`.* TO `testlink`@`%` |
+--------------------------------------------------------+
2 rows in set (0.00 sec)
mysql>exit;
关闭sellinux
vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disable
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
关闭防火墙 或者添加访问端口
[root@localhost ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1021/sshd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 1570/smbd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 1570/smbd
tcp6 0 0 :::22 :::* LISTEN 1021/sshd
tcp6 0 0 :::3000 :::* LISTEN 7524/httpd
tcp6 0 0 :::445 :::* LISTEN 1570/smbd
tcp6 0 0 :::33060 :::* LISTEN 2192/mysqld
tcp6 0 0 :::3306 :::* LISTEN 2192/mysqld
tcp6 0 0 :::139 :::* LISTEN 1570/smbd
tcp6 0 0 :::80 :::* LISTEN 7524/httpd
[root@localhost ~]# firewall-cmd --zone=public --list-ports
80/tcp 300/tcp 3000/tcp 3306/tcp
[root@localhost ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
Warning: ALREADY_ENABLED: 3306:tcp
success
[root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
Warning: ALREADY_ENABLED: 80:tcp
success
[root@localhost ~]# firewall-cmd reload
usage: see firewall-cmd man page
firewall-cmd: error: unrecognized arguments: reload
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]#
http配置:
vim /etc/httpd/conf/httpd.conf
找到
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
php 配置:
vim /etc/php.ini
vim /etc/opt/remi/php72/php.ini
修改上传文件大小
upload_max_filesize = 8M
修改会话时间
session.gc_maxlifetime = 2880
修改执行时间
max_execution_time = 120
4. testlink 配置
编辑配置文件
cp /var/www/html/testlink/custom_config.inc.php.example /var/www/html/testlink/custom_config.inc.php
chown -R apache:apache /var/www/html/testlink/
chmod -R 777 /var/www/html/testlink/gui/
chmod -R 777 /var/www/html/testlink/logs/
chmod -R 777 /var/www/html/testlink/upload_area/
更改路径
vim /var/www/html/testlink/custom_config.inc.php
// $tlCfg->log_path = '/var/testlink-ga-testlink-code/logs/'; /* unix example */
// $g_repositoryPath = '/var/testlink-ga-testlink-code/upload_area/'; /* unix example */
$tlCfg->log_path = '/var/www/html/testlink/logs/';
$g_repositoryPath = '/var/www/html/testlink/upload_area/';
$tlCfg->config_check_warning_mode = 'SILENT';
修改testlink导入文件大小 (先修改php上传文件大小)
vim /var/www/html/testlink/config.inc.php
/** Maximum uploadfile size to importing stuff in TL */
// Also check your PHP settings (default is usually 2MBs)
// unit BYTES is required by MAX_FILE_SIZE HTML option
$tlCfg->import_file_max_size_bytes = '81920000';
/** Maximum line size of the imported file */
$tlCfg->import_max_row = '100000'; // in chars
5. 网页输入http:ip/testlink 进行安装
重启 mysql php-fpm httpd 服务 然后网页输入http:ip/testlink 进行安装
若数据库报错先检查是否mysql身份插件验证问题
仍报错按提示修改config_db.inc.php文件
<?php
// Automatically Generated by TestLink Installer - Mon, 26 Feb 24 09:49:39 +0000
define('DB_TYPE', 'mysql');
define('DB_USER', 'testlink');
define('DB_PASS', 'testlink');
define('DB_HOST', 'localhost');
define('DB_NAME', 'testlink');
define('DB_TABLE_PREFIX', '');
刷新网页重新安装
默认账号密码admin/admin
5. 允许testlink上传粘贴图片附件
下载CKFinder
https://ckeditor.com/ckfinder/
上传至服务器解压到/var/www/html/testlink/third_party 路径下
创建userfiles文件夹存放上传文件
[root@localhost third_party]# pwd
/var/www/html/testlink/third_party
[root@localhost ckfinder]# mkfir userfiles
[root@localhost third_party]# ll ckfinder/
total 628
-rwxrwxrwx. 1 apache apache 20752 Feb 26 22:48 CHANGELOG.html
-rwxrwxrwx. 1 apache apache 454 Feb 26 22:48 ckfinder.html
-rwxrwxrwx. 1 apache apache 542342 Feb 26 22:48 ckfinder.js
-rwxrwxrwx. 1 apache apache 327 Feb 26 22:48 config.js
-rwxrwxrwx. 1 apache apache 6946 Feb 26 22:48 config.php
drwxrwxrwx. 3 apache apache 4096 Feb 26 22:46 core
drwxrwxrwx. 2 apache apache 4096 Feb 26 22:46 lang
drwxrwxrwx. 3 apache apache 4096 Feb 26 22:46 libs
-rwxrwxrwx. 1 apache apache 20519 Feb 26 22:46 LICENSE.html
drwxrwxrwx. 2 apache apache 4096 Feb 26 22:46 plugins
-rwxrwxrwx. 1 apache apache 2628 Feb 26 22:46 README.html
drwxrwxrwx. 6 apache apache 4096 Feb 26 22:46 samples
drwxrwxrwx. 6 apache apache 4096 Feb 26 22:46 skins
drwxrwxrwx. 2 apache apache 4096 Feb 26 22:46 userfiles
[root@localhost third_party]#
编辑vim config.php
/*=================================== Backends ========================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_backends
$config['backends'][] = array(
'name' => 'default',
'adapter' => 'local',
'baseUrl' => 'http://ip地址/testlink/third_party/ckfinder/userfiles/',
'root' => '/var/www/html/testlink/third_party/ckfinder/userfiles/', // Can be used to explicitly set the CKFinder user files directory.
'chmodFiles' => 0777,
'chmodFolders' => 0755,
'filesystemEncoding' => 'UTF-8',
);
编辑/var/www/html/testlink/cfg/.htaccess
## .htaccess - [TL INSTALL DIR]/cfg
# need to allow access to tl_ckeditor_config.js
# or CKEditor will not load toolbar
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)$ index.php/$1 [L]
</IfModule>
然后重启php-fpm httpd 服务
登录testlink
在试一下上传文档 ok 没问题
上传的文件会在我们设置的目录下
6. 关联redmine
一定要检查依赖坏境有没有漏掉的!!!
因为php-xml 没有安装上 (安装好了不用管了)
关联redmine的时候会出现 空白页 没有显示报错 也没有成功
检查日志 发现这个文件有问题
cat /var/log/httpd/testlink.example.com-access_log
然后编辑这个文件 在前面添加这段代码定位问题
vim /var/www/html/testlink/lib/issuetrackers/issueTrackerEdit.php
ini_set("display_errors","On");
error_reporting(E_ALL);
然后testlink 浏览器界面 关联 redmine 的时候就会显示 那个php 文件 第几行 代码报错了
显示/var/www/html/testlink/lib/issuetrackerintegration/issueTrackerInterface.class.php 的115行代码有问题
PHP: Call to undefined function: simplexml_load_string() testlink/lib/issuetrackerintegration/issueTrackerInterface.class.php on line 115
再次排查问题
对于 PHP 7 和 Ubuntu 14.04,程序如下。由于 PHP 7 不在官方的 Ubuntu PPA 中,您可能通过 Ondřej Surý 的 PPA (sudo add-apt-repository ppa:ondrej/php) 安装了它。转到 /etc/php/7.0/fpm 并编辑php.ini,取消注释到以下行:
extension=php_xmlrpc.dll
sudo apt-get install php7.0-xml
CentOS8 重新安装
yum install php-xml
重启httpd php-fpm
然后在testlink 浏览器重新关联redmine
<!-- Template redminerestInterface -->
<issuetracker>
<apikey>redmine key</apikey>
<uribase>http://redmine ip/</uribase>
<uriview>http://redmine ip/projects/项目名称/issues</uriview>
<projectidentifier>项目名称标识</projectidentifier>
</issuetracker>
redmine key api
redmine 标识
点击连接检查
testlink 项目 勾选启用问题跟踪系统
设置为活动如下显示
然后我们执行测试不通过可以直接创建问题或者关联问题
在redmine 会同步创建问题
点进去会看到详细 以及测试用例执行