近到了一家新公司,公司剛剛起步,測(cè)試環(huán)境一片空白。所以我計(jì)劃先setup好一些測(cè)試工具,首先要做的是安裝并集成Testlink與bugzilla。 這個(gè)過(guò)程中遇到無(wú)數(shù)的坑,特記錄之...
Apache/2.4.6
CentOS 7.1611 64 位
PHP 5.6.30
mysqld Ver 5.7.17 for Linux on x86_64 (MySQL Community Server (GPL))
Bugzilla version 4.4.12
Testlink 1.9.13
Perl v5.16.3
安裝過(guò)程(此處不在記錄CentOS的安裝了):
1. 安裝Apache
sudo yum install httpd
安裝完畢后設(shè)置apache系統(tǒng)啟動(dòng)
systemctl enable httpd
systemctl start httpd
2. 安裝mysql
在你的home目錄下,(這里比較麻煩是因?yàn)?yum默認(rèn)安裝的不是5.7的)
wget http://repo.mysql.com/mysql57-community-release-el7-9.noarch.rpm (這個(gè)有可能會(huì)變化,你可以輸入http://repo.mysql.com/查看那個(gè)有效)
安裝 mysql57-community-release-el7-9.noarch.rpm:
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
安裝完后,得到如下兩個(gè)包:
mysql-community.repo
mysql-community-source.repo
安裝 MySQL:
yum install mysql-server
遇到疑問(wèn)的地方,一路 Y 下去即可;
systemctl start mysqld
systemctl enable mysqld
安裝完畢后,嘗試登陸mysql 用下面的命令:
mysql -u root mysql
由于不知道密碼所以無(wú)法登陸,但是此時(shí)在 /var/log/mysqld.log 文件中會(huì)自動(dòng)生成一個(gè)隨機(jī)的密碼,我們需要先取得這個(gè)隨機(jī)密碼,以用于登錄 MySQL 服務(wù)端:
grep "password" /var/log/mysqld.log
打印如下內(nèi)容:
A temporary password is generated for root@localhost: hilX0U!9i3_6
我們復(fù)制 root@localhost: 后面的隨機(jī)字符串,這個(gè)字符串是 MySQL 在安裝完成后為我們隨機(jī)生成的密碼;
12 登錄到 MySQL 服務(wù)端并更新用戶 root 的密碼:
mysql -u root -p
打印出 MySQL 的版本即表明已登錄;
修改root的密碼:
After login, run the command bellow:
step 1: SET PASSWORD = PASSWORD(‘your new password‘);
step 2: ALTER USER ‘root‘@‘localhost‘ PASSWORD EXPIRE NEVER;
step 3: flush privileges;
注意:由于 MySQL5.7 采用了密碼強(qiáng)度驗(yàn)證插件 validate_password,故此我們需要設(shè)置一個(gè)有一定強(qiáng)度的密碼;
設(shè)置用戶 root 可以在任意 IP 下被訪問(wèn):
grant all privileges on *.* to root@"%" identified by "新密碼";
設(shè)置用戶 root 可以在本地被訪問(wèn):
grant all privileges on *.* to root@"localhost" identified by "新密碼";
刷新權(quán)限使之生效:
flush privileges;
輸入 exit 后用新密碼再次登錄看看吧!
修改MySQL 的字符集:
mysql> show variables like '%character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
可以看到有些選項(xiàng)用的不是utf8, 我們要將他們改成utf8.
打開(kāi) /etc/etc/my.cnf
在 [mysqld] 前添加如下代碼:
[client]
default-character-set=utf8
在 [mysqld] 后添加如下代碼:
character_set_server=utf8
重啟:
systemctl restart mysqld
再次查看字符集:
mysql> show variables like '%character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
3. 安裝php
如果你已經(jīng)安裝了php,但是版本不是5.6,那你要升級(jí)下。 查看版本號(hào): php -v
升級(jí)php:
設(shè)置一下倉(cāng)庫(kù):
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && rpm -Uvh epel-release-latest-7.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm && rpm -Uvh remi-release-7*.rpm
打開(kāi)配置文件
vi /etc/yum.repos.d/remi.repo
找到類似于[emi-php56]把其中的enable設(shè)成1, 其他項(xiàng)目中的enable都設(shè)成0
yum -y upgrade php*
修改php的配置已適應(yīng)testlink的需要
vi /etc/php.ini
session.gc_maxlifetime = 2400 max_execution_time = 120
4. 安裝perl和其他包
sudo yum install mod_ssl php-mysql php-gd php-ldap gcc perl* mod_perl-devel php-xml
php-xml必須要安裝的,因?yàn)闆](méi)有這個(gè)東西導(dǎo)致 Fatal error: Uncaught Error: Call to undefined function simplexml_load_file() 這個(gè)錯(cuò)誤
安裝完重新啟動(dòng)Apache
性關(guān)閉防火墻(你也可以自己添加規(guī)則,我比較懶(:
systemctl disable firewalld
systemctl stop firewalld
5. 安裝Testlink
現(xiàn)在新版是1.9.16,但是這個(gè)版本與bugzilla集成時(shí)無(wú)法把bug添加到一個(gè)fail的case上,錯(cuò)誤是當(dāng)你點(diǎn)擊你個(gè)小蟲(chóng)圖標(biāo)時(shí),打開(kāi)一個(gè)空白的窗口(這里我看過(guò)代碼,是因?yàn)閰?shù)處理的問(wèn)題,但是我找不到解決方案。)
下載 testlink-1.9.13.tar.gz ,這個(gè)版本的sql腳本和mysql5.6配合有問(wèn)題,所以我自己修改了下,之后會(huì)上傳一下(跟時(shí)間日期有關(guān)的常量,都用 CURRENT_TIME代替好了)
使用mysql5.7.17時(shí),安裝1.9.13將會(huì)出現(xiàn)安裝數(shù)據(jù)庫(kù)錯(cuò)誤,請(qǐng)用本文件下的sql文件代替 testlink/install/sql/mysql/testlink_create_tables.sql
# TestLink Open Source Project - http://testlink.sourceforge.net/
# This script is distributed under the GNU General Public License 2 or later.
# ---------------------------------------------------------------------------------------
# @filesource testlink_create_tables.sql
#
# SQL script - create all DB tables for MySQL
# tables are in alphabetic order
#
# ATTENTION: do not use a different naming convention, that one already in use.
#
# IMPORTANT NOTE:
# each NEW TABLE added here NEED TO BE DEFINED in object.class.php getDBTables()
#
# IMPORTANT NOTE - DATETIME or TIMESTAMP
# Extracted from MySQL Manual
#
# The TIMESTAMP column type provides a type that you can use to automatically
# mark INSERT or UPDATE operations with the current date and time.
# If you have multiple TIMESTAMP columns in a table, only the first one is updated automatically.
#
# Knowing this is clear that we can use in interchangable way DATETIME or TIMESTAMP
#
# Naming convention for column regarding date/time of creation or change
#
# Right or wrong from TL 1.7 we have used
#
# creation_ts
# modification_ts
#
# Then no other naming convention has to be used as:
# create_ts, modified_ts
#
# CRITIC:
# Because this file will be processed during installation doing text replaces
# to add TABLE PREFIX NAME, any NEW DDL CODE added must be respect present
# convention regarding case and spaces between DDL keywords.
#
# ---------------------------------------------------------------------------------------
# @internal revisions
#
# ---------------------------------------------------------------------------------------
CREATE TABLE /*prefix*/assignment_types (
`id` int(10) unsigned NOT NULL auto_increment,
`fk_table` varchar(30) default '',
`description` varchar(100) NOT NULL default 'unknown',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;
CREATE TABLE /*prefix*/assignment_status (
`id` int(10) unsigned NOT NULL auto_increment,
`description` varchar(100) NOT NULL default 'unknown',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;
CREATE TABLE /*prefix*/attachments (
`id` int(10) unsigned NOT NULL auto_increment,
`fk_id` int(10) unsigned NOT NULL default '0',
`fk_table` varchar(250) default '',
`title` varchar(250) default '',
`description` varchar(250) default '',
`file_name` varchar(250) NOT NULL default '',
`file_path` varchar(250) default '',
`file_size` int(11) NOT NULL default '0',
`file_type` varchar(250) NOT NULL default '',
`date_added` datetime NOT NULL default CURRENT_TIMESTAMP,
`content` longblob,
`compression_type` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;
CREATE TABLE /*prefix*/builds (
`id` int(10) unsigned NOT NULL auto_increment,
`testplan_id` int(10) unsigned NOT NULL default '0',
`name` varchar(100) NOT NULL default 'undefined',
`notes` text,
`active` tinyint(1) NOT NULL default '1',
`is_open` tinyint(1) NOT NULL default '1',
`author_id` int(10) unsigned default NULL,
`creation_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`release_date` date NULL,
`closed_on_date` date NULL,
PRIMARY KEY (`id`),
UNIQUE KEY /*prefix*/name (`testplan_id`,`name`),
KEY /*prefix*/testplan_id (`testplan_id`)
) DEFAULT CHARSET=utf8 COMMENT='Available builds';
CREATE TABLE /*prefix*/cfield_build_design_values (
`field_id` int(10) NOT NULL default '0',
`node_id` int(10) NOT NULL default '0',
`value` varchar(4000) NOT NULL default '',
PRIMARY KEY (`field_id`,`node_id`),
KEY /*prefix*/idx_cfield_build_design_values (`node_id`)
) DEFAULT CHARSET=utf8;
CREATE TABLE /*prefix*/cfield_design_values (
`field_id` int(10) NOT NULL default '0',
`node_id` int(10) NOT NULL default '0',
`value` varchar(4000) NOT NULL default '',
PRIMARY KEY (`field_id`,`node_id`),
KEY /*prefix*/idx_cfield_design_values (`node_id`)
) DEFAULT CHARSET=utf8;
CREATE TABLE /*prefix*/cfield_execution_values (
`field_id` int(10) NOT NULL default '0',
`execution_id` int(10) NOT NULL default '0',
`testplan_id` int(10) NOT NULL default '0',
`tcversion_id` int(10) NOT NULL default '0',
`value` varchar(4000) NOT NULL default '',
PRIMARY KEY (`field_id`,`execution_id`,`testplan_id`,`tcversion_id`)
) DEFAULT CHARSET=utf8;
CREATE TABLE /*prefix*/cfield_node_types (
`field_id` int(10) NOT NULL default '0',
`node_type_id` int(10) NOT NULL default '0',
PRIMARY KEY (`field_id`,`node_type_id`),
KEY /*prefix*/idx_custom_fields_assign (`node_type_id`)
) DEFAULT CHARSET=utf8;
CREATE TABLE /*prefix*/cfield_testprojects (
`field_id` int(10) unsigned NOT NULL default '0',
`testproject_id` int(10) unsigned NOT NULL default '0',
`display_order` smallint(5) unsigned NOT NULL default '1',
`location` smallint(5) unsigned NOT NULL default '1',
`active` tinyint(1) NOT NULL default '1',
`required` tinyint(1) NOT NULL default '0',
`required_on_design` tinyint(1) NOT NULL default '0',
`required_on_execution` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`field_id`,`testproject_id`)
) DEFAULT CHARSET=utf8;
CREATE TABLE /*prefix*/cfield_testplan_design_values (
`field_id` int(10) NOT NULL default '0',
`link_id` int(10) NOT NULL default '0' COMMENT 'point to testplan_tcversion id',
`value` varchar(4000) NOT NULL default '',
PRIMARY KEY (`field_id`,`link_id`),
KEY /*prefix*/idx_cfield_tplan_design_val (`link_id`)
) DEFAULT CHARSET=utf8;