环境
Ubuntu 22.04 TLS
Php 8.1
Apache2 2.4.52
MySQL 5.7
MantisBT 2.25.6
说明
数据库采用外部数据库。
除 Crontab 外,其他更改的配置文件均存放到 mantisbt-config 中。
部署
wget https://newcontinuum.dl.sourceforge.net/project/mantisbt/mantis-stable/2.25.6/mantisbt-2.25.6.zip
sudo apt install php php-cli php-fpm php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-soap -y
unzip mantisbt-2.25.6.zip
sudo mv mantisbt-2.25.6 /data/mantisbt
sudo mkdir /data/mantisbt-config
sudo mkdir -p /data/log/apache2
sudo mkdir -p /data/mantisbt/file-upload
sudo nano /data/mantisbt-config/mantisbt.conf
sudo ln -s /data/mantisbt-config/mantisbt.conf /etc/apache2/sites-available/mantisbt.conf
sudo chown -R www-data:www-data /data/mantisbt
sudo chown -R www-data:www-data /data/log
sudo chown -R www-data:www-data /data/mantisbt-config
sudo a2ensite mantisbt
登录网页进行数据库配置及确认,以及安装,并根据提示修改管理员密码(初始账号:administrator,密码:root)。
sudo cp /data/mantisbt/config/config_inc.php /data/mantisbt-config/config_inc.php
sudo mv mantisbt/config/config_inc.php mantisbt/config/config_inc.php.bak
sudo ln -s /data/mantisbt-config/config_inc.php /data/mantisbt/config/config_inc.php
sudo nano /data/mantisbt-config/config_inc.php
sudo cp -rf /etc/php/8.1/apache2/php.ini /data/mantisbt-config/
sudo mv /etc/php/8.1/apache2/php.ini /etc/php/8.1/apache2/php.ini.bak
sudo ln -s /data/mantisbt-config/php.ini /etc/php/8.1/apache2/php.ini
sudo nano /data/mantisbt-config/php.ini
sudo nano /etc/crontab
# 变更或删除系统工具路径
sudo mv /data/mantisbt/admin /data/mantisbt/admin + 自定义字符串
sudo chown -R www-data:www-data /data/mantisbt
sudo chown -R www-data:www-data /data/log
sudo chown -R www-data:www-data /data/mantisbt-config
(非必须操作)此处是由于在访问系统工具时,页面样式不正确,发现缺少页面样式所执行的操作
sudo cp -rf mantisbt/css mantisbt/admin + 自定义字符串/css
sudo cp -rf mantisbt/js mantisbt/admin + 自定义字符串/js
sudo cp -rf mantisbt/fonts mantisbt/admin + 自定义字符串/fonts
sudo cp -rf mantisbt/images mantisbt/admin + 自定义字符串/images
sudo cp -rf mantisbt/javascript_* mantisbt/admin + 自定义字符串/
sudo chown -R www-data:www-data mantisbt/admin + 自定义字符串
mantisbt.conf
<VirtualHost *:80>
ServerAdmin it@yudelei.com
DocumentRoot "/data/mantisbt"
ServerName bugtracker.yudelei.com
ErrorLog "/data/log/apache2/mantisbt-error_log"
TransferLog "/data/log/apache2/mantisbt-access_log"
<Directory "/data/mantisbt/">
DirectoryIndex index.php index.html
Options FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
php.ini
extension=soap # 取消注释
post_max_size = 220M # 变更
upload_max_filesize = 200M # 变更
max_file_uploads = 40 # 变更
memory_limit = 256M # 变更
config_inc.php
<?php
$g_hostname = '数据库主机';
$g_db_type = 'mysqli';
$g_database_name = '数据库名称';
$g_db_username = '数据库用户';
$g_db_password = '数据库密码';
$g_default_timezone = 'Asia/Shanghai';
$g_crypto_master_salt = '随机唯一字符串';
$g_allow_signup = ON;
$g_enable_email_notification = ON;
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
$g_webmaster_email = '业务运维部门邮箱账号';
$g_from_email = '通知邮箱账号';
$g_from_name = '发件人身份昵称';
$g_return_path_email = '通知邮箱账号';
$g_smtp_host = 'SMTP服务器地址';
$g_smtp_port = 465;
$g_smtp_connection_mode = 'ssl';
$g_smtp_username = '通知邮箱账号';
$g_smtp_password = '通知邮箱密码';
$g_email_retry_in_days = '1';
$g_email_send_using_cronjob = ON;
$g_allow_file_upload = ON;
$g_file_upload_method = DISK;
$g_absolute_path_default_upload_folder = '/data/mantisbt/file-upload/';
$g_file_upload_max_num = 40;
$g_max_file_size = 209715200;
$g_disallowed_files = 'php,svg,html';
$g_preview_attachments_inline_max_size = 1024 * 1024;
crontab
*/2 * * * * root php /data/mantisbt/scripts/send_emails.php >> /data/log/mail.log