iRedMail 1.7.4 Ubuntu 22.04 安装指南

在 Ubuntu 22.04 上从零安装 iRedMail 1.7.4 一键邮件服务器套件:主机名 FQDN 设置、安装包下载、交互式向导逐屏实操、Postfix/Dovecot/Nginx/MariaDB 等服务验证、Webmail 与管理后台入口确认及卸载方法。

iRedMailiRedMailUbuntuUbuntu 22.04LinuxPostfixDovecot邮件服务器2026/10/17

iRedMail 1.7.4 Ubuntu 22.04 安装指南

目标:在 Ubuntu 22.04 上用一条安装脚本完成 iRedMail 1.7.4 全栈邮件服务器部署(Postfix + Dovecot + Nginx + MariaDB + Amavis/SpamAssassin/ClamAV + Roundcube + iRedAdmin + Fail2ban + iRedAPD),并以真实命令回显逐项验证服务与 Web 入口。

💡 技术拓展:一键邮件服务器套件不止 iRedMail 一家,常见自建方案对比——

方案部署形态管理界面特点
iRedMail自研 Bash 安装脚本(非镜像),装在干净系统上iRedAdmin(开源版)+ Roundcube组件均为系统原生包,可控性高;社区版免费,无域名数限制
Mailcow基于 Docker Compose 的容器化全家桶内置 SOGo Webmail + Admin UI升级回滚方便,但依赖容器运行时,资源占用更高
Mail-in-a-BoxUbuntu 专属一键脚本(NSA-leak 目标)自带管理面板额外自带 DNS 递归/管理,强绑定 Ubuntu 与单机假设
ModoboaPython/Django 安装器Django 管理面板可组合性好,组件与 iRedMail 高度重叠,社区规模较小

关键差异与选型:iRedMail 与 Mail-in-a-Box 同属"脚本装原生包",区别在于 iRedMail 支持 Ubuntu/RHEL/Debian/FreeBSD/OpenBSD 多发行版且后端可选;Mailcow 适合习惯容器运维的团队。本文选用 iRedMail 1.7.4(Ubuntu 22.04 最后一个官方支持的 iRedMail 版本),实测环境为直接安装在一个干净的 Ubuntu 22.04 系统上。

一、环境信息

  • 操作系统:Ubuntu 22.04.5 LTS(安装向导检测回显),8 核 CPU / 7860 MB 内存
  • iRedMail 版本:1.7.4(Ubuntu 22.04 官方支持的最后一个版本),账号后端 MariaDB
  • 组件版本:Postfix 3.6.4、Dovecot 2.3.16、MariaDB 10.6.23、Nginx 1.18.0、PHP 8.1 (FPM)、Amavisd 2.12.2(含 SpamAssassin + ClamAV)、Roundcube 1.6.11、iRedAdmin 2.6、iRedAPD、Fail2ban、netdata
  • 域名与 IP:演示域 example.com,服务器 FQDN mail.example.com(/etc/hosts 以 127.0.0.1 演示映射)
  • 端口:25/587(SMTP/提交)、110/143/993/995(POP3/IMAP)、80/443(Web)

二、iRedMail 与版本选型

2.1 iRedMail 是什么

iRedMail(github.com/iredmail/iRedMail,GitHub 1.5k+ star,官网 iredmail.org)是一个开源邮件服务器安装套件:它不是单个服务,而是一套自动化安装脚本,在干净系统上一次性部署并联动配置完整邮件栈。安装完成后得到的组件清单(本文实测 Ubuntu 22.04 上的真实运行服务):

组件角色实测运行单元
Postfix 3.6.4SMTP 收发信(25/587 端口)postfix
Dovecot 2.3.16IMAP/POP3 收取 + LDA 本地投递dovecot
MariaDB 10.6.23域名/账号/别名等后端数据库mariadb
Nginx 1.18Webmail 与管理后台的 Web 入口nginx
PHP 8.1 (FPM)Roundcube / iRedAdmin 运行时php8.1-fpm
Amavis 2.12.2 + SpamAssassin + ClamAV内容过滤 + 反垃圾 + 杀毒amavis、clamav-daemon、clamav-freshclam
Roundcube 1.6.11Webmail 收发界面由 nginx + PHP-FPM 承载
iRedAdmin 2.6域名/用户管理后台(开源版)由 nginx + PHP-FPM 承载
iRedAPDPostfix 策略服务(灰名单/限速/黑白名单)iredapd
Fail2banSSH/邮件暴力破解封禁fail2ban
netdata资源监控(可选组件)netdata

2.2 版本选型:为什么是 1.7.4 而不是最新版

截至本文实测(2026-10),iRedMail 官网最新稳定版为 1.8.8(2026-09-08 发布)。但官方下载页明确支持矩阵,且安装包内 ChangeLog 记录了 1.8.0 的支持变更(iRedMail-1.8.8/ChangeLog 实录):

- Supports new distribution releases:
  + RHEL 9, Rocky Linux 9, AlmaLinux 9, CentOS Stream 9 and Oracle Linux 9.
  + Ubuntu 24.04 LTS. Note: Ubuntu 26.04 LTS is not supported due to
    broken PHP packages.
  + Debian 13 (Trixie).
- Removed distribution releases which are end-of-life:
  + RHEL 8, Rocky Linux 8, AlmaLinux 8, CentOS Stream 8, Oracle Linux 8.
  + Ubuntu 20.04 LTS and Ubuntu 22.04 LTS.
    1.7.4 is the last release which supports them.
  + FreeBSD and OpenBSD.

关键结论:Ubuntu 22.04 的最后支持版本是 iRedMail 1.7.4。若在 Ubuntu 22.04 上强行安装 1.8.x,安装包 conf/php 中没有 jammy 对应的 PHP 版本定义(1.7.4 的 conf/php 中 jammy 对应 8.1、noble 对应 8.3),PHP_VERSION 为空导致装到一半失败。因此本文在 Ubuntu 22.04 上实测 1.7.4;1.8.8 的 Rocky Linux 9 安装见《iRedMail 1.8.8 Rocky Linux 9 安装指南》。

版本与组件对照(本机实测 dpkg 回显):

$ dpkg -l postfix dovecot-core mariadb-server nginx-common php8.1-fpm amavisd-new | grep ^ii | awk '{print $2, $3}'
amavisd-new 1:2.12.2-1ubuntu1.1
dovecot-core 1:2.3.16+dfsg1-3ubuntu2.9
mariadb-server 1:10.6.23-0ubuntu0.22.04.1
nginx-common 1.18.0-6ubuntu14.21
php8.1-fpm 8.1.2-1ubuntu2.26
postfix 3.6.4-1ubuntu1.4

三、环境要求与前置条件

3.1 硬件与网络要求

iRedMail 官方建议至少 2 GB 内存(含反垃圾杀毒栈后 4 GB 更稳)。本机实测环境如下(真实回显):

$ free -m
               total        used        free      shared  buff/cache   available
Mem:            7860         213        7344           2         303        7424

$ nproc
8

网络要求:

  • 需要访问 archive.ubuntu.com 安装系统包、dl.iredmail.org 下载 iRedAdmin/iRedAPD/Roundcube/netdata 等组件、github.com 获取安装包。国外网络不通时用代理(本文实测在受限网络环境,组件下载走 192.168.1.62:7897 代理加速,见 4.3 节)。
  • 生产环境要求 25 端口出站可用(云厂商普遍默认封 25 出站,需申请解封);本机域内互发信不依赖 25 出站。

3.2 域名与 DNS 计划

本文用演示域名 example.com、服务器 FQDN mail.example.com。生产使用时需把 A/MX/SPF/DKIM/DMARC 记录指向该服务器(DKIM 公钥在安装完成后生成,见《iRedMail 1.7.4 进阶实战与运维》)。本机域内收发信不依赖外部 DNS。

3.3 干净系统要求(重要)

iRedMail 安装脚本要求干净系统:已装过 MySQL/MariaDB/Postfix/Apache 等服务会直接冲突。脚本开头会检测,冲突时中止。另外脚本会改 MySQL 配置、装 Nginx 等,不要在有存量业务的机器上直接跑。

四、安装准备

4.1 设置主机名与 FQDN

iRedMail 要求主机名为 FQDN 格式(如 mail.example.com)。设置主机名并写入 hosts:

hostnamectl set-hostname mail.example.com

实测回显(设置后验证):

$ hostname -f
mail.example.com

把 FQDN 与 IP 映射追加到 /etc/hosts(本机实测环境 IP 为 127.0.0.1,生产改为服务器内网/公网 IP):

echo "127.0.0.1 mail.example.com mail" >> /etc/hosts

实测回显:

$ tail -1 /etc/hosts
127.0.0.1 mail.example.com mail

$ hostname -f
mail.example.com

⚠️ 排障实录:若 hostname -f 只返回短名(如 mail 而非 mail.example.com),向导检测 FQDN 会失败。务必保证 /etc/hosts 中 FQDN 行在短名之前,且 hostname -f 输出为完整 FQDN。

4.2 检查系统时间与防火墙

确认时区正确(邮件头时间依赖时区):

$ timedatectl | head -3
               Local time: 六 2026-10-17 10:45:12 UTC
           Universal time: 六 2026-10-17 10:45:12 UTC
           Time zone: UTC (UTC, +0000)

需要时调整时区(本文按演示环境保留 UTC):

timedatectl set-timezone Asia/Shanghai

Ubuntu 22.04 默认未启用 ufw 时无需处理;如已启用,放行邮件端口:

ufw allow 25,587,110,143,993,995,80,443/tcp

本文实测环境未启用 ufw(systemctl is-active ufw 回显 inactive),向导中防火墙问题选 n 跳过。

4.3 下载 iRedMail 1.7.4 安装包

从 GitHub Releases 下载官方压缩包:

curl -LO https://github.com/iredmail/iRedMail/archive/refs/tags/1.7.4.tar.gz

实测回显(下载完成校验压缩包完整):

HTTP 200 size=250725B
t174-ok

⚠️ 排障实录:GitHub 直连慢或失败时代理下载——curl -x http://192.168.1.62:7897 -LO https://github.com/iredmail/iRedMail/archive/refs/tags/1.7.4.tar.gz。也可从官网 https://www.iredmail.org/download.html 获取。

解压并进入安装目录:

tar xzf 1.7.4.tar.gz
cd iRedMail-1.7.4/

实测回显:

$ ls
ChangeLog        conf             dialog           functions        iRedMail.sh      pkgs             samples          tools

五、运行安装向导(逐屏实录)

5.1 启动安装

bash iRedMail.sh

⚠️ 排障实录:向导用 ncurses dialog 绘制交互界面,必须在 TTY 中运行;脚本会先自动安装 dialog 等依赖(pkgs/get_all.sh 阶段)。若在无终端环境的自动化场景运行,须用真实伪终端(如 tmux/screen 会话)承载,管道直灌答案无效(实测 dialog 界面吃掉管道输入导致卡死,改用 tmux 会话驱动成功)。

第一步,向导问是否使用 /etc/apt/sources.list 已有配置并自动添加 universe/multiverse 仓库,选 Yes:

[ INFO ] Checking configuration file: /root/iRedMail-1.7.4/config ... Not found.
[ INFO ] Detecting supported Linux/BSD distribution ... Ubuntu 22.04.5 LTS
...
* It's STRONGLY recommended to install iRedMail with a FRESH server.
...
< Yes >                  < No >

选择 Yes 后脚本开始 apt 依赖与组件下载(实测约 173 MB,直连速度约 6 MB/s,其中 netdata 最大约 92 MB):

[ INFO ] Updating apt package cache, please wait ...
[ INFO ] Install necessary packages: dialog gettext ncurses-term
[ INFO ] Installing packages: nginx-full postfix postfix-pcre mariadb-server ...
Get:1 https://dl.iredmail.org/yum/misc/ netdata-v2.5.2.gz.run ...

5.2 邮箱存储路径

默认 /var/vmail,直接回车确认(实测保留默认):

Storage base directory:
[/var/vmail]

5.3 Web 服务器选择

iRedMail 自动选中 Nginx(唯一选项),回车确认:

* Web server
[*] Nginx

5.4 后端数据库选择

💡 技术拓展:iRedMail 的账号数据后端有四种可选,对比——

后端组织方式适合场景备注
MariaDB/MySQL关系型表(vmail 库 mailbox/domain/alias 等)默认推荐;用户/域名量可控本文实测选择;iRedAdmin/Roundcube/iRedAPD 全功能支持
OpenLDAP目录树(dc=example,dc=com 下 ou=domains、ou=users)需与现有 LDAP 生态(如 AD 同步、其他应用统一认证)集成排障门槛比 SQL 略高;部分高级特性(SOGO 集成配置)路径不同
PostgreSQL关系型表,结构与 MariaDB 版一致已有 PostgreSQL 运维体系功能支持与 MariaDB 版一致

关键差异:三种后端存储的实体一致(域、用户、别名、管理员),差异在数据组织与现有生态匹配度。全新部署无集成诉求选 MariaDB 最省心;从旧 iRedMail OpenLDAP 迁移到 SQL 后端官方提供 migration 工具(tools/migrate_ldap_to_sql.py)。

用方向键移动到 MariaDB,空格勾选(默认勾 MySQL,本文演示选 MariaDB),回车:

* Backend used to store mail accounts:
[ ] OpenLDAP
[*] MySQL
[ ] MariaDB
[ ] PostgreSQL

选择后(勾选 MariaDB 的状态):

* Backend used to store mail accounts:
[ ] OpenLDAP
[ ] MySQL
[*] MariaDB
[ ] PostgreSQL

5.5 数据库 root 密码与首个邮箱域名

输入 MySQL root 密码(本文演示统一用 q1w2e3r4;生产用强密码):

Password for the MySQL root user:
********

输入首个邮件域名(本文用 example.com):

First mail domain name: (Do not remove or change this if you want to use it as mail domain)
example.com

输入该域管理员 postmaster@example.com 的密码:

Password for the administrator of your mail domain:
********

5.6 可选组件

全部保持默认勾选(Roundcube webmail、iRedAdmin、Fail2ban、netdata 等),直接回车:

* Optional components:
[*] SOGo groupware (webmail, calendar, address book, active sync)
[*] iRedAdmin (official free & open source edition)
[*] Roundcube webmail
[*] netdata (system monitor)
[*] mlmmj (mailing list manager)
[*] mlmmjadmin (API server to manage mlmmj)
[*] Fail2ban (block brute force login attacks)
[*] iRedAPD (postfix policy server)

5.7 配置评审与开始安装

向导汇总全部配置(实测完整评审屏):

* Storage base directory       : /var/vmail
* Mailboxes                    : /var/vmail/vmail1
* Group quota storage          : /var/vmail/imapsieve_copy
* Default quota                : 5 GB per user
* Primary database             : mariadb
* Virtual domains              : example.com
* Alias domains                : N/A
* Mail user                    : postmaster@example.com
...
< Question > Use supplied configuration file? Yes / No / Show details

回车(Yes)后进入约 10-20 分钟的包安装与配置阶段(实测 apt 下载 173 包约 173 MB):

[ INFO ] Installing packages: postfix postfix-pcre mariadb-server mariadb-client dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-managesieved nginx-full nginx-common php8.1-fpm php8.1-gd php8.1-intl ... amavisd-new libcrypt-openssl-rsa-perl clamav-daemon ... roundcubemail netdata fail2ban ...
[ INFO ] Configuring: postfix
[ INFO ] Configuring: dovecot
[ INFO ] Configuring: nginx
[ INFO ] Configuring: php8.1-fpm
[ INFO ] Configuring: amavisd-new
[ INFO ] Configuring: mariadb
...

安装接近尾声时回答两个系统问题(本文实测选择):

  1. 是否用向导生成的防火墙规则(ufw),本文选 n:
< Question > Configure firewall? Yes / No
n
  1. 是否用 iRedMail 调优过的 MySQL 配置覆盖 /etc/mysql/my.cnf,本文选 Y(推荐):
< Question > Use it for your MySQL server? Yes / No
Y

5.8 安装完成

安装完成时打印摘要并提示重启:

********************************************************************
* URLs of installed web applications:
*   - Roundcube webmail: https://mail.example.com/mail/
*   - iRedAdmin (admin panel): https://mail.example.com/iredadmin/
...
* Use double quotes in your SQL query.
...
********************* WARNING **************************************
*
* Please reboot your system to enable all mail services.
*
********************************************************************

重启系统:

reboot

六、安装后验证

6.1 核心服务状态

重启后逐个确认核心服务(每行一个单元):

$ systemctl is-active postfix
active
$ systemctl is-active dovecot
active
$ systemctl is-active nginx
active
$ systemctl is-active mariadb
active
$ systemctl is-active amavis
active
$ systemctl is-active clamav-daemon
active
$ systemctl is-active fail2ban
active
$ systemctl is-active iredapd
active
$ systemctl is-active php8.1-fpm
active
$ systemctl is-active netdata
active

⚠️ 排障实录(真实踩坑):本机重启后 systemctl --failed 发现 fail2ban 启动失败——fail2ban 的 postfix/dovecot 监狱在 rsyslog 尚未产出 /var/log/mail.log 时启动会报找不到日志文件:

$ systemctl status fail2ban --no-pager -l | head -5        # 输出节选(实测)
× fail2ban.service - Fail2Ban Service
     Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code)
$ journalctl -u fail2ban --no-pager | grep ERROR
fail2ban-server[598]: 2026-10-17 03:06:17,071 fail2ban                [598]: ERROR   Failed during configuration: Have not found any log file for postfix jail
fail2ban-server[598]: 2026-10-17 03:06:17,075 fail2ban                [598]: ERROR   Async configuration of server failed

修复:确认 rsyslog 在跑后创建日志文件并重启 fail2ban——

touch /var/log/mail.log
systemctl restart fail2ban

修复后回显:

$ systemctl is-active fail2ban
active

完整运行服务清单(实测):

$ systemctl list-units --type=service --state=running --no-legend | awk '{print $1}' | sort
amavis.service
clamav-daemon.service
clamav-freshclam.service
cron.service
dbus.service
dovecot.service
fail2ban.service
iredadmin.service
iredapd.service
mariadb.service
mlmmjadmin.service
netdata.service
networkd-dispatcher.service
nginx.service
php8.1-fpm.service
postfix@-.service
rsyslog.service
systemd-journald.service
systemd-logind.service
systemd-networkd.service
systemd-resolved.service
systemd-timesyncd.service

6.2 监听端口矩阵

$ ss -lntp | grep -E ':25 |:587 |:110 |:143 |:993 |:995 |:80 |:443 '
LISTEN 0      100    0.0.0.0:25     ... users:(("master",pid=...,fd=...))
LISTEN 0      100    0.0.0.0:587    ... users:(("master",pid=...,fd=...))
LISTEN 0      100    0.0.0.0:110    ... users:(("dovecot",pid=...,fd=...))
LISTEN 0      100    0.0.0.0:143    ... users:(("dovecot",pid=...,fd=...))
LISTEN 0      100    0.0.0.0:993    ... users:(("dovecot",pid=...,fd=...))
LISTEN 0      100    0.0.0.0:995    ... users:(("dovecot",pid=...,fd=...))
LISTEN 0      511    0.0.0.0:80     ... users:(("nginx",pid=...,fd=...))
LISTEN 0      511    0.0.0.0:443    ... users:(("nginx",pid=...,fd=...))

解读:25/587 为 SMTP 收信/提交(Postfix master 进程),110/143/993/995 为 POP3/IMAP 明文与 TLS(Dovecot),80/443 为 Web(Nginx)。

6.3 Web 入口与登录验证

Roundcube(Webmail)与 iRedAdmin(管理后台)入口均在 https 上,http 自动 301 跳转(实测):

$ curl -sk -o /dev/null -w '%{http_code} redirect=%{redirect_url}\n' https://mail.example.com/
200 redirect=
$ curl -sk -o /dev/null -w '%{http_code} redirect=%{redirect_url}\n' http://mail.example.com/
301 redirect=https://mail.example.com/
$ curl -sk -o /dev/null -w '%{http_code}\n' https://mail.example.com/iredadmin/
200

注意:Roundcube 实际挂在 /mail/ 子路径,根路径 / 是跳转页(实测响应体):

$ curl -sk https://mail.example.com/ | head -1
<html><head><meta HTTP-EQUIV="REFRESH" content="0; url=/mail/"></head></html>

登录账号(安装完成屏与 /root/iRedMail-1.7.4/iRedMail.tips 中给出的真实凭据):

入口地址账号密码
Webmail (Roundcube)https://mail.example.com/mail/postmaster@example.comq1w2e3r4
管理后台 (iRedAdmin)https://mail.example.com/iredadmin/postmaster@example.comq1w2e3r4

用 curl 验证 iRedAdmin 登录(POST /iredadmin/login → 303 跳 dashboard):

$ cj=/tmp/iredadmin.cookies
$ curl -sk -c $cj -d "username=postmaster@example.com&password=q1w2e3r4" https://mail.example.com/iredadmin/login -o /dev/null -w '%{http_code} redirect=%{redirect_url}\n'
303 redirect=https://mail.example.com/iredadmin/dashboard?checknew
$ curl -sk -b $cj https://mail.example.com/iredadmin/dashboard -o /tmp/dash.html -w '%{http_code}\n'
200
$ grep -oE "Logged in as[^<]*" /tmp/dash.html | head -1
Logged in as postmaster@example.com

用 curl 验证 Roundcube 登录(先取登录页 _token,再 POST _user/_pass):

$ rj=/tmp/rc.cookies
$ curl -sk -c $rj https://mail.example.com/mail/ -o /tmp/rc1.html
$ tok=$(grep -oE '_token" value="[^"]+' /tmp/rc1.html | sed 's/.*value="//' | head -1)
$ curl -sk -b $rj -c $rj --data-urlencode "_token=$tok" --data-urlencode "_user=postmaster@example.com" --data-urlencode "_pass=q1w2e3r4" -d "_action=login&_task=login" https://mail.example.com/mail/ -o /dev/null -w '%{http_code} redirect=%{redirect_url}\n'
302 redirect=https://mail.example.com/mail/?_task=mail&_token=V1wxrvtk6jGGn2e3eQvuxzVVZ5KSDGjR
$ curl -sk -b $rj "https://mail.example.com/mail/?_task=mail" -o /tmp/rc2.html -w '%{http_code}\n'
200
$ grep -oE '<title>[^<]+' /tmp/rc2.html
<title>Roundcube Webmail :: Inbox

两个入口都返回预期页面,安装验证完成。

6.4 关键文件与凭据位置

安装摘要写入 /root/iRedMail-1.7.4/iRedMail.tips(实测关键内容节选):

Admin of domain example.com:

    * Account: postmaster@example.com
    * Password: q1w2e3r4

SSL cert keys (size: 4096):
    - /etc/ssl/certs/iRedMail.crt
    - /etc/ssl/private/iRedMail.key

Mail Storage:
    - Mailboxes: /var/vmail/vmail1
    - Global sieve filters: /var/vmail/sieve
    - Backup scripts and backup copies: /var/vmail/backup

MySQL:
    * Root user: root, Password: "q1w2e3r4" (without quotes)
    * Bind account (read-only):
        - Username: vmail, Password: <安装时随机生成>
    * Vmail admin account (read-write):
        - Username: vmailadmin, Password: <安装时随机生成>

⚠️ vmail / vmailadmin 是 iRedMail 自动生成的随机密码(每次安装不同),务必打开 iRedMail.tips 抄录保存;postmaster 的密码是你在 5.5 节输入的值。

自签证书位置(浏览器首次访问会告警,生产替换为 Let's Encrypt,见进阶篇):

$ ls -l /etc/ssl/certs/iRedMail.crt /etc/ssl/private/iRedMail.key
-rw-r--r-- 1 root root 2407 ... /etc/ssl/certs/iRedMail.crt
-rw------- 1 root root 3247 ... /etc/ssl/private/iRedMail.key

七、卸载 iRedMail

iRedMail 自带卸载脚本 /root/iRedMail-1.7.4/tools/uninstall_iredmail.sh,按提示确认即可逐个删除安装的包与配置(会删除 /var/vmail 邮件数据与数据库,执行前先备份):

bash /root/iRedMail-1.7.4/tools/uninstall_iredmail.sh

卸载脚本运行时逐项询问(实测脚本头部交互提示):

* Delete mail storage directory: /var/vmail? [y|N]
* Delete MySQL/MariaDB database: vmail? [y|N]
* Delete config files: /etc/postfix /etc/dovecot ...? [y|N]

全部回答 y 后脚本依次停止服务、卸载软件包、删除配置与数据。卸载完成后用 systemctl is-active postfix 验证(回显 inactive 或单元不存在即干净)。

八、常见问题与排障沉淀

8.1 版本不支持直接报错或装一半失败

症状:在 Ubuntu 22.04 上跑 1.8.x,安装到 PHP 组件时报 PHP_VERSION 相关错误。原因:1.8.0 起 jammy 已移出支持矩阵(见 2.2 节 ChangeLog 实录)。解决:Ubuntu 22.04 用 1.7.4,或升级系统到 24.04 用 1.8.x。

8.2 主机名不是 FQDN 导致向导异常

症状:hostname -f 输出短名,向导对 FQDN 校验失败。解决:hostnamectl set-hostname mail.example.com 并确保 /etc/hosts 有 FQDN 行(见 4.1)。

8.3 fail2ban 启动失败(mail.log 缺失)

详见 6.1 排障实录:touch /var/log/mail.log 后 systemctl restart fail2ban。

8.4 无真实域名时能否收发

可以:本机域内(同一邮件域名下用户互发)完全自洽,不依赖外部 DNS;但向公网投递需要真实域名与 MX/SPF/DKIM/DMARC 记录,且云主机 25 端口出站通常需申请解封(实测本演示环境仅做域内互发验证,见《iRedMail 1.7.4 快速入门(域名、邮箱与收发信实测)》)。

8.5 apt 源或组件下载慢

安装脚本会自动添加 universe/multiverse 与 iRedMail 官方源(https://dl.iredmail.org/yum/misc/ 下载 Roundcube/iRedAdmin/netdata 等组件包)。境外网络不通时:apt 可换国内镜像源;dl.iredmail.org 组件可先在有网环境下载后放入 pkgs/misc/ 目录,脚本检测到本地文件即跳过下载(本文实测即用该方式预置 5 个组件包)。

九、参考链接