Setup Modoboa Email Server on Ubuntu 22.04.2 LTS

Ubuntu 22.04.2 LTS
Minimum RAM 1gb (without clamav)
Minimum RAM 2gb (with clamav)

clamav-daemon start condition failed?
clamav-freshclam service needs lot of memory (out of memory will cause service to restart loop, then will be blocked by clamav CDN)
Rate limited / blocked from clamav CDN update, stop clamav-freshclam service for a while before restarting again

modoboa need pycairo
pycairo need packages:
sudo apt install libcairo2-dev pkg-config python3-dev

git clone https://github.com/modoboa/modoboa-installer
cd modoboa-installer
sudo python3 run.py --stop-after-configfile-check <domain>

update installer.cfg, set letsencrypt on
[certificate]
type=letsencrypt

[letsencrypt]
email=admin@domain.tld

run installer
sudo python3 run.py --debug <domain>

To limit clamav resource usages:
https://www.geekytuts.net/fix-high-server-load-and-memory-cpu-consumption-of-clamd-clamav/

To enable RAR scanning:
https://forum.proxmox.com/threads/av-scanning-in-rar-archives-not-working.71139/

To enable DKIM and SPF filter:
https://www.linuxbabe.com/mail-server/setting-up-dkim-and-spf

NOTE: DigitalOcean block outgoing port 25, alternative solution using sendgrid as relay to postfix
https://docs.sendgrid.com/for-developers/sending-email/postfix

Sources:
https://modoboa.readthedocs.io/en/latest/installation.html