基于LAMP和XAMPP部署MantisBT

一、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、官方环境要求

基于LAMP和XAMPP部署MantisBT

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正常

基于LAMP和XAMPP部署MantisBT

添加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按钮
基于LAMP和XAMPP部署MantisBT

将图中配置在config_inc.php中更新

cp /var/www/html/mantisbt/config/config_inc.php.sample /var/www/html/mantisbt/config/config_inc.php

基于LAMP和XAMPP部署MantisBT

界面登陆 http://192.168.118.100/mantisbt/admin
默认的系统管理员用户:administrator,密码: root
基于LAMP和XAMPP部署MantisBT

四、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
基于LAMP和XAMPP部署MantisBT

六、其他配置

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

猜你喜欢

转载自blog.51cto.com/jiayimeng/2412965