上传压缩包
解压
[root@localhost ~]# unzip U-Mail_x86_64_AS7.7_common_V9.8.91.zip
[root@localhost ~]# rm -rf U-Mail_x86_64_AS7.7_common_V9.8.91.zip
[root@localhost ~]# cd u-mail/
安装
[root@localhost u-mail]# ./install.sh
Next
填写邮箱域名【不要使用 domain.com,这只是默认域名】,然后【Next】
填写邮件存储路径,如果不清楚相关的存储路径,先默认,后续可以进行修改
设置 webmail 的端口号(默认为 80 端口)
Apache 端口,默认即可
设置 Mysql 的 root 的密码
确定一下设置的选项,此步建议截图保存好,以免后续忘记密码
Install
中间安装过程忽略,直到提示【请输入 ‘[email protected]’ 的密码:】,
在这里自行设置下管理员的密码,输完回车确定,若后面忘记,可以在安
装完成后执行:/usr/local/u-mail/app/sbin/admin_setting init 来
重置管理员密码。
完成
关闭防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# setenforce 0
完成
查看状态
[root@localhost ~]# /etc/init.d/umail_redis status
[root@localhost ~]# /etc/init.d/umail_app status
[root@localhost ~]# /etc/init.d/umail_webvue status
重启umail_app服务
[root@localhost ~]# /usr/local/u-mail/app/engine/bin/supervisorctl --configuration /usr/local/u-mail/app/conf/supervisord.ini restart all
查看mysql状态
[root@localhost ~]# /etc/init.d/umail_mysqld status
SUCCESS! MySQL running (14339)
重启mysql
[root@localhost ~]# /etc/init.d/umail_mysqld restart
UMAIL LOG路径
[root@localhost ~]# cd /usr/local/u-mail/log/
[root@localhost ~]# cd /usr/local/u-mail/app/log
[root@localhost ~]# more /usr/local/u-mail/log/mysql/default.err
[root@localhost data]# tail /usr/local/u-mail/log/mysql/default.err
备份路径
/usr/local/u-mail/data/backup/
提示:
备份数据的保存路径需要先建立好,并且给予umail用户写权限(设置目录权限为777或将目录属主设为umail);
备份数据类型:数据库(邮箱账号及其设置等)、邮件数据(所有用户的邮件数据)、网盘数据(网络硬盘数据);
数据库配置文件
[root@localhost ~]# vim /usr/local/u-mail/config/mysql/my.cnf
添加 innodb_force_recovery=6
重启数据库
[root@localhost ~]# /etc/init.d/umail_mysqld restart
邮件数据存放点
/usr/local/u-mail/data/mailbox/innosilicon.com.cn/0 #默认
##公司UMAIL使用链接操作指向到了 /data/0
[root@umail innosilicon.com.cn]# pwd
/usr/local/u-mail/data/mailbox/innosilicon.com.cn
[root@umail innosilicon.com.cn]# ll
lrwxrwxrwx. 1 root root 7 Aug 24 2020 0 -> /data/0
Check数据库
[root@localhost ~]# /etc/init.d/umail_mysqld restart #重启数据库
[root@localhost 0]# /usr/local/u-mail/service/mysql/bin/mysqlcheck -uumail -p`cat /usr/local/u-mail/config/mysql_password.conf` -B umail --auto-repair
# Check数据库
# 如出现 mysqlcheck:Got error
# 需使用 tail /usr/local/u-mail/log/mysql/default.err | grep ERROR 查看情况
Login数据库
[root@localhost data]# /usr/local/u-mail/app/sbin/mylogin #已设置别名 mylogin
删除core_auth_log
[root@localhost data]# rm -rf /usr/local/u-mail/data/mysql/default/umail/core_auth_log.*
使用mysqldump导出数据库umail至 umail.sql
/usr/local/u-mail/service/mysql/bin/mysqldump -u umail -p`cat /usr/local/u-mail/config/mysql_password.conf` umail > umail_$(date +%F).sql
#已设置别名 mysqldump
停止服务
[root@localhost ~]# /etc/init.d/umail_webvue stop
[root@localhost ~]# /etc/init.d/umail_app stop
[root@localhost ~]# /etc/init.d/umail_dovecot stop
[root@localhost ~]# /etc/init.d/umail_postfix stop
[root@localhost ~]# /etc/init.d/umail_redis stop
[root@localhost ~]# /etc/init.d/umail_mysqld stop
[root@localhost ~]# mv /usr/local/u-mail/data/mysql/default /usr/local/u-mail/data/mysql/default-bak
[root@localhost ~]# /usr/local/u-mail/service/mysql/bin/mysqld --initialize --user=umail_mysql
[root@localhost ~]# sed -i '/^max_connections/a\skip-grant-tables' /usr/local/u-mail/config/mysql/my.cnf
vim /usr/local/u-mail/config/mysql/my.cnf
删除innodb
[root@localhost ~]# /etc/init.d/umail_mysqld restart
login数据库
[root@localhost ~]# mv /usr/local/u-mail/data/mysql/default /usr/local/u-mail/data/mysql/default-bak-2
[root@localhost mysql]# /usr/local/u-mail/service/mysql/bin/mysqld --initialize --user=umail_mysql # 会生成default目录
[root@localhost ~]# /etc/init.d/umail_mysqld restart
再次login数据库
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set authentication_string=password("Password_20211014") where user="root";
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
[root@localhost mysql]# sed -i '/^skip-grant-tables/d' /usr/local/u-mail/config/mysql/my.cnf
[root@localhost ~]# /etc/init.d/umail_mysqld restart
进入数据库修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssw0rd';
Query OK, 0 rows affected (0.02 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
[root@localhost ~]# cat /usr/local/u-mail/config/mysql_password.conf
6a284c6038d10d3
mysql> create user 'umail'@'localhost' identified by '6a284c6038d10d3';
Query OK, 0 rows affected (0.03 sec)
mysql> grant all on umail.* to 'umail'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> create database umail;
Query OK, 1 row affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
# 使用mysqldump导出数据库umail至 umail.sql
[root@localhost ~]# mysqldump -u umail -p`cat /usr/local/u-mail/config/mysql_password.conf` umail > umail_2021-10-19.sql
# 将 sql 导入 umail数据库
[root@localhost ~]# mysql -uumail -p`cat /usr/local/u-mail/config/mysql_password.conf` umail < umail_2021-10-19.sql
# 重启 mysqld 服务
[root@localhost ~]# /etc/init.d/umail_mysqld restart
修复
[root@localhost mysql]# /etc/init.d/umail_mysqld stop
[root@localhost mysql]# mv /usr/local/u-mail/data/mysql/default-bak /usr/local/u-mail/data/mysql/default
vim /usr/local/u-mail/config/mysql/my.cnf
添加 innodb_force_recovery=6
## 重启 mysqld
[root@localhost mysql]# /etc/init.d/umail_mysqld restart
## 使用 mysqldump导出数据库 umail至 umail.sql
[root@localhost ~]# mysqldump -uumail -p`cat /usr/local/u-mail/config/mysql_password.conf` umail > umail_$(date +%F).bak
## 停止 mysqld
[root@localhost mysql]# /etc/init.d/umail_mysqld stop
## 去除 innodb_force_recovery=6
[root@localhost mysql]# mv default-bak-2/ default
[root@localhost mysql]# /etc/init.d/umail_mysqld restart
[root@localhost ~]# mysql -uumail -p`cat /usr/local/u-mail/config/mysql_password.conf` umail < umail_2021-10-20.bak
[root@localhost mysql]# /etc/init.d/umail_mysqld restart
## 进入数据库
mysql> show tables;
mysql> delete from core_nonce;
## 重启所有 /etc/init.d 下的 umail服务
[root@localhost init.d]# ls /etc/init.d | grep umail
umail_apache
umail_app
umail_clamd
umail_dovecot
umail_dspam
umail_mysqld
umail_nginx
umail_operation
umail_postfix
umail_postgresql
umail_postgrey
umail_redis
umail_spamassassin
umail_webcal
umail_webvue
[root@localhost ~]# for i in `ls /etc/init.d | grep umail` ; do /etc/init.d/$i restart ; done
[root@localhost init.d]# ulimit -n 20480
安装路径 /usr/local/u-mail
app:脚本存放路径,主要存放各种脚本等信息
config:配置文件路径,主要存放 php、mysql、nginx 等各种程序的配置文件
data:数据存储路径,主要存放帐号、邮件数据、webmail 等各种数据
log:日志存放路径,主要存放收发日志(log 目录下 app 子目录)和程序的运行日志等
service:服务文件路径,主要存放 php、mysql、nginx 等各种程序各主服务文件
download_patch.sh:补丁脚本,即运行脚本后打最新的版本补丁
uninstall.sh:卸载脚本,即执行此脚本后卸载 U-Mail
update.sh:升级脚本,即执行此脚本后升级 U-Mail
用命令查看UMAIL服务
[root@localhost u-mail]# chkconfig --list | grep umail
[root@localhost u-mail]# systemctl list-dependencies | grep umail
umail_apache 服务:Apache 程序
umail_app 服务:应用程序
umail_clamd 服务:反病毒程序
umail_dovecot 服务:POP 和 IMAP 接收邮件程序(客户端工具)
umail_dspam 服务:反垃圾程序
umail_mysqld 服务:Mysql 程序
umail_nginx 服务:Nginx 程序
umail_openldap 服务:LDAP 程序
umail_operation 服务:管理后台程序
umail_postfix 服务:Postfix 程序
umail_postgrey 服务:Postgrey 程序
umail_redis 服务:Redis 程序
umail_sapmassassin 服务:反垃圾程序
启动 重启 停止 服务
[root@localhost u-mail]# /etc/init.d/umail_nginx start
[root@localhost u-mail]# /etc/init.d/umail_nginx restart
[root@localhost u-mail]# /etc/init.d/umail_nginx stop
[root@localhost u-mail]# vim /usr/local/u-mail/config/mysql/my.cnf
在[mysqld]段中加入 skip-grant-tables 字符
重启mysql服务
[root@localhost u-mail]# service umail_mysqld restar
登录数据库
/usr/local/u-mail/service/mysql/bin/mysql -uroot -p #已设置别名 mysql
提示输入密码,直接回车即可
进入 mysql 数据库,修改 root 密码
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.01 sec)
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password=password(“新密码”) where user=”用户名”; # 如报错使用如下方式
mysql> update user set authentication_string=password('P@ssw0rd123456') where user='root'';
Query OK, 1 row affected, 1 warning (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges; #立即生效
Query OK, 0 rows affected (0.00 sec)
再次进入数据库测试新密码是否设置成功
[root@localhost ~]# /usr/local/u-mail/service/mysql/bin/mysql -uroot -p
别忘了删除my.conf 配置文件中的skip-grant-tables
删除之后 重启mysqld
[root@localhost ~]# service umail_mysqld restart
查看和修改时间
[root@localhost openldap]# date
Thu Oct 21 15:41:57 CST 2021
[root@localhost openldap]# date -s '2021-10-21 15:42'
Thu Oct 21 15:42:00 CST 2021
[root@localhost openldap]# clock -w
队列可以使用“邮件系统队列管理程序(mqm)”来进行管理,该程序位于:
/usr/local/u-mail/app/sbin/mqm。本程序当前可以对任务队列进行“统计”、“查
看任务列表”、“删除指定任务”、“清空队列”以及“删除触发器”等操作,下
面将介绍各操作的使用方法。
查看队列统计:mqm stat
[root@umail ~]# /usr/local/u-mail/app/sbin/mqm stat #已设置别名
2021-10-21 18:07:43 MQM[INFO]: + QueueName StatCount
2021-10-21 18:07:43 MQM[INFO]: -----------------------
2021-10-21 18:07:43 MQM[INFO]: @ deliver : 0
2021-10-21 18:07:43 MQM[INFO]: @ smtp : 0
2021-10-21 18:07:43 MQM[INFO]: @ router : 0
2021-10-21 18:07:43 MQM[INFO]: @ postman : 0
2021-10-21 18:07:43 MQM[INFO]: @ incheck : 0
2021-10-21 18:07:43 MQM[INFO]: @ maillist : 0
2021-10-21 18:07:43 MQM[INFO]: @ forward : 0
2021-10-21 18:07:43 MQM[INFO]: @ dkim : 0
2021-10-21 18:07:43 MQM[INFO]: @ review : 0
2021-10-21 18:07:43 MQM[INFO]: @ reply : 0
2021-10-21 18:07:43 MQM[INFO]: # smsnotice : 0
2021-10-21 18:07:43 MQM[INFO]: # impush : 0
2021-10-21 18:07:43 MQM[INFO]: + Trigger
2021-10-21 18:07:43 MQM[INFO]: -----------------------
查看指定队列中的任务列表 例:smtp
[root@umail ~]# mqm list smtp
2021-10-21 18:14:45 MQM[INFO]: + Task List (smtp)
2021-10-21 18:14:45 MQM[INFO]: -----------------------
从队列中删除指定任务
[root@localhost ~]# mqm remove <任务名称> <任务ID>
UMAIL 日志
/usr/local/u-mail/log/app #日志 路径
查询日志
这里以发送日志查询为例:
[root@umail app]# cd /usr/local/u-mail/log/app/
[root@umail app]# cat smtp.log.2021-10-20 | grep wangj #查看 10/20日 王俊外发记录
[root@umail app]# tail -f smtp.log #实时查看外发记录