How To Install iRedMail On Ubuntu 12.04 x64

Published on March 17, 2013

Bulat Khamitov

How To Install iRedMail On Ubuntu 12.04 x64

Status: Deprecated

This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:

Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.

See Instead:
This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.

If you would like to create your own online e-mail system, you can use iRedMail. In this article, we will explain how you can do it.

Step 1 - Droplet Creation

We use a 2 CPU Core / 2GB RAM droplet with Ubuntu 12.04 x64 image.

iRedMail is currently supported on Ubuntu 12.04 LTS and Ubuntu 13.04, among many other distributions of Linux.

If you have a domain name you want to use, name your droplet as that domain name, which will become its hostname and reverse DNS record.

Step 2 - Create a Domain Name

For our Cloud Mail purposes, we will register a free domain, cloudmail.tk from dot.tk

Once you have your domain name registered, point it to DigitalOcean's name servers:

ns1.digitalocean.com (

ns2.digitalocean.com (

ns3.digitalocean.com (

Make sure to check those IP addresses manually, as they may have changed since the time this article was written.

Now open your Control Panel on DigitalOcean and click DNS, located under Labs section.

Click Add Domain and create a new record by pointing your new domain to your droplet's IP address:

Create a new MX record, make sure to have a trailing dot at the end of your domain name:

Add SPF records to make sure others cant spoof emails by pretending to send them from your domain.

Make sure to have "-all" in your SPF record, and point it to your droplet's IP.

The record's format would be "v=spf1 ip4:IP_ADDRESS -all"

There will be one more record to add after you have finished installing iRedMail - DKIM key.

Step 3 - iRedMail Installation

Make sure to set the hostname of your domain name, if you haven't done this during droplet creation:

wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.8.6.tar.bz2
tar jxvf iRedMail-0.8.6.tar.bz2 && cd iRedMail-0.8.6
hostname cloudmail.tk
bash iRedMail.sh

You are greeted with a Graphical User Interface Installer by iRedMail:

If you have several droplets, you can even use GlusterFS for distributed, replicated e-mail storage, providing further redundancy:

For backend, we chose MySQL. You can also use OpenLDAP and PostgreSQL:

Since we have registered a domain in Step 2, we will place it here:

From package selection, you can omit phpMyAdmin and Fail2Ban.

When asked whether you would like to use firewall rules provided with iRedMail, select 'No'.

Firewall rules should be custom made for each server, and adopting a DROP ruleset from iRedMail's package is not recommended.

We would also not recommend using Fail2Ban from their package, as it banned our own IP when we refreshed a page.

Reboot your droplet after completion.

All of the installation notes and logs can be found in iRedMail.tips file ( /root/iRedMail-0.8.6/iRedMail.tips ).

Here you will have information on passwords, SSL certificate locations, and DKIM records.

Add the DKIM record to DigitalOcean's DNS control panel for your domain:

Step 4 - Add SSL Certificate

Although this step is optional if you just want to use self-generated certificate, we would still recommend getting a trusted SSL certificate.

By default, iRedMail will create a self-signed certificate and store it in /etc/ssl/certs/iRedMail_CA.pem and /etc/ssl/private/iRedMail.key

We can get a free SSL certificate from InstantSSL

You would need to create a CSR and private KEY first:

cd /etc/ssl
openssl req -out cloudmail.tk.csr -new -newkey rsa:2048 -nodes -keyout cloudmail.tk.key

This will generate 2 files: cloudmail.tk.csr (your Certificate Signing Request file), and cloudmail.tl.key (your private SSL key which should not be shared with anyone).

You would provide the CSR file (cloudmail.tk.csr) to InstantSSL during SSL request.

After they have validated your request, you will receive the certificate file (in zip format) that contains two files:

cloudmail_tk.ca-bundle (your SSL certificate bundle)

cloudmail_tk.crt (your SSL certificate)

Place both files to /etc/ssl and modify /etc/apache2/sites-available/default-ssl

SSLCertificateFile /etc/ssl/cloudmail.tk.crt
SSLCertificateKeyFile /etc/ssl/cloudmail.tk.key
SSLCACertificateFile /etc/ssl/cloudmail.tk.ca-bundle.crt

Restart Apache

service apache2 restart

Now you should have SSL enabled, and you can proceed to logging in to iRedAdmin (https://cloudmail.tk/iredadmin/ ) with username postmaster@cloudmail.tk and password you provided during installation in Step 3.

From iRedAdmin, you can add new users, new admins, and new domains into your system:

Once you have created an e-mail account, you can access it at https://cloudmail.tk/mail/

And you are all done!

By Bulat Khamitov

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors
Default avatar
Bulat Khamitov


Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

DigitalOcean Employee
DigitalOcean Employee badge
April 7, 2013

If you would like to receive mail on subdomain, simply point root (@) MX record to subdomain, and create A type record for the subdomain’s IP address:

@ IN MX mail.domain.com mail IN A

Every thing went well until I got to the DKIM part as in my iRedMail.tips I have nothing below that to add to the txt record. it just like this :

DNS record for DKIM support:

Amavisd-new: * Configuration files:

port 25 is blocked so you can’t send emails, only receive.

Thank you so much.

This comment has been deleted

    this is is still pretty accurate. but the enw version of the installer walks yout through it pretty well.

    make sure you start on a fresh droplet other wise might have issues.

    Mail-in-a-Box is a free alternative & frankly they’re quite good & even can run on 512MB Droplet.

    Hello everyone,

    recently our org required to have internal email system. i recommended some other like domino server and more but i found Ired mail. can i use it internally in my LAN without domain. because i install on ubuntu when it done the last URL for admin and mail was not accessible can anyone help me

    Thanks for your post, but when i try to install the new version of iRedMail, this appears

    [ INFO ] Checking new version of iRedMail …

    << ERROR >> Your iRedMail version (0.9.5) is out of date, please << ERROR >> download the latest version and try again: << ERROR >> http://www.iredmail.org/download.html

    hello, everything ok until the step when i have to write the virtual domain name, it stays in the same window?

    Try DigitalOcean for free

    Click below to sign up and get $200 of credit to try our products over 60 days!

    Sign up

    Join the Tech Talk
    Success! Thank you! Please check your email for further details.

    Please complete your information!

    Featured on Community

    Get our biweekly newsletter

    Sign up for Infrastructure as a Newsletter.

    Hollie's Hub for Good

    Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

    Become a contributor

    Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

    Welcome to the developer cloud

    DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

    Learn more
    DigitalOcean Cloud Control Panel