這是本文件的舊版!


[Draft]iRedMail 升級紀錄(0.9.9 - 1.7.3)

  • 升級目標:
    1. 在原本 CentOS 7 環境由 0.9.9 升級到 1.7.3
    2. 在 Ubuntu 22.04 環境安裝 1.7.3 (Docker Compose 版本)
    3. 將 CentOS 7 的資料移轉到 Ubuntu 22.04 環境上
  1. 更新 iRedMail 版本標記

    vi /etc/iredmail-release

    將內容改成 1.0

  2. 更新 Fail2ban 過濾器配置文件

    cd /etc/fail2ban/filter.d/
    mv postfix.iredmail.conf postfix.iredmail.conf.0.9.9
    wget -O postfix.iredmail.conf https://github.com/iredmail/iRedMail/raw/1.0/samples/fail2ban/filter.d/postfix.iredmail.conf
    mv dovecot.iredmail.conf dovecot.iredmail.conf.0.9.9
    wget -O dovecot.iredmail.conf https://github.com/iredmail/iRedMail/raw/1.0/samples/fail2ban/filter.d/dovecot.iredmail.conf

    重啟 Fail2ban 服務

    systemctl restart fail2ban

  3. 配置 Postfix 查詢 Dovecot 郵箱配額狀態
    1. 確保使用 Dovecot 2.2 或更高版本

      dovecot --version

    2. 更新 Dovecot 配置文件

      vi /etc/dovecot/dovecot.conf

      找到 plugin {} 區塊,添加以下三個參數

      plugin {
          :
          # 1.0 Add
          quota_status_success = DUNNO
          quota_status_nouser = DUNNO
          quota_status_overquota = "552 5.2.2 Mailbox is full"
      }

      再添加以下配置以啟用配額狀態服務,監聽在 127.0.0.1:12340

      :
      # 1.0 Add
      service quota-status {
          executable = quota-status -p postfix
          client_limit = 1
          inet_listener {
              address = 127.0.0.1
              port = 12340
          }
      }
      
      !include_try /etc/dovecot/iredmail/*.conf
    3. 重啟 Dovecot 服務

      systemctl restart dovecot

  4. 更新 Postfix 配置文件

    vi /etc/postfix/main.cf

    添加以下配置以啟用配額查詢

    :
    smtpd_recipient_restrictions =
        ...
        check_policy_service inet:127.0.0.1:12340

    重載 Postfix 服務

    postfix reload
  5. 更新 MySQL/MariaDB 數據庫

    cd
    mkdir 1.0
    cd 1.0
    wget -O iredmail.mysql https://github.com/iredmail/iRedMail/raw/1.0/update/1.0/iredmail.mysql
    mysql vmail < ./iredmail.mysql

  6. 檢查和重啟服務

    systemctl status postfix dovecot fail2ban slapd

  7. 測試寄送與收取新的信件來確認 E-Mail 服務
  1. 更新版本標記

    vi /etc/iredmail-release

    將版本號改為 1.1

  2. 更新備份腳本

    cd /maildata/backup/
    mv backup_mysql.sh backup_mysql.sh.1.0
    wget -O backup_mysql.sh https://github.com/iredmail/iRedMail/raw/1.1/tools/backup_mysql.sh
    chown root backup_mysql.sh
    chmod 0500 backup_mysql.sh
    mv backup_sogo.sh backup_sogo.sh.1.0
    wget -O backup_sogo.sh https://github.com/iredmail/iRedMail/raw/1.1/tools/backup_sogo.sh
    chown root backup_sogo.sh
    chmod 0500 backup_sogo.sh

  3. 修復 CentOS 7 的 rsyslog 配置(僅 CentOS 7)

    vi /etc/rsyslog.d/1-iredmail-iredapd.conf

    if $syslogfacility-text == 'local5' and ($syslogtag startswith 'iredapd' or $msg startswith 'iredapd ') then -/var/log/iredapd/iredapd.log

    重啟 rsyslog

    systemctl restart rsyslog
  4. 修復 Postfix 的 Backup MX 配置

    perl -pi -e 's#%d#%s#g' /etc/postfix/mysql/relay_domains.cf
    postfix reload

  5. 檢查和重啟服務

    systemctl status postfix dovecot rsyslog

  6. 測試升級結果
  1. 更新版本標記

    vi /etc/iredmail-release

    將版本號改為 1.2

  2. 修復 Dovecot 配置文件

    vi /etc/dovecot/dovecot.conf

    禁用 mailbox_list_index

    :
    # 1.2 Add
    mailbox_list_index = no
    
    !include_try /etc/dovecot/iredmail/*.conf

    重啟 Dovecot

    systemctl restart dovecot
  3. 檢查和重啟服務

    systemctl status postfix dovecot

  4. 測試升級結果
  • tech/iredmail/upgrade.1745845896.txt.gz
  • 上一次變更: 2025/04/28 21:11
  • jonathan