Mantis 安装与配置及使用

Mantis 安装与配置及使用

介绍

MantisBT(螳螂 bug tracker)使与团队成员和客户的协作变得轻松,快速和专业 MantisBT是一个开源问题跟踪器,可在简单性和功能之间实现微妙的平衡。用户可以在几分钟之内上手并开始管理他们的项目,同时与他们的队友和客户进行有效的协作。一旦开始使用它,您将永远不会回头!

特性

邮件通知

通过有关问题更新,解决方案或评论的通知,使您的团队和客户保持最新状态。

访问控制

基于项目角色的访问控制,可让用户掌控您的业务。

访问控制

基于项目角色的访问控制,可让用户掌控您的业务。

为什么要使用MantisHub?

免费试用1分钟即可上手。

专注于您的业务,而不用担心备份,升级和支持。

由经验丰富的团队提供丰富的MantisBT经验支持 现有用户能够迁移其数据。

独家附件,例如MantisTouch

没有长期承诺-随时取消并随身携带您的数据。

立即尝试MantisBT!

评估MantisBT从未如此简单。您可以从我们提供的一个或多个演示选项开始,或者直接进入下载页面并获取最新版本以及管理员指南,以在自己的服务器上进行设置。

安装步骤

LAMP(Linux Apache MySql Php)环境准备

一、安装 Linux

CentOS 7.8

二、安装 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
...

防火墙开放端口

## 防火墙设置
firewall-cmd --zone=public --add-port=80/tcp --permanent
## firewall-cmd --zone=public --add-port=9900/tcp --permanent
firewall-cmd --reload


firewall 命令说明:
–-zone #作用域
–-add-port=8081/tcp #添加端口,格式为:端口/通讯协议 --add-port=30060-30090/tcp
-–permanent #永久生效,没有此参数重启后失效
--reload #重启防火墙

重新启动服务

// 启动httpd
systemctl start httpd

注意:开发端口80,或修改的其他端口

访问http://ip:port,出现以下页面则安装成功

img

三、安装 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

4、通过php -v确认是否安装成功

php -v
PHP 7.1.33 (cli) (built: Oct 26 2019 10:16:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

四、安装 Mysql

  • 首先获取mysql源
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
  • 安装rpm包
rpm -ivh mysql-community-release-el7-5.noarch.rpm
  • 安装mysql
yum install mysql-community-server
  • 启动mysql
systemctl start mysqld //启动
systemctl restart mysqld  //重启
systemctl stop mysqld //停止
  • 修改mysql密码
set password for 'root'@'localhost' =password('changeme');
  • 开放远程连接的权限
grant all privileges on *.* to root@'%' identified by 'changeme' with grant option;
flush privileges;

创建数据库和用户(bugtracker)

mysql -u root -p
create database bugtracker default character set utf8 collate utf8_general_ci;
create user 'buger'@'%' identified by 'changeme';
grant all on bugtracker.* to buger@'%';
grant all privileges on *.* to 'buger'@'192.168.111.139' identified by 'changeme' with grant option;
flush privileges;

查看数据库和表

show databases;
select user,host from mysql.user;

mysql -u root -p

Enter password:

创建数据库bugtracker

mysql> create database bugtracker default character set utf8mb4 collate utf8mb4_general_ci;

用户buger,密码:changeme,授权

mysql> grant all on bugtracker.* to ‘buger’@’%’ identified by ‘changeme’;

刷新生效

mysql>flush privileges;

出现错误

ERROR 1396 (HY000): Operation CREATE USER failed for 'buger'@'%'

处理方法

drop user 'buger'@'%';
drop user 'mantis'@'%';
flush privileges;

五、Mantis 安装与配置

官网下载安装包:https://www.mantisbt.org/index.php

1、下载地址:wget https://pilotfiber.dl.sourceforge.net/project/mantisbt/mantis-stable/2.24.2/mantisbt-2.24.2.zip

2、解压安装包

unzip mantisbt-2.24.2.zip
// 将下载的包解压
tar xvf mantisbt-2.24.2.tar.gz

3、部署mantis

两种方式部署

## 一种是将解压包移动至 apache 站点目录
mv /opt/mantisbt-2.24.2 /var/www/html/bug

## 第二种是修改 apache 配置,将站点目录指向解压目录

## 使用以下命令更改mantis螳螂目录的所有权:
chown -R apache:apache /var/www/html/bug

为Mantis创建一个apache虚拟主机文件。(注:如果有多个站点可以创建)

可以通过在/etc/httpd/conf.d/目录中创建mantis.conf文件:

添加以下行:

sudo nano /etc/httpd/conf.d/mantis.conf

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/html/mantis"
ServerName yourdomain.com
<Directory />
Options FollowSymLinks
AllowOverride All
<Directory "/var/www/html/mantis/">
Options MultiViews FollowSymlinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
TransferLog /var/log/httpd/mantis_access.log
ErrorLog /var/log/httpd/mantis_error.log
</VirtualHost>

保存并关闭文件,然后使用以下命令重新启动Apache Web服务器。

4、重启 apache httpd

sudo systemctl restart httpd  

5、浏览器访问 http://ip:port/mantis

出现以下页面

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-zViarC9S-1599828842278)(assets/image-20200905220929169.png)]

Checking Installation
Checking PHP version (your version is 7.1.33)	GOOD
Checking UTF-8 support	GOOD
Checking if safe mode is enabled for install script	GOOD
Checking there is no 'config_inc.php' file in 1.2.x location.	GOOD
Checking there is no 'custom_constants_inc.php' file in 1.2.x location.	GOOD
Checking there is no 'custom_strings_inc.php' file in 1.2.x location.	GOOD
Checking there is no 'custom_functions_inc.php' file in 1.2.x location.	GOOD
Checking there is no 'custom_relationships_inc.php' file in 1.2.x location.	GOOD
Checking there is no 'mc_config_defaults_inc.php' file in 1.2.x location.	GOOD
Checking there is no 'mc_config_inc.php' file in 1.2.x location.	GOOD

输入Hostname、Username、Password、Database name,点击【Install/Upgrade Database】初始化数据库。

出现错误:管理用户是否有权访问数据库?

BAD
Does administrative user have access to the database? ( Can't connect to MySQL server on '192.168.111.136' (13) )

解决方法 https://www.cnblogs.com/wuling129/p/4692095.html

出现can’t connect to MySQL server using ‘’ (13)的错误,结果是 SELinux 不让 httpd 访问外网,一开始还以为是iptables造成的,关闭之后发现还是不行。原因:

getsebool -a | grep httpd
httpd_anon_write --> off
httpd_builtin_scripting --> on
httpd_can_check_spam --> off
httpd_can_connect_ftp --> off
httpd_can_connect_ldap --> off
httpd_can_connect_mythtv --> off
httpd_can_connect_zabbix --> off
httpd_can_network_connect --> off
httpd_can_network_connect_cobbler --> off
httpd_can_network_connect_db --> off    #重点在这里
httpd_can_network_memcache --> off
httpd_can_network_relay --> off
httpd_can_sendmail --> off
httpd_dbus_avahi --> off
httpd_dbus_sssd --> off
httpd_dontaudit_search_dirs --> off
httpd_enable_cgi --> on
httpd_enable_ftp_server --> off
httpd_enable_homedirs --> off
httpd_execmem --> off
httpd_graceful_shutdown --> on
httpd_manage_ipa --> off
httpd_mod_auth_ntlm_winbind --> off
httpd_mod_auth_pam --> off
httpd_read_user_content --> off
httpd_run_ipa --> off
httpd_run_preupgrade --> off
httpd_run_stickshift --> off
httpd_serve_cobbler_files --> off
httpd_setrlimit --> off
httpd_ssi_exec --> off
httpd_sys_script_anon_write --> off
httpd_tmp_exec --> off
httpd_tty_comm --> off
httpd_unified --> off
httpd_use_cifs --> off
httpd_use_fusefs --> off
httpd_use_gpg --> off
httpd_use_nfs --> off
httpd_use_openstack --> off
httpd_use_sasl --> off
httpd_verify_dns --> off

# systemctl stop httpd
# /usr/sbin/setsebool -P httpd_can_network_connect_db on
# systemctl restart httpd

重新点击【Install/Upgrade Database】初始化数据库。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-17EHlxUj-1599828842280)(assets/image-20200906211312118.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Zhp4OWyI-1599828842282)(assets/image-20200906211325302.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4uVvQSds-1599828842284)(assets/image-20200906211335170.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-jmrHo6sS-1599828842286)(assets/image-20200906211345869.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ZbWWoOGc-1599828842289)(assets/image-20200906211357185.png)]

数据库表以创建成功,总共31张表,数据已初始化,再根据提示进行后面的安装

Write Configuration File(s)
Creating Configuration File (config/config_inc.php)
POSSIBLE PROBLEM
cannot write /var/www/html/bug/config/config_inc.php
Please add the following lines to '/var/www/html/bug/config/config_inc.php' before continuing:
<?php
$g_hostname               = '192.168.111.136:3306';
$g_db_type                = 'mysqli';
$g_database_name          = 'bugtracker';
$g_db_username            = 'buger';
$g_db_password            = 'changeme';

$g_default_timezone       = 'UTC';

$g_crypto_master_salt     = 'U0eP+fcHO+oEiYegxgEZqyubbqJXr4bFcJXs54tTFkU=';

如果初始化没有生成配置文件,需要手工添加配置文件,根据提供的配置例子添加:

cd /var/www/html/mantis/config/
cp config_inc.php.sample config_inc.php
vim config_inc.php

修改配置文件,主要是数据库连接配置,邮件的可以后续配置

vim config_inc.php

<?php
# MantisBT - A PHP based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.

/**
 * @package MantisBT
 * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - [email protected]
 * @copyright Copyright (C) 2002 MantisBT Team - [email protected]
 * @link http://www.mantisbt.org
 */

# This sample file contains the essential files that you MUST
# configure to your specific settings.  You may override settings
# from config_defaults_inc.php by uncommenting the config option
# and setting its value in this file.

# Rename this file to config_inc.php after configuration.

# In general the value OFF means the feature is disabled and ON means the
# feature is enabled.  Any other cases will have an explanation.

# Look in http://www.mantisbt.org/docs/ or config_defaults_inc.php for more
# detailed comments.

# --- Database Configuration ---
$g_hostname      = '192.168.111.136:3306';
$g_db_username   = 'buger';
$g_db_password   = 'changeme';
$g_database_name = 'bugtracker';
$g_db_type       = 'mysqli';

# --- Security ---
$g_crypto_master_salt = 'U0eP+fcHO+oEiYegxgEZqyubbqJXr4bFcJXs54tTFkU='; #  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            = '';

# Look in http://www.mantisbt.org/docs/ or config_defaults_inc.php for more
# detailed comments.

# --- Database Configuration ---
$g_hostname      = '192.168.111.136:3306';
$g_db_username   = 'buger';
$g_db_password   = 'changeme';
$g_database_name = 'bugtracker';
$g_db_type       = 'mysqli';

# --- Security ---
$g_crypto_master_salt = 'U0eP+fcHO+oEiYegxgEZqyubbqJXr4bFcJXs54tTFkU='; #  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      = '[email protected]';
$g_from_email           = '[email protected]';        # the "From: " field in emails
$g_return_path_email    = '[email protected]';  # the return address for bounced mail
# $g_from_name                  = 'Mantis Bug Tracker';
# $g_email_receive_own  = OFF;
# $g_email_send_using_cronjob = OFF;

# --- Attachments / File Uploads ---
$g_allow_file_upload    = ON;
$g_file_upload_method   = DISK; # DATABASE or DISK
$g_absolute_path_default_upload_folder = '/var/www/html/bug/repos/'; # used with DISK, must contain trailing \ or /.
$g_max_file_size                = 5000000;      # in bytes
$g_preview_attachments_inline_max_size = 256 * 1024;
# $g_allowed_files              = '';           # extensions comma separated, e.g. 'php,html,java,exe,pl'
# $g_disallowed_files           = '';           # extensions comma separated

# --- Branding ---
$g_window_title                 = 'MantisBT';
# $g_logo_image                 = 'images/mantis_logo.png';
# $g_favicon_image              = 'images/favicon.ico';

# --- Real names ---
# $g_show_realname = OFF;
# $g_show_user_realname_threshold = NOBODY;     # Set to access level (e.g. VIEWER, REPORTER, DEVELOPER, MANAGER, etc)

# --- Others ---
# $g_default_home_page = 'my_view_page.php';    # Set to name of page to go to after login
$g_default_language = 'chinese_simplified';

如果刷新页面,出现错误

APPLICATION ERROR #400

数据库连接失败。数据库返回的错误信息是:#0: PHP Support for database is not enabled

请使用浏览器的“返回”按钮来返回到上一页,这样您可以找到发生了什么问题或者进行别的操作;您也可以点击导航栏中的其它项。

或下面数据库提示错误
BAD
database is not supported by PHP. Check that it has been compiled into your server.

或下面配置错误
POSSIBLE PROBLEM Bad config_inc.php?

解决方法:在安装过程中因解决数据库连接问题之前卸载过,重新安装数据库连接安装包

yum install -y php71w-mysqli

刷新页面,初始化数据库,建表完成后

如果没有发生错误,点击 Back to Administrator 按钮,将进入下面这个页面

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-36tokmVw-1599828842290)(assets/image-20200906212953893.png)]

默认帐号是:administrator/root,登录成功后

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4KpxP6kT-1599828842292)(assets/image-20200906213124057.png)]

  • 为了安全起见,使用rm -rf admin/删除mantis下的admin目录。
  • 禁止默认 ‘administrator’ 帐号或修改其密码。

ps:创建用户后,发现不知道初始密码是多少,重设密码还要发送邮件可以通过以下设置来修改:

// 在/var/www/html/mantis/config/config_inc.php文件中添加:
$g_enable_email_notification = OFF;
// 此时重置密码后密码为空
// 另外,在config_defaults_inc.php文件中修改:
$g_send_reset_password = OFF;
// 此时在新建用户页面会出现密码输入框,就可以自定义密码了

六、参考文献

https://blog.csdn.net/wangpf2011/article/details/85302010

https://www.howtoing.com/how-to-install-mantis-bug-tracker-on-centos-7

https://www.jianshu.com/p/2f897cedd2e9

docker 安装

4KpxP6kT-1599828842292)]

  • 为了安全起见,使用rm -rf admin/删除mantis下的admin目录。
  • 禁止默认 ‘administrator’ 帐号或修改其密码。

ps:创建用户后,发现不知道初始密码是多少,重设密码还要发送邮件可以通过以下设置来修改:

// 在/var/www/html/mantis/config/config_inc.php文件中添加:
$g_enable_email_notification = OFF;
// 此时重置密码后密码为空
// 另外,在config_defaults_inc.php文件中修改:
$g_send_reset_password = OFF;
// 此时在新建用户页面会出现密码输入框,就可以自定义密码了

六、参考文献

https://blog.csdn.net/wangpf2011/article/details/85302010

https://www.howtoing.com/how-to-install-mantis-bug-tracker-on-centos-7

https://www.jianshu.com/p/2f897cedd2e9

docker 安装

https://github.com/vimagick/dockerfiles/issues/75

猜你喜欢

转载自blog.csdn.net/pointdew/article/details/108541611