Mantis是一个基于PHP技术的轻量级的开源缺陷跟踪系统,以Web操作的形式提供项目管理及缺陷跟踪服务。由于其安装简单、使用方面,备受广大开发和测试人员青睐。下面主要讲解下Mantis再CentOS7上的安装配置过程。
一、安装apache
安装apache httpd:
yum install httpd -y //安装httpd
systemctl start httpd //启动httpd
systemctl enable httpd //配置自启动
httpd默认是80端口,如果服务器80端口被占用,可以通过修改/etc/httpd/conf/httpd.conf文件改变httpd的端口。
vim /etc/httpd/conf/httpd.conf --> Listen 9900
二、安装php
首先检查服务器环境是否安装php,Mantis要求php版本大于5.5,演示环境php选择7.1版本。
1、准备工作
安装EPEL repo,否则会在执行第二步时报出异常error: Failed dependencies:epel-release >= 7 is needed by webtatic-release-7-3.noarch。
yum -y install epel-release
2、默认情况下,PHP 7在CentOS存储库中不可用,需要首先安装Webtatic存储库。
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3、安装php7.1
yum install php71w php71w-cli php71w-mysqli php71w-mbstring -y
三、下载并解压Mantis
wget https://excellmedia.dl.sourceforge.net/project/mantisbt/mantis-stable/2.4.0/mantisbt-2.4.0.zip
unzip mantisbt-2.4.0.zip
mv mantisbt-2.4.0 /var/www/html/mantis
systemctl restart httpd //重启httpd
执行完上述命令,重启httpd,然后在浏览器中访问http://xx.xx.xx.xx:9900/mantis,会出现如下界面,填写数据库相关信息(Hostname、Username、Password、Database name),点击【Install/Upgrade Database】初始化数据库。
四、配置Mantis
数据库初始化完毕后,需要根据之前数据库相关信息配置mantis的数据库。
cd /var/www/html/mantis/config
rm -rf config_inc.php
cp config_inc.php.sample config_inc.php
vim config_inc.php
详细配置信息如下:
# --- Database Configuration ---
$g_hostname = 'xx.xx.xx.xx:3306';
$g_db_username = 'root';
$g_db_password = '123456';
$g_database_name = 'mantis';
$g_db_type = 'mysqli';
# --- Security ---
$g_crypto_master_salt = '1qaz2wsx3edc4rfv'; # Random string of at least 16 chars, unique to the installation
# --- Anonymous Access / Signup ---
$g_allow_signup = ON;
$g_allow_anonymous_login = OFF;
#$g_anonymous_account = '';
# --- Email Configuration ---
$g_phpMailer_method = PHPMAILER_METHOD_MAIL; # or PHPMAILER_METHOD_SMTP, PHPMAILER_METHOD_SENDMAIL
$g_smtp_host = 'localhost'; # used with PHPMAILER_METHOD_SMTP
$g_smtp_username = ''; # used with PHPMAILER_METHOD_SMTP
$g_smtp_password = ''; # used with PHPMAILER_METHOD_SMTP
$g_webmaster_email = 'webmaster@example.com';
$g_from_email = 'noreply@example.com'; # the "From: " field in emails
$g_return_path_email = 'admin@example.com'; # the return address for bounced mail
# --- Attachments / File Uploads ---
$g_allow_file_upload = ON;
$g_file_upload_method = DISK;
$g_absolute_path_default_upload_folder = '/var/www/html/mantis/upload/'; # used with DISK, must contain trailing \ or /.
$g_max_file_size = 5000000; # in bytes
# --- Others ---
$g_default_language = 'chinese_simplified';