Install iRedMail

Install iRedmail: Your Own Private E-mail Server in the Cloud

Digital Ocean’s $5/mo. fast SSD servers make a great choice for hosting your email. For a gmail alternative, try FastMail.

Installing iRedMail

Sign in to your instance using the preceding instructions. Follow the steps below to install and configure iRedMail:

sudo su
cd /root

[info_box]If you are using an Amazon Micro instance, you’ll want to create a swap file. Otherwise, iRedMail spam software will fail and postfix will drop your outgoing messages. With anti-virus, anti-spam and key-signing features, iRedMail requires 1 GB of memory; AWS Micro provides only 640 KB.[/info_box]

While setting up a swap file is easy, there are some small risk of incurring unbounded internetwork bandwidth charges – so be sure to monitor your site and set up billing alarms as described in the optimization section. However, once you set up a swap file, your micro instance should be stable.

dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile

Now, to make the swapfile persistant across reboots, edit the fstab file:

sudo nano /etc/fstab

Add this line:

/swapfile swap swap defaults 0 0

Verify the swap file is active by typing:

free

Web hosting at digital ocean

It should show something like:

Swap: 1048572 0 1048572

Change the hostname to match your domain e.g. mail.yourdomain.com:

nano /etc/hostname

Change your hosts file to include your domain:

nano /etc/hosts

Edit it so your domain appears – both for the root and your mail domain:

127.0.0.1 yourdomain.com mail.yourdomain.com localhost
apt-get update
reboot

Visit the iRedMail downloads page for the latest release for Ubuntu. Make note of the release version for the steps below e.g. 0.8.4. Return to your server:

sudo su
cd /root
wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.8.4.tar.bz2
tar xjf iRedMail-0.8.4.tar.bz2
cd iRedMail-0.8.4
bash iRedMail.sh

You’re going to need to create two strong passwords to complete the iRedMail setup. I recommend you use a password generator and storage application such as AgileBits’ 1Password. 1Password is an indispensable everyday tool for me.

Try 1Password at AgileBits

Related Links
You may also be interested in:

Follow the screenshots below as you continue the installation of iRedMail:


Reboot your server:

reboot

move-config-file

Say Yes to installing the firewall and restarting the firewall:

yes-firewall

Wait for iRedMail to install its anti-virus updates.

In the meantime, you need to update your Amazon Security Groups to allow traffic for HTTPS, POPS and IMAPS. In the AWS EC2 Dashboard, add inbound access for the above groups, as shown below:

security-group

When installation completes, iRedMail will show you the URLs you can use to access your mail server.

installed-urls

However, you need to reboot one more time:

reboot

Also, once installation is complete, move your configuration file to a safe place:

mv /home/ubuntu/iRedMail-0.8.4/config ~/safe_place/config

When you visit your URL, you’ll need to dismiss the SSL warning shown below. You haven’t yet created an SSL certificate so your browser will regularly warn you about whether the site can be trusted. Click Proceed.

ssl-warning

Then, you’ll be greeted with the fun Roundcube Login screen. Login with the username and password given to you when you completed the installation:

roundcube_login

You’ve got mail! Here’s your inbox:

rc-inbox

Note: If you appreciate this site, please check out some of our affiliates:

  • Agile Bits 1Password – no need to remember your passwords ever again, except one
  • Digital Ocean – fast SSD hosting from the second largest hosting company in the world
  • FastMail – a great GMail alternative
  • CodeGuard – backup your website automatically with this great service
  • WPEngine – professional, scalable WordPress hosting

Please feel free to post corrections, questions or comments below. You can also reach me on Twitter @reifman or email me directly. If this tutorial helped you, please share it on Twitter.

Continue to Administrating iRedmail

9 Comments

  1. Thanks a ton for this.

    Just wondering, which security ports must be opened if one plans to use the server ONLY for webmail (e.g., no external imap/pop3 access)? This seems to be the missing link when running on EC2; the security groups, and clearly some have to be open, but is it possible to close off some here to disable client access to imap/pop3 (so it’s a webmail only server that can send and receive mail)?

    Reply

    1. Incoming port 22 (ssh), 25 (so other mail servers can send you messages), 80 (if you want non-SSL access, including automatic redirecting from HTTP to HTTPS), and 443 (HTTPS).

      Reply

  2. Jeff, thanks for a great tutorial! I got iRedmail installed on unbuntu running on a ec2 m3 medium. Can’t get to webmail to configure service. I have a rule to allow traffic on https and pop3s… i tried on both private and public IP with https to no avail. What do you think could have gone wrong? Thanks.

    Reply

    1. Nevermind, got it working. Great tutorial!

      Reply

  3. Hi there – i have tried installing iRedMail using the latest image (0.9.1) and there seems to be a problem with the web server side of things – to is not downloading either apache or nginx – i tried both on an AWS image which i set up exactly as you prescribe. Any idea what the problem might be?

    Reply

  4. How do I setup the DNS if my domain is at godady?

    Reply

  5. if i change my /etc/hostname, It always goes back to ip-xxx-xx-xx-xx.us-west-2.compute.internal Is this normal?

    Reply

  6. Any additional configuration on domain name?

    Reply

  7. When I try to bash iRedMail.sh, I get an error saying : Please configure a fully qualified domain (FQDN) in /etc/hosts . I exactly followed all the steps

    Reply

Leave a reply

Your email address will not be published.