根据网上资料整理,经过验证测试完全正常工作,mantis出现的一些警告和问题也进行了解决.
没有配置邮箱,不能发送邮件通知.
sudo apt -y install apache2
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
sudo apt update
sudo apt install mariadb-server mariadb-client
#安装完成后,MariaDB服务将自动启动。你可以使用以下命令检查服务状态
sudo systemctl status mariadb
#如果服务未启动,可以使用以下命令手动启动它:
sudo systemctl start mariadb
#现在,你已经成功安装了MariaDB服务器和客户端。你可以使用以下命令登录到MariaDB控制台:
#默认密码为空
sudo mysql -u root -p
#登录到控制台
sudo mysql -u root -p
#进入MariaDB控制台后,使用以下命令设置root用户的密码(将 new_password 替换为你想要设置的新密码):
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
#如果你想允许root用户从远程主机访问MariaDB,请使用以下命令(可选)
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'new_password' WITH GRANT OPTION; FLUSH PRIVILEGES;
mysql -u root -p
CREATE USER 'mantisbt'@'localhost' IDENTIFIED BY 'StrongPassword';
CREATE DATABASE mantisbt;
GRANT ALL PRIVILEGES ON mantisbt.* TO 'mantisbt'@'localhost';
FLUSH PRIVILEGES;
QUIT
运行mysql -u mantisbt -p
命令看能否登录数据库
SHOW DATABASES;
如下显示OK
+--------------------+
| Database |
+--------------------+
| information_schema |
| mantisbt |
+--------------------+
2 rows in set (0.000 sec)
#1.安装
sudo apt install phpmyadmin php-json -y
#2.选择web服务器
[*] apache2
#3.选择no
The phpmyadmin package must have a database installed and configured before it can be used. This can be optionally handled with dbconfig-common.
If you are an advanced database administrator and know that you want to perform this configuration manually, or if your database has already been installed and configured, you should refuse this option. Details on what needs to be done should most likely be provided in /usr/share/doc/phpmyadmin.
Otherwise, you should probably choose this option.
Configure database for phpmyadmin with dbconfig-common?
sudo dpkg -L phpmyadmin
可以不用修改,sudo vim /etc/apache2/conf-available/phpmyadmin.conf
,默认内容如下:
# phpMyAdmin default Apache configuration
Alias /phpmyadmin /usr/share/phpmyadmin
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
# limit libapache2-mod-php to files and directories necessary by pma
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/:/usr/share/php/PhpMyAdmin/:/usr/share/php/Symfony/:/usr/share/php/Twig/:/usr/share/php/Twig-Extensions/:/usr/share/php/ReCaptcha/:/usr/share/php/Psr/Container/:/usr/share/php/Psr/Cache/:/usr/share/php/Psr/Log/:/usr/share/php/Psr/SimpleCache/
# Disallow web access to directories that don't need it
Require all denied
Require all denied
sudo mysql -u root -p
CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'phpmyadminpassword';
CREATE DATABASE phpmyadmin;
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost';
FLUSH PRIVILEGES;
EXIT
编辑sudo vim /etc/phpmyadmin/config-db.php
##
## database access settings in php format
## automatically generated from /etc/dbconfig-common/phpmyadmin.conf
## by /usr/sbin/dbconfig-generate-include
##
## by default this file is managed via ucf, so you shouldn't have to
## worry about manual changes being silently discarded. *however*,
## you'll probably also want to edit the configuration file mentioned
## above too.
##
$dbuser='phpmyadmin';
#$dbpass修改成数据库中的密码
$dbpass='phpmyadminpassword';
$basepath='';
$dbname='phpmyadmin';
$dbserver='localhost';
$dbport='3306';
$dbtype='mysql';
sudo a2enconf phpmyadmin
sudo phpenmod mbstring
sudo systemctl restart apache2
http://106.15.109.116/phpmyadmin
#使用root用户登录
User accounts -> Global privileges
在首页会显示警告:
The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. Find out why.
Or alternately go to 'Operations' tab of any database to set it up there.
点击Find out,建立数据表即可.
sudo mv mantisbt-2.25.7/ /data/websrv/mantisbt
sudo chown -R www-data:www-data /data/websrv/mantisbt
1.编辑文件sudo vim /etc/apache2/sites-available/mantisbt.conf
,内容如下:
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/mantisbt/
ServerName example.com
ServerPath "/mantisbt/"
Options +FollowSymLinks
AllowOverride All
ErrorLog /var/log/apache2/mantisbt.error.log
CustomLog /var/log/apache2/mantisbt.access.log common
2.检查syntax错误:
apachectl -t
#Syntax OK
3.使能该网站
sudo a2enconf mantisbt
sudo systemctl restart apache2
访问http://192.168.1.112/mantisbt/
,如果出现mantis页面说明安装成功.
1.Installation Options
项目 | 值 | 说明 |
---|---|---|
Type of Database | MySQL Improved | |
Hostname (for Database Server) | localhost | 为MantisBT创建数据库和用户 |
Username (for Database) | mantisbt | 为MantisBT创建数据库和用户 |
Password (for Database) | mantisbtpassword | 为MantisBT创建数据库和用户 |
Database name (for Database) | mantisbt | 为MantisBT创建数据库和用户 |
Admin Username (to create Database if required) | root | |
Admin Password (to create Database if required) | rootpassword | |
Default Time Zone | Shanghai |
点击"install/upgrade database"
产生管理员账号:administrator/root
MantisBT was installed successfully. Continue to log in.
//在config_inc.php中增加如下一行
$g_default_language='chinese_simplified'; //默认语言设为中文
编辑文件config_defaults_inc.php
/**
* If ON, users will be sent their password when their account is created
* or password reset (this requires mail settings to be correctly configured).
* If OFF, then the Administrator will have to provide a password when
* creating new accounts, and the password will be set to blank when reset.
* @global integer $g_send_reset_password
*/
$g_send_reset_password = OFF;
//login_page.php
//注释掉如下内容
/*
$t_show_signup =
( auth_signup_enabled() ) &&
( LDAP != config_get_global( 'login_method' ) ) &&
( ON == config_get( 'enable_email_notification' ) );
*/
从MantisBT版本开始,创建用户后,必须由用户通过确认邮件进行修改密码,而管理员无权对用户的密码进行修改。这对于配置mail不成功的情况下很不方便。以下配置就可以让管理员轻松管理用户的密码。
解决方式就是考虑修改Mantisbt PHP程序,增加一个密码修改框,这样管理员就可以直接修改用户密码了。
//manage_user_edit_page.php
<!-- Email -->
<tr><?php
if( $t_ldap && ON == config_get_global( 'use_ldap_email' ) ) {
# With LDAP
echo '' . lang_get( 'email_label' ) . ' ';
echo '' . string_display_line( user_get_email( $t_user_id ) ) . ' ';
} else {
# Without LDAP
echo '' . lang_get( 'email_label' ) . ' ';
echo '';
print_email_input( 'email', $t_user['email'] );
echo ' ';
} ?>
</tr>
/*新增内容*/
<!-- Password -->
<tr <?php echo helper_alternate_class( 1 ) ?>>
<td class="category" width="30%">
<?php echo "Password (change only)" ?>:
</td>
<td width="70%">
<input type="text" size="16" maxlength="100" name="password" value="" />
</td>
</tr>
//manage_user_update.php
$f_user_id = gpc_get_int( 'user_id' );
//新增内容
$f_pass = gpc_get_string('password');
$t_result = db_query( $t_query, $t_query_params );
//新增内容
if ($f_pass) user_set_password($f_user_id, $f_pass);
参考
数据库文件默认路径:/var/lib/mysql
数据库日志默认路径:/var/log/mysql(我所使用的默认是注释掉,未开启,需要自己手动删除注释才可以使用)
数据库配置文件路径:/etc/mysql/mariadb.conf.d/50-server.cnf(文件一般都在/etc/mysql/****.conf.d 下面,根据自己的实际情况查看)
#1.停用mariadb服务
sudo systemctl stop mariadb
#2.拷贝原始数据库数据到要修改的路径
sudo cp -ravf /var/lib/mysql /data/mysql
#或者
sudo rsync -avzh /var/lib/mysql /data/mysql
#3.设置apparmor
sudo vim /etc/apparmor.d/tunables/alias
#在文档最后面加入
alias /var/lib/mysql -> /data/mysql,
#添加完之后重启apparmor服务
sudo systemctl restart apparmor
#4.修改默认的数据库datadir路径
sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf
datadir = /data/mysql ###添加的新路径
#5.修改mariadb.service和[email protected]文件
#或者是mysql.service和mysqld.service,根据搜索决定
sudo vim /lib/systemd/system/mariadb.service
sudo vim /lib/systemd/system/[email protected]
#将 ProtectHome 修改为False
# Prevent accessing /home, /root and /run/user
ProtectHome=true
#由于数据库方在/data目录,可以不修改
#6.重启mariadb服务即可
sudo service mariadb start
#7.检查是否修改了mariadb数据库路径
mysql -u root -p
select @@datadir;
+--------------+
| @@datadir |
+--------------+
| /data/mysql/ |
+--------------+
1 row in set (0.000 sec)
#1.创建相应的log文件目录
sudo mkdir /data/log/mysql -p
#2.修改Mariadb配置文件
sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf
log_error = /data/log/mysql/error.log
#3.修改目录权限
sudo chown -R mysql:adm /data/log/mysql
#4.重启mariadb服务
sudo systemctl start mariadb
sudo mv /var/lib/mysql /var/lib/00_mysql
sudo mv /var/log/mysql /var/log/00_mysql
#测试正常后删除
sudo rm -rf /var/lib/00_mysql
sudo rm -rf /var/log/00_mysql
mantis密码使用md5加密,不太安全,管理员可以破解密码,操作步骤如下:
phpmyadmin -> mantisbt数据库 -> mantis_user_table表 -> 复制用户的 password
例如可以使用网站cmd5.com
进行解密.
Ubuntu 20.04安装MariaDB数据库
linux 安装mantis,在Ubuntu 18.04系统上安装Mantis Bug Tracker[MantisBT]
阿里云ubuntu18.04搭建Mantisbt服务器
mariadb官网
mantisbt 官网
Ubuntu18.04安装Mantisbt详细步骤
常用测试相关工具-Mantis的使用
我是学霸君-09-Mantis安装使用
xampp
wampserver
安裝 phpMyAdmin
关于phpmyadmin安装在ubuntu20.04上面的详细步骤
Ubuntu22.04 修改Mariadb数据库存储路径及日志路径