一、MantisBT缺陷管理系統簡介
MantisBT 是一種基於 Web 的 Bug 跟蹤系統,MantisBT 是使用 PHP 開發的,支持多個數據庫後端,包括 MySQL、MS SQL 和 PostgreSQL。作爲PHP腳本,MantisBT可以在PHP支持的任何操作系統上運行。
官方文檔: https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html-desktop/#admin.install
二、環境準備
2.1、官方環境要求
2.2、掛載本地鏡像爲YUM源
[root@node1 config]# mount|tail -1
/dev/sr0 on /mnt type iso9660 (ro,relatime)
[root@node1 config]# cat /etc/yum.repos.d/local-yum.repo
[local-yum]
name=local-yum
baseurl=file:///mnt/
enabled=1
gpgcheck=0
2.3、準備編譯環境
yum -y install gcc gcc-c++ make pcre-devel expat-devel perl
三、手動部署LAMP環境+MantisBT
3.1、LAMP版本準備
Centos7系統包中
httpd版本2.4.6
php版本5.4.16
mariadb版本5.5.56
其中httpd版本符合官方推薦版本,php與mariadb需要安裝推薦版本
截至2019年6月,php當前穩定版本爲7.3.6,mariadb當前穩定版爲10.4.6
3.2、Mariadb部署
下載地址http://mirrors.neusoft.edu.cn/mariadb//mariadb-10.4.6/yum/centos/7/x86_64/rpms/
安裝mariadb,使用rpm包
yum localinstall MariaDB-server-10.4.6-1.el7.centos.x86_64.rpm MariaDB-client-10.4.6-1.el7.centos.x86_64.rpm MariaDB-devel-10.4.6-1.el7.centos.x86_64.rpm
MariaDB-common-10.4.6-1.el7.centos.x86_64.rpm galera-4-26.4.1-1.rhel7.el7.centos.x86_64.rpm MariaDB-compat-10.4.6-1.el7.centos.x86_64.rpm
3.3、httpd部署
本地YUM源安裝
yum install httpd*
獲取apxs安裝路徑
rpm -ql httpd-devel|grep apxs
安裝路徑爲:/usr/bin/apxs
3.4、php部署
下載地址: https://www.php.net/
安裝依賴包
yum -y install php-mcrypt libmcrypt libmcrypt-devel autoconf freetype gd jpegsrc libmcrypt libpng libpng-devel libjpeg libxml2 libxml2-devel zlib curl curl-devel openssl openssl-devel
編譯安裝
tar xzvf php-7.3.6.tar.gz
cd php-7.3.6/
./configure --prefix=/usr/local/php/ --with-apxs2=/usr/bin/apxs --enable-mbstring --with-curl --with-gd --enable-fpm --enable-mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-config-file-path=/etc
make && make install
準備配置文件
cp php.ini-production /etc/php.ini
在配置文件中修改mysql連接相關配置
mysqli.default_socket = /var/lib/mysql/mysql.sock
mysqli.default_host = localhost
mysqli.default_user = root
mysqli.default_pw = 111111
mariadb爲root設置密碼
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('111111');
配置httpd中的php環境
vim /etc/httpd/conf/httpd.conf
#165行添加 index.php
DirectoryIndex index.html index.php
#285行下添加php類型支持
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
啓動httpd和mariadb
systemctl start httpd
systemctl start mariadb
php測試
vim /var/www/html/info.php
<?php
phpinfo();
?>
訪問http://192.168.118.100/info.php
php連接mysql正常
添加php環境變量
vim /etc/profile
PATH=$PATH:/usr/local/php/bin/
export PATH
source /etc/profile
3.5、mantisbt部署
下載地址: http://www.mantisbt.org/download.php
tar xzvf mantisbt-2.21.1.tar.gz
mv mantisbt-2.21.1 mantisbt
mv mantisbt/ /var/www/html/
界面登陸 http://192.168.118.100/mantisbt/admin/install.php
填寫創建數據庫相關信息後點擊instll/upgrade database按鈕
將圖中配置在config_inc.php中更新
cp /var/www/html/mantisbt/config/config_inc.php.sample /var/www/html/mantisbt/config/config_inc.php
界面登陸 http://192.168.118.100/mantisbt/admin
默認的系統管理員用戶:administrator,密碼: root
四、XAMPP部署MantisBT
4.1、XAMPP簡介
XAMPP 是最流行的 PHP 開發環境
XAMPP 是一個完全免費的,易於安裝的 Apache 發行版包含 MariaDB、PHP 和 Perl。XAMPP 開源軟件包被設置爲非常易於安裝和使用。
4.2、安裝xampp
XAMPP下載地址:https://www.apachefriends.org/download.html
chmod +x xampp-linux-x64-7.3.6-2-installer.run
./xampp-linux-x64-7.3.6-2-installer.run
接下來的步驟一路yes即可
安裝目錄在/opt/lampp/下
配置安全認證
/opt/lampp/xampp security
啓動:/opt/lampp/xampp start
重載:/opt/lampp/xampp reload
停止:/opt/lampp/xampp stop
查看運行狀態
[root@mantisbt ~]# /opt/lampp/xampp status
Version: XAMPP for Linux 7.3.6-2
Apache is running.
MySQL is running.
ProFTPD is running.
4.3、mantisbt部署
tar xzvf mantisbt-2.21.1.tar.gz
mv mantisbt-2.21.1 mantisbt
mv mantisbt/ /opt/lampp/htdocs/
餘下配置同3.5
五、Mantis郵件配置--騰訊企業郵
5.1、配置php
vim /opt/lampp/etc/php.ini
#windows平臺郵件配置
SMTP = smtp.exmail.qq.com
smtp_port = 465
#linux平臺郵件配置,默認使用sendmail -t -i,如果設置將只是用sendmail發送
sendmail_path =
#記錄日誌
mail.log = syslog
5.2、配置mantisbt配置文件config_inc.php(用戶配置)
vim /opt/lampp/htdocs/mantisbt/config/config_inc.php
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
$g_smtp_host = 'smtp.exmail.qq.com';
$g_smtp_username = '**************'; #用戶郵箱
$g_smtp_password = '**************'; #smtp服務器授權碼
$g_webmaster_email = '**************'; #用戶郵箱
$g_from_email = '**************'; #用戶郵箱
$g_return_path_email = '**************'; #用戶郵箱
$g_from_name = 'Mantis Bug Tracker';
$g_email_receive_own = OFF;
$g_email_send_using_cronjob = ON;
$g_administrator_email = '**************'; #用戶郵箱
5.3、配置mantis文件夾下的config_default.inc.php(mantisbt默認讀取配置)
vim /opt/lampp/htdocs/mantisbt/config_defaults_inc.php
/* 指明使用smtp發送郵件*/
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
/*SMTP服務器*/
$g_smtp_host = 'smtp.exmail.qq.com';
/*郵箱用戶名*/
$g_smtp_username = '**************'; #用戶郵箱
/*郵箱smtp授權碼*/
$g_smtp_password = '**************'; #smtp服務器授權碼
$g_smtp_port = 465; #smtp服務器端口
$g_smtp_connection_mode = 'ssl'; #使用ssl安全的連接
/*建議使用 cronjob 或計劃程序任務發送電子郵件*/
$g_email_send_using_cronjob = ON;
5.4、測試發送郵件
http://192.168.118.100/mantisbt/admin/email_queue.php
六、其他配置
6.1、關閉註冊用戶時使用郵件設置密碼
在Mantis目錄下config_defaults_inc.php文件中找到$g_send_reset_password
然後設置成:$g_send_reset_password = OFF 即可。
6.2、關閉一次性電子郵件地址檢查
在Mantis目錄vendor/vboctor/disposable_email_checker/data/domains.txt文件中刪除對應的郵箱地址
這裏是刪除qq.com