对于Php的程序,已经很久没搞过安装,这次安装,也遇到一些麻烦,这里就记录一下,主要是php版本的问题。
Testlink目前的版本是1.19.6,对php 7.1支持有bug,所以我就换成php 5.6. CentOS 7 带的mariadb版本是5.5,Testlink要求是5.6以上的版本。
我实验的习惯,
最小化安装centos 7.x,update最新版本
关闭selinux,firewalld,完成初始化设置
安装epel源
Apache
这个就简单
yum install httpd
配置
sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf
sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" \
/etc/httpd/conf/httpd.conf
启动服务
systemctl start httpd.service
systemctl enable httpd.service
PHP 5.6
红帽目前默认的php版本是5.4,很多应用已经不支持,testlink要求的版本必须大于5.4.
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
安装
yum install php56 php56-php php56-php-mysqlnd \
php56-php-gd php56-php-mcrypt \
php56-php-mbstring php56-php-xml php56-php-cli php56-php-ldap
修改参数
sed -i "s/session.gc_maxlifetime = 1440/session.gc_maxlifetime = 2880/" /opt/remi/php56/root/etc/php.ini
sed -i "s/max_execution_time = 30/max_execution_time = 120/" /opt/remi/php56/root/etc/php.ini
重启httpd服务
systemctl restart httpd
php56 --version
php56 --modules
验证php是否生效
# cat /var/www/html/phpinfo.php
phpinfo();
?>
通过 ip/phpinfo.php 就可以访问到一个php信息页面。
数据库 MariaDB
数据库就是mariadb,红帽默认是5.5版本,testlink要求5.6以上的版本才能支持。
cat <
# MariaDB 10.1 CentOS repository list - created 2017-01-14 03:11 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
安装,这是 MariaDB 10.1版本
yum install MariaDB-server MariaDB-client -y
启动服务
systemctl start mariadb.service
systemctl enable mariadb.service
安全设置
/usr/bin/mysql_secure_installation
Testlink
初始化mysql数据库
mysql -uroot -p
创建testlink数据库
CREATE DATABASE testlink;
CREATE USER 'testlinkuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON testlink.* TO 'testlinkuser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
下载安装包
wget http://github.com/TestLinkOpenSourceTRMS/testlink-code/archive/1.9.16.tar.gz
tar -zxvf 1.9.16.tar.gz -C /var/www/html
配置
cp /var/www/html/testlink-code-1.9.16/custom_config.inc.php.example \
/var/www/html/testlink-code-1.9.16/custom_config.inc.php
编辑 /var/www/html/testlink-code-1.9.16/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-code-1.9.16/logs/';
$g_repositoryPath = '/var/www/html/testlink-code-1.9.16/upload_area/';
$tlCfg->config_check_warning_mode = 'SILENT';
设置权限
chown -R apache:apache /var/www/html/testlink-code-1.9.16
配置虚拟主机
cat <
ServerAdmin admin@example.com
DocumentRoot /var/www/html/testlink-code-1.9.16/
ServerName testlink.example.com
ServerAlias www.testlink.example.com
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
ErrorLog /var/log/httpd/testlink.example.com-error_log
CustomLog /var/log/httpd/testlink.example.com-access_log common
EOF
重启apache
systemctl restart httpd.service
常见问题
index.php 显示代码
如果你通过ip访问testlink,可能会出现 http://ip/index.php 显示是一堆代码
编辑 /etc/httpd/conf/httpd.conf,增加 index.php,就可以
DirectoryIndex index.html index.php
生产使用配置
如果你需要生产使用,需要安全做点工作
chown -R root:root /var/www/html/testlink-code-1.9.16
chown -R apache:apache /var/www/html/testlink-code-1.9.16/{gui,logs,upload_area}
systemctl restart httpd.service
rm -rf /var/www/html/testlink-code-1.9.16/install
Testlink使用
testlink的使用,其实是非常复杂的。
看视频,会加快你的熟悉程度。
参考文章