ag@linux:~$

history 4 of 36

Install iRedMail: A Postfix Mail Server Setup Script

My short notes on downloading iRedMail 0.8.3 and running its installer script to set up a Postfix mail server, plus what to prepare and check.

Written

  • Email
  • Written for iRedMail 0.8.3
  • Written for Postfix

From my Linux study notes, 2012. Some commands and versions here are old, so please reuse them carefully. Anything marked "added later", and the notes at the end, explain what has changed since.

iRedMail is a free script that installs and configures a complete mail server for you: Postfix to send and receive mail, Dovecot for IMAP/POP3, webmail, and spam and virus filtering. Instead of setting up each piece by hand, you answer a few questions and the script does the rest. These were my notes from installing it.

Before you start

  • Use a fresh, newly installed server. iRedMail is meant to be installed on a clean system, not one already running a mail or web server, because it writes its own configuration for those services.

  • Run the commands as root.

  • Give the server a proper fully qualified host name (for example mail.example.com) before you start. Check it with:

    Terminal window
    hostname -f
  • To receive mail from the internet you also need DNS records for your domain: an MX record pointing to the mail server’s host name, and an A record for that host name.

  • Make sure bzip2 is installed, as the download is a .tar.bz2 file (yum install bzip2 on CentOS).

Steps

  1. Download iRedMail:

    Terminal window
    wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.8.3.tar.bz2
  2. Extract it:

    Terminal window
    tar -jxvf iRedMail-0.8.3.tar.bz2

    -j tells tar the archive is compressed with bzip2. -x extracts, -v lists the files and -f names the archive.

  3. Go into the extracted folder:

    Terminal window
    cd iRedMail-0.8.3
  4. Run the installer:

    Terminal window
    sh iRedMail.sh
  5. Follow the instructions. The installer asks a series of questions in the terminal, such as where to store mailboxes, which backend to use for mail accounts, your first mail domain and the password for the mail administrator. Write down the answers and passwords you choose.

When it finishes, the installer prints a summary and saves the details to a file in the iRedMail folder. Keep that file somewhere safe, then reboot the server as the installer suggests.

How to check it worked

  • Log in to webmail with the admin account and send a test email to an outside address, then reply to it.

  • Check that Postfix is running:

    Terminal window
    service postfix status
  • If mail does not arrive, look in the mail log, /var/log/maillog on CentOS and other Red Hat-family systems (/var/log/mail.log on Debian and Ubuntu).

Notes for today

  • iRedMail 0.8.3 is very old and the Bitbucket download link above may no longer work. Get the current release and the installation guide for your operating system from the official site, https://www.iredmail.org/, and check which systems it currently supports.
  • Services: on systemd systems, check Postfix with systemctl status postfix.
  • Delivery to big providers: a mail server that can send is not enough for its mail to reach inboxes. Set up SPF, DKIM and DMARC records for your domain and a reverse DNS (PTR) record for the server’s IP address; many large providers reject or junk mail without them.
  • Security: keep the server updated, use strong passwords for every mailbox, and make sure only the mail ports you need are open in the firewall.