Install iRedMail on Debian 12

Share

What is iRedMail?

iRedMail is a shell script that automatically installs and configures all necessary mail server components on your Linux/BSD server, thus eliminating manual installation and configuration. With iRedMail, you can easily create unlimited mailboxes and unlimited mail domains in a web-based admin panel. Mailboxes can be stored in MariaDB/MySQL, PostreSQL database or OpenLDAP. The following is a list of open-source software that will be automatically installed and configured by iRedMail.

Features of iRedMail Mail Server

  • Fully Open Source: All iRedMail components are built from open source applications. It has bee certified to run on Red Hat Enterprise Linux, CentOS, Debian, Ubuntu, FreeBSD, OpenBSD.
  • Top Security: All mail services are accessed through secured connections – Use of TLS to access POP3, IMAP and SMTP services. Web portals are access via HTTPS. Emails are encrypted in transit using TLS if possible.
  • Access to Webmail: An intuitive web portal is available for accessing and managing mails, folders, sieve filters – (Roundcube webmail or/and SOGo groupware).
  • Unlimited Accounts: You have the powers to create as many mail accounts (domains, users, mailing lists, admins) as you want.
  • Web Admin Panel: As admin user, you get a web admin panel where you manage mail accounts.
  • Antispam & Antivirus: SpamAssassin, ClamAV, SPF, DKIM, greylisting, whitelisting, blacklisting. Quarantining detected spam into SQL database for further review.
  • Support for OpenLDAP, MySQL, MariaDB, and PostgreSQL backend store for mail accounts. Choose what you like.

Before you begin

These are the basic requirements for installing iRedMail on Debian 12 / Ubuntu 24 LTS.

  • 2 GB of memory required. If you plan to use it in production environment with multiple domains and user accounts, the add more memory – 4 GB+
  • Make sure 3 UID/GID are not used by other user/group: 2000, 2001, 2002.
  • Mail Server domain name
  • A sudo user account – User account added to sudo group or root user access

So relax as you start installation of iRedMail Mail Server on Debian 12 / Ubuntu 24 LTS with these easy to follow steps.

Preparations:

Set a fully qualified domain name (FQDN) hostname on your server

Next, set a fully qualified domain name (FQDN) for your server with the following command.

sudo hostnamectl set-hostname mail.example.com

We also need to update /etc/hosts file with a command line text editor like Nano.

sudo nano /etc/hosts

Edit it like below. (Use arrow keys to move the cursor in the file.)

127.0.0.1       mail.example.com localhost

Save and close the file. (To save a file in Nano text editor, press Ctrl+O, then press Enter to confirm. To close the file, press Ctrl+X.)

To see the changes, log out and log back in, then run the following command to see your hostname.

hostname -f

Note: if you get this error during installation, you need to install gzip dialog

# bash iRedMail.sh
[ INFO ] Checking configuration file: /home/asengul/iRedMail-1.7.4/config …[ INFO ] Found, but not finished. Launching installation wizard.
/home/asengul/iRedMail-1.7.4/dialog/config_via_dialog.sh: line 44: dialog: command not found
[ INFO ] Exit.

Enable default official Debian/Ubuntu apt repositories

  • iRedMail needs official Debian/Ubuntu apt repositories, please enable them in /etc/apt/sources.list.
  • Install packages required by iRedMail installer:
sudo apt install -y gzip dialog

Download the latest release of iRedMail

  • Visit Download page to get the latest stable release of iRedMail.
  • Upload iRedMail to your mail server via ftp or scp or whatever method you can use, login to the server to install iRedMail. We assume you uploaded it to /root/iRedMail-x.y.z.tar.gz (replace x.y.z by the real version number).
  • Uncompress iRedMail tarball:
cd /root/
tar zxf iRedMail-x.y.z.tar.gz

Start iRedMail installer

It’s now ready to start iRedMail installer, it will ask you several simple questions, that’s all required to setup a full-featured mail server.

cd /root/iRedMail-x.y.z/
bash iRedMail.sh

Screenshots of installation:

  • Welcome and thanks for your use

Specify location to store all mailboxes. Default is /var/vmail/.

  • Then choose whether you want to run a web server. It’s highly recommended that you choose to run a web server because you need the web-based admin panel to add email accounts. Also it allows you to access the Roundcube webmail. By default, Nginx web server is selected, so you can simply press Enter. (An asterisk indicates the item is selected.)

Then select the storage backend for email accounts. Choose one that you are familiar with. This tutorial chose MariaDB. Press up and down arrow key and press the space bar to select.

If you selected MariaDB or MySQL, then you will need to set the MySQL root password.

Next, enter your first mail domain. You can add additional mail domains later in the web-based admin panel. This tutorial assumes that you want an email account like username@example.com. In that case, you need to enter example.com here, without sub-domain. Do not press the space bar after your domain name. I think iRedMail will copy the space character along with your domain name, which can result in installation failure.

Next, set a password for the mail domain administrator.

Choose optional components. By default, 4 items are selected. If you like to use the SOGo groupware (webmail, calendar, address book, ActiveSync), then press the down arrow key and space bar to select. Press Enter to the next screen.

Now you can review your configurations. Type Y to begin the installation of all mail server components.

At the end of installation, choose y to use firewall rules provided by iRedMail and restart firewall.

Now iRedMail installation is complete.

Reboot your Debian server.

sudo shutdown -r now
After installation successfully completed, you can access web-based programs if you choose to install them. Replace your_server below by your real server hostname or IP address.

Roundcube webmail: https://your_server/mail/
SOGo Groupware: https://your_server/SOGo
Web admin panel (iRedAdmin): https://your_server/iredadmin/
Netdata (monitor): https://your_server/netdata/

Read more

How To