Introduction
If you're looking to set up your own email server on a Debian or Ubuntu system, iRedMail is one of the most reliable and user-friendly open-source solutions available. It bundles everything you need into a single, well-integrated package: email server (Postfix), IMAP/POP3 server (Dovecot), webmail interface (Roundcube), antivirus and anti-spam filters (ClamAV, SpamAssassin), and an administration panel.
iRedMail is ideal for beginners because it automates the complex setup process and helps you get a fully functional and secure mail server running with minimal manual configuration. This guide will walk you through installing iRedMail step by step on a fresh Debian or Ubuntu server.
Prerequisites
Before installing iRedMail, make sure you meet the following requirements:
1. Supported OS:
Debian 12, 11.
Ubuntu 24.04, 22.04 (64-bit only).
2. A fresh server:
A clean installation with no existing mail services (Postfix, Dovecot, etc.) pre-installed.
Do not install it on a server already running a control panel like cPanel, Plesk, or Webmin.
3. System requirements:
At least 4 GB of memory is required for a low-traffic production mail server with spam/virus scanning enabled.
Network port 25 must be enabled. If the port for your server is disabled, contact our support team.
4. Root access:
Full SSH access with root privileges or the ability to use sudo.
5. Fully qualified domain name (FQDN):
e.g., mail.example.com, with proper DNS records (A and MX).
Installation
Step 1: Update your system
Make sure your system is fully updated before starting.
sudo apt update && sudo apt upgrade -y
After, reboot your server:
sudo reboot
Step 2: Set your hostname and FQDN
Make sure your server has a proper hostname and FQDN. It needs to be your domain name. For our Time4VPS clients, you can set up your server’s hostname via the client’s area.
Verify if the hostname is set correctly:
hostname
hostname -f
They should both return your set domain/subdomain name.
Step 3: Download iRedMail
Navigate to /root and download the latest release. Right now it is 1.7.4 version:
cd /root
wget https://github.com/iredmail/iRedMail/archive/refs/tags/1.7.4.tar.gz
tar xvf 1.7.4.tar.gz
cd iRedMail-1.7.4/
Step 4: Run the installer
Start the interactive installer:
bash iRedMail.sh
After the run, you should see a welcoming window:
During installation, you'll be prompted for:
Mail storage path (default is fine)
Web server: Choose Nginx
Backend: Choose OpenLDAP, MariaDB, or PostgreSQL.
There's no big difference between available backends, so it's strongly recommended to choose the one you're familiar with for easier management and maintenance after installation.
Domain name: Enter your mail domain (e.g., example.com)
Mail admin account: e.g., [email protected]
Password for the admin account
Optional components like Roundcube, SOGo, Netdata, Fail2Ban — select as needed
After answering the above questions, the iRedMail installer will ask you to review and confirm to start the installation. It will install and configure the required packages automatically. Type y or Y and press Enter to begin.
After confirming, the installer will configure all services automatically.
Step 5: Reboot the server
After successful installation, reboot:
sudo reboot
Step 6: Access the iRedAdmin panel and webmail:
Roundcube webmail: https://mail.example.com/mail/
SOGo Groupware: https://mail.example.com/SOGo
Web admin panel (iRedAdmin): https://mail.example.com/iredadmin/
Step 7: Install Let’s Encrypt SSL certificate:
Install Certbot and the Nginx plugin:
sudo apt install certbot python3-certbot-nginx -y
Stop Postfix and Dovecot temporarily:
sudo systemctl stop postfix dovecot
Request SSL Certificate:
sudo certbot certonly --nginx -d mail.example.com
Follow the prompts. If successful, certificates are stored in:
/etc/letsencrypt/live/mail.example.com/
Step 8: Configure iRedMail to use Let's Encrypt certificates
Edit these files. First Postfix file:
sudo nano /etc/postfix/main.cf
Replace the TLS entries (mail.example.com with your domain!):
smtpd_tls_key_file = /etc/letsencrypt/live/mail.example.com/privkey.pem
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.example.com/fullchain.pem
Save and exit. Now Dovecot file:
sudo nano /etc/dovecot/dovecot.conf
ssl_cert = </etc/letsencrypt/live/mail.example.com/fullchain.pem
ssl_key = </etc/letsencrypt/live/mail.example.com/privkey.pem
Nginx (Webmail/Admin Panel). Edit the SSL block in /etc/nginx/templates/ssl.tmpl
:
ssl_certificate /etc/letsencrypt/live/mail.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mail.example.com/privkey.pem;
Restart services:
sudo systemctl restart postfix dovecot nginx
Conclusion
Done! Now you have a iRedMail client working on your server with SSL certificate enabled for your sites and emails. The weakest part of a mail server is user's weak password. Spammers don't want to hack your server, they just want to send spam from your server. Please always force users to use a strong password.