安装CentOS7操作系统,以工作站模式安装(防止出现依赖库缺失问题)
安装完成后进入root权限
二、安装yum 或apt-get
apt-get install yum 或
yum install apt-get
三、删除系统上的php和mysql
a=`rpm -qa | grep -e php -e mysql ` #查出相关安装服务
##########################
#使用以下命令一次性清除上面查出的服务
for file in $a
do
rpm -e $file --nodeps
Done
###########################
四、安装配置mariadb
yum -y install mariadb*
systemctl start mariadb
mysql_secure_installation
#首先是设置密码,会提示先输入密码
Enter current password for root (enter for none):<–初次运行直接回车
#设置密码
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
#其他配置
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,
Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车
#初始化MariaDB完成,接下来测试登录
mysql -u root -p
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 29
Server version: 5.5.56-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
登录成功OK
五、安装php5.6
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-intl php56w-mbstring php56w-mysql
登录数据库
create database mantisdb default character set utf8 collate utf8_general_ci;
grant all privileges on mantisdb.* to 'mantis'@'%' identified by 'mantis';
grant all privileges on mantisdb.* to 'root'@'%' identified by 'root' with grant option;
FLUSH PRIVILEGES;
\q
配置mantis
1、下载:
wget
https://excellmedia.dl.sourceforge.net/project/mantisbt/mantis-stable/2.4.0/mantisbt-2.4.0.zip
2、解压并移动:
unzip mantisbt-2.4.0.zip
mv mantisbt-2.4.0 /var/www/html/mantis
chmod -R 777 /var/
systemctl restart httpd.service
setenforce 0
4、浏览:http://your ip:port/mantis
按照实际情况输入
Hostname(服务器地址)
databasename(mantis数据库名,即:mantisdb),
username(即第2步里面的:mantis),
password(即第2步里面的:mantispassword)
其中数据库类型可以选择Mysqli。
写好这些内容,点击install/update database即可。
如果弹出未生成config_inc.php,请复制页面内容在下一步中创建文件
5、配置mantis:
#cd /var/www/html/mantis/config
如产生了 config_inc.php则直接编辑即可,
如未产生则cp config_inc.php.sample config_inc.php,将上面复制的内容拷贝至文件中
#vim config_inc.php
主要的配置如下:
<?php
$g_hostname = 'xxx.xxx.xxx.xxx'; #部署mantis服务器的地址
$g_db_type = 'mysqli'; #数据库类型
$g_database_name = 'mantisdb'; #数据库
$g_db_username = 'mantis'; #数据库账户
$g_db_password = 'mantis'; #数据库密码
$g_default_timezone = 'UTC';
$g_crypto_master_salt = 'YaS6wedzEKVE81aKSC442cxggYoZuJ5InZ63EDjrD+c=';
# --- Email Configuration ---
$g_phpMailer_method = PHPMAILER_METHOD_SMTP; #选择使用SMTP方式
$g_smtp_host = 'smtp.163.com'; #163邮箱的SMTP格式
$g_smtp_username = 'xxxxxx'; #163邮箱的登录账号
$g_smtp_password = 'XXXXXXXXXXXXXXXXX'; #设置的邮箱授权码
$g_webmaster_email = 'xxxxxx@163.com';
$g_from_email = 'xxxxxx@163.com';
$g_return_path_email = 'xxxxxx@163.com';
# $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; # or DISK
$g_absolute_path_default_upload_folder = '/var/www/html/mantis/upload/'; # used with DISK
$g_max_file_size = 50000000; # in bytes
$g_preview_attachments_inline_max_size = 1024 * 1024;
# $g_allowed_files = ''; # extensions comma separated, e.g. 'php,html,java,exe,pl'
# $g_disallowed_files = ''; # extensions comma separated
#以下自己添加
$g_default_language = 'chinese_simplified';
6、重启httpd:systemctl restart httpd.service;删除admin目录。
五、mantis发送注册邮件系统配置
1)、申请一个发件邮箱如163邮箱:
保存后执行以下命令:
getsebool httpd_can_sendmail #输出可能为off
getsebool httpd_can_network_connect #输出可能为off
setsebool -P httpd_can_sendmail ON #设置为on
setsebool -P httpd_can_network_connect ON #设置为on
set bsdcompat
set from=mantis_test@163.com
set smtp=smtp.163.com
set smtp-auth-user=mantis_test
set smtp-auth-password=XXXXXXXXXXXXX(申请的公用邮箱授权码:如163邮箱)
set smtp-auth=login
"/etc/mail.rc" 76L, 2048C
set sendcharsets=iso-8859-1,utf-8
cat test.php | mailx -s "发件人名称 邮件标题" xxxx@haohandata.com.cn
其中test.php为任意测试文件,格式不限,内容任意输入
执行后,对应的邮箱可以收到邮件,邮件内容为test.php内容;