需求:
在ubuntu 18.04上安裝mantis bug tracker
Mantisbt: 是一款基於Web的開源漏洞跟蹤系統,採用PHP開發,並且支持多種數據庫後端,包括MySQL,MS SQL和PostgreSQL,還支持apache / nginx web server.
1 安裝apache/ php/ mysql
Mantis要求電腦上已安裝apache2/ mysql。
運行以下命令安裝apache2
sudo apt update
sudo apt install wget php php-cli php-fpm php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
然後安裝Apache2 Web Server:
sudo apt -y install apache2
Apache2監聽的端口默認是80,需要修改爲8050
/etc/apache2/ports.conf
sudo systemctl stop apache2
修改/etc/apache2/sites-available/000-default.conf爲:
# cat /etc/apache2/sites-available/000-default.conf
<VirtualHost *:8050>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/mantisbt
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
ServerName bt.example.com
ServerAlias www.bt.example.com
<Directory "/var/www/html/mantisbt/">
DirectoryIndex index.php index.html
Options FollowSymLinks
AllowOverride None
Require all granted
Options MultiViews FollowSymlinks
</Directory>
</VirtualHost>
sudo systemctl restart apache2
netstat -lnp|grep 8050
查詢端口號佔用情況
2 安裝mysql
https://www.cnblogs.com/woshimrf/p/ubuntu-install-mysql.html
登錄MariaDB shell:
$ mysql -u root -p
爲MantisBT創建數據庫和用戶:
CREATE USER 'mantisbt'@'localhost' IDENTIFIED BY 'StrongPassword';
CREATE DATABASE mantisbt;
GRANT ALL PRIVILEGES ON mantisbt.* TO 'mantisbt'@'localhost';
FLUSH PRIVILEGES;
QUIT
3 安裝mantisbt
將mantisbt-2.19.0.zip 解壓到/var/www/html/mantisbt目錄下
打開本機上的瀏覽器,訪問安裝mantis的頁面
http://127.0.0.1:8050
等一會就會提示安裝成功。
安裝成功後,再次訪問http://127.0.0.1:8050 ,會出現登錄頁面。初始的用戶名爲administrator,初始密碼:root,修改爲ice1234
公司裏使用的是騰訊企業郵箱。需要修改下面的2個配置文件來設置郵箱。
修改 /var/www/html/mantisbt/config/config_inc.php
$g_enable_email_notification=ON;
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
$g_smtp_host = 'smtp.exmail.qq.com';
$g_smtp_username = '本人郵箱';
$g_smtp_password = '三方授權密碼';
$g_webmaster_email = '本人郵箱';
$g_from_email = '本人郵箱';
$g_return_path_email = '本人郵箱';
$g_smtp_port = 25;
$g_administrator_email ='本人郵箱';
# $g_from_name = 'Mantis Bug Tracker';
# $g_email_receive_own = OFF;
# $g_email_send_using_cronjob = OFF;
/var/www/html/mantisbt/config_defaults_inc.php
$g_administrator_email ='本人郵箱';
$g_webmaster_email ='本人郵箱';
$g_from_email ='本人郵箱';
$g_return_path_email ='本人郵箱';
$g_enable_email_notification = ON;
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
$g_smtp_host ='本人郵箱';
$g_smtp_username='本人郵箱';
$g_smtp_password= '三方授權密碼';
$g_smtp_port= 25;
配置完成後,可以點擊用戶管理,創建新用戶。再點擊重設密碼按鈕,可以發送郵件,用來重設密碼。
如果遇到問題,可以查看log來定位問題。
查看/var/log/apache2/error.log
參考網頁:
安裝
https://ywnz.com/linuxyffq/4134.html
https://blog.csdn.net/gs344937933/article/details/61203977
發郵件
http://www.mantis.org.cn/383.html