安装LAMP

参考 https://www.linuxidc.com/Linux/2016-12/138757.htm

sudo add-apt-repository ppa:ondrej/apache2
sudo apt update

apt-get -y install apache2 php mysql-server php-mysql libapache2-mod-php  lynx

中间遇到错误,

E:could not get lock /var/lib/dpkg/lock -open

  原因是:可能是有另外一个程序正在运行,导致资源被锁不可用。而导致资源被锁的原因,可能是上次安装时没正常完成,而导致出现此状况。

  解决办法是:

    sudo rm /var/cache/apt/archives/lock

    sudo rm /var/lib/dpkg/lock

  再重新安装即可成功。

另一个错误,

Set the 'ServerName' directive globally

参考 https://www.jianshu.com/p/275b17d6a73e

  在/etc/apache2/apache2.conf中添加下面代码:
  ServerName localhost

中间安装mysql-server迟迟不能完成,top一下,看到mysql正在运行,
service mysql stop

安装完毕。重启MySQL,Apache,命令是:

  sudo service mysql restart
  sudo service apache2 restart

验证http服务,

lynx localhost

安装 mantis

但参考:http://www.linuxdiyf.com/linux/29157.html

另外安装,
sudo apt-get install php-mbstring php-xml

配置php时,/etc/php好几个版本,php -v确定当前版本是7.2

在/etc/php/7.2/apache2/php.ini下查找 ";extension=mysqli.so"将前面的分号删除
访问http://localhost/mantis/admin/install.php,完成配置即可(访问数据库的用户名需要跟安装mysql时配置的一致)

安装完后,要重启apathe2,访问192.168.1.26/mantis/admin/install.php配置

这时不知道mysl的用户名,密码,可以进入 /etc/mysql/debian.conf里去找,得知用户名:debian-sys-maint,密码 dST3vD6t5Rp9TmzH

mysql -u debian-sys-maint -p

进入。结果提示错误:Can't connect to local MySQL server through socket

尝试重启mysqld,折腾了一番: service mysqld restart or pkill mysqld 不知为啥就好了。

mysql设置root密码

现在终于被我找到了解决方法,如下(请先测试方法三,谢谢!):
方法一:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>

mysql>

方法二:
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:
# mysql -udebian-sys-maint -p
Enter password: <输入[client]节的密码>
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

# mysql -uroot -p
Enter password: <输入新设的密码newpassword>

PHP和邮箱配置

PHP配置类似于:

记得配置php.ini中smtp选项

[mail function]

; For Win32 only.

; http://php.net/smtp

SMTP = smtp.163.com #此处需要配置邮箱smtp服务地址

; http://php.net/smtp-port

smtp_port = 25

邮箱配置:

在/var/www/html/mantis/config/config_inc.php后添加:

$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
$g_smtp_host = 'smtp.21cn.com';
#$g_smtp_host = 'smtp.mxhichina.com';
#$g_smtp_connection_mode = 'ssl';
$g_smtp_port = 25;
$g_smtp_username = 'tangxiaosheng@21cn.com';
$g_smtp_password = 'xxxx';
#$g_smtp_username = 'mantisadmin@estonecn.com';
#$g_smtp_password = 'Mantis1234';
$g_webmaster_email = 'mantisadmin@estonecn.com';
$g_from_name = 'Mantis Bug Tracker';
$g_from_email = 'tangxiaosheng@21cn.com'; #the "From: " field in emails
$g_return_path_email = 'tangxiaosheng@21cn.com'; # the return address for bounced mail
#$g_return_path_email = 'mantisadmin@estonecn.com'; # the return address for bounced mail
$g_email_receive_own = OFF;

$g_email_send_using_cronjob = ON;
$g_enable_email_notification = ON;

之前g_return_path_email = 'tangxiaosheng@21cn.com',填的是 ‘tangjian@estonecn.com’,后来改了以后就可以了。

https://my.oschina.net/yyping/blog/89411 提到:
$g_return_path_email = xxxxxx@souhu.com #将后面的邮件地址改为有效的地址,这一点非常重要,不然将无法正常发送激活注册的邮件.

难道 tangjian@estonecn.com不被认为是有效的邮件地址?事实证明了这点,$g_return_path_email 和 $g_from_email 都不支持estonecn.com (阿里邮箱)。

一遍用 delete from mantis_user_table where username = 'tangjian'; 从数据库里删东西,一边用tangjian这个用户名建新用户。

确保 $g_return_path_email 和 $g_from_email 不用阿里邮箱,仅仅是$g_smtp_username用阿里邮箱,发现也不行。

修改完config_inc.config后,不用重启apache2服务。

用这个sql语句:
select * from mantis_email_table;

可以查询那些邮件没有发出去,一般是空的,因为已经在发送的路上了。如果非空,一般发送回失败。

用命令: php /var/www/html/mantis/scripts/send_emails.php 可以看到发送失败的原因。如果成功,一般就显示:

Sending emails...
Done.

解决Mantis无法发送邮件的问题 这个的价值挺高,之前没有设置 $g_email_send_using_cronjob = ON; 导致其它都设置合理的情况下,邮件发不出去。
但是仅仅把这个设为ON,接收邮件速度还是慢了些。

中间还发现经过管理员设置后,用administrator:root无法登陆。那么重新来,按照 h

按照 centos7.3 安装mantis ,重新建立数据库bugtracker,

>create database bugtracker;

>grant all privileges on bugtracker.* to admin@localhost identified by 'yishi';

>flush privileges;

等等操作。

mantis发送邮件的原理:定时任务中的send_emails.php,会读取数据库的邮件队列表mantis_email_table.获取发送的列表后,依次按照ID的升序发送,发送完毕后清空。等待下次队列,周而复始。

可以把 */1 * * * *   root php /var/www/html/mantis/scripts/send_emails.php >/dev/null 加入到/etc/crontab,每分钟都尝试发一次邮件。

提交时超慢的原因和解决办法:

解决方案:
发送表 mantis_email_table中的邮件 ,并及时清理。
检查函数email_send() 中邮件发送和邮件删除功能是否正常,步骤是否都一一走完。

我的体验是,对于总是失败的邮件,可以在表中进行删除。

有人提议:

无法发送邮件,而又不知道如何解决的问题,可以通过以下方法进行调试:

增加调试语句,在文件/core/email_api.php的1032行,增加调试语句:var_dump(LOG_EMAIL);var_dump($t_log_msg . $mail->ErrorInfo);

我加了这个语句。不知道之前发送后打印的错误信息,是否和我加了这个语句有关。

提示不允许使用免费邮件地址

APPLICATION ERROR #1201
It is not allowed to use disposable e-mail addresses.

询问开发者得知,程序中使用了DisposableEmailChecker的插件,用于检测一次性邮箱地址的域。

解决方法为,将
/var/www/html/mantis/vendor/vboctor/disposable_email_checker/data/domains.txt

文件中 qq.com 从文件中移除取可。目前已经处理了21cn,yeah, sohu, qq邮箱。

ubuntu14安装mantis实践(包含LAMP/PHP)的更多相关文章

  1. Linux下安装mantis配置指南【转】

    转自:http://blog.csdn.net/xabc3000/article/details/6858229 目录(?)[-] Linux下安装mantis配置指南 配置Linux下的Apache ...

  2. centos7下安装mantis

    1.环境配置 Web Server:Apache,The web server must support PHP. 数据库:MySQL (or one of its forks, e.g. Maria ...

  3. Zookeeper、Solr和Tomcat安装配置实践

    Zookeeper.Solr和Tomcat安装配置实践

  4. Oracle创建新undo表空间最佳实践(包含段检查)

    在处理一则ORA-600 [4194]案例时,参考MOS文档:Step by step to resolve ORA-600 4194 4193 4197 on database crash (文档 ...

  5. centos7安装mantis

    安装mantis的步骤如下: 1. 安装apache, mysql等必要软件 1 #yum update 2 #yum install httpd php php-pdo php-mysql php- ...

  6. ubuntu server 安装 mantis bug tracker 中文配置

    ubuntu server 安装 mantis bug tracker 中文配置 官网:http://www.mantisbt.org/ 一:安装: 1:进入到 apache2的网站目录: cd /v ...

  7. wamp服务器下安装mantis

    什么是Mantis Mantis是一个BUG管理系统.主要特点如下: 1.用php写的系统,安装方便,不用像 bugzilla 那样安装那么多perl支持: 2.系统相对简单轻磅,使用简单: 3.出色 ...

  8. MySQL 5.7安装最佳实践

    MySQL 5.7安装最佳实践 1.环境准备OS: CentOS Linux release 7.4.1708 (Core) for VMwareMySQL: mysql-5.7.24-linux-g ...

  9. CentOS7 安装 RocketMQ 实践和小示例

    CentOS7 安装 RocketMQ 实践和小示例 1.通过 SSH 工具(比如 XShell)连接到 CentOS7 服务器上: 2.进入到 /usr/local 目录中: cd /usr/loc ...

随机推荐

  1. sqoop导入数据到hive中元数据问题

    简单配置了sqoop之后开始使用,之前用的时候很好用,也不记得有没有启动hivemetastore,今天用的时候没有启动,结果导入数据时,如果使用了db.tablename,就会出现找不到数据库的错, ...

  2. windows下IDEA的terminal配置bash命令

    使用git-bash.exe会单独打开一个窗口,而我们希望是在终端内置的命令行.这里我使用bash.exe 在IDEA中,打开settings,设置相应的bash路径 settings–>Too ...

  3. diff ->> acl & prefix list

    1,ACL可以用于数据层面也可以用于控制层面,prefix-list只能用于控制层面2,ACL抓的是定长掩码的子网,而prefix-list可以抓取一个前缀下的所有掩码长度即子网.比如说ACL中的pe ...

  4. Linux操作系统配置Go语言编程环境

    之前一直在windows下写Go,现在工作环境切换至Linux下,因此写下此文,记录安装Go环境的过程. 操作系统:CentOS7.5 一.安装步骤 1,下载Go语言安装包 yum install g ...

  5. 第四百一十六节,Tensorflow简介与安装

    第四百一十六节,Tensorflow简介与安装 TensorFlow是什么 Tensorflow是一个Google开发的第二代机器学习系统,克服了第一代系统DistBelief仅能开发神经网络算法.难 ...

  6. 通用 正则表达式 C# (.NET)Regex 总结

    [参考]C#正则表达式Regex类的用法    语法: 1. new System.Text.RegularExpressions.Regex("\\$\\d{1,2}\\}"). ...

  7. swiper4自动轮播切换手动触碰后停止踩坑——属性disableOnInteraction

    swiper4轮播设置autoplay自动切换后,即默认设置: <script> var mySwiper = new Swiper('.swiper-container', { auto ...

  8. centos7 nginx Failed to read PID from file /run/nginx.pid: Invalid argument 解决方法

    笔者在centos7上,配置nginx代理服务后, systemctl status nginx.service 提示错误 Failed to read PID from file /run/ngin ...

  9. iOS开发之--属性关键字以及set和get方法

    一.属性分为三大类 1.读写性控制 a.readOnly只读,只会生成get方法,不会生成set方法 b.readWrite可读可写,会生成set方法,也会生成get方法(默认设置) 2.setter ...

  10. docker 应用-2(Dockerfile 编写以及镜像保存提交)

    我们可以从docker hub上pull别人的镜像,也可以将容器进行修改,然后commit镜像,并把镜像push到docker hub上被被人使用.但是,直接pull或者push镜像的方式太过笨重,尤 ...