Setting Up iRedMail with Digital Ocean

March 25, 2016 4.3k views
Email DigitalOcean

Hi. It's my first time using digital ocean so forgive me for a noob question.

I'm currently setting up iRedMail with digital ocean. I've followed Step 1 and Step 3 of the instructions in "https://www.digitalocean.com/community/articles/how-to-install-iredmail-on-ubuntu-12-04-x64"

My hostname is "iredmail-testEmailServer" and i put "iredmai" on /etc/hostname. In my /etc/hosts I put "127.0.0.1 iredmail-testEmailServer iredmail localhost locahost.localdomain"

After performing those things and running "bash iRedMail.sh" the following error shows up: "Please configure a fully qualified domain name (fqdn) in /etc/hosts before we go further."

My question is, why does it return the error above even when I've provided my FQDN in /etc/hosts?

Thanks in advance.

1 Answer

Hey kikorugeria,
Your first entry in /etc/hosts doesn't actually include a fully qualified domain name ("iredmail-testEmailServer" is just the short hostname, a FQDN would look like "iredmail-testEmailServer.example.com").

Is "iredmail-testEmailServer" the name of your droplet? If so, it isn't immediately relevant to the configuration inside.

Try this:

Have 'iredmail' in /etc/hostname

This means the short hostname of your droplet is simply 'iredmail'

and in /etc/hosts have

127.0.0.1 iredmail.example.com localhost localhost.localdomain

This would make your FQDN for the host to be 'iredmail.example.com'

If you were planning on using your own domain you could change example.com to whatever you domain is, for example iredmail.kikorugeria.com (this would also require configuring your domain name in digital oceans admin panel)

You can verify that the FQDN is correct by running the following command:

hostname -f

which should display 'iredmail.example.com' (or similar) and not just 'iredmail'.

After this you should be able to run iRedMail.sh

Hope this helps!

  • Hi Jordan! Thanks for a quick reply! I got things confused. I thought the value returned by hostname -f is not an FQDN. It actually is. The problem was the entry in /etc/hosts. I should not have included localhost.localdomain. It works now :D Thank you!

  • Hi again. I though it worked but it still didn't.

    hostname -f returns "iredmail-testEmailServer" which is also the name of my droplet. Does it really require ".something.com" to be considered an FQDN?

    • Can you post the full contents of /etc/hosts and /etc/hostname?

      • /etc/hostname contains:
        iredmail

        /etc/hosts contains:
        127.0.0.1 iredmail-testEmailServer iredmail localhost
        127.0.0.1 localhost

        ::1 ip6-localhost ip6-loopback
        fe00::0 ip6-localnet
        ff00::0 ip6-mcastprefix
        ff02::1 ip6-allnodes
        ff02::2 ip6-allrouters
        ff02::3 ip6-allhosts

        • Hey kikorugeria,

          /etc/hostname is fine

          Change the first line in /etc/hosts to the following:

          127.0.0.1 iredmail.example.com iredmail localhost
          

          then either restart your droplet or run this command:

          hostname -b -F /etc/hostname
          

          After which hostname -f should return 'iredmail.example.com' and you will should be able to launch iredmail successfully.

          For a deeper explanation:

          When the server starts up, there is an init script in /etc/init/hostname.conf that runs the command 'hostname -b -F /etc/hostname'. This sets the hostname of the server to whatever is saved in /etc/hostname, which in your case is iredmail. The hostname in /etc/hostname is meant to only be the short hostname, not the FQDN. In ubuntu to configure the FQDN you set an alias for your hostname (iredmail) to a fully qualified domain name (FQDN=hostname.domain.tld, or in this case iredmail.example.com).

          Adding '127.0.0.1 iredmail.example.com iredmail localhost' to your etc/hosts file tells the servers DNS resolver that localhost and iredmail are aliases for iredmail.example.com which resolves to the loopback address of 127.0.0.1.

          This is also all explained in the manpage for the hostname command by running

          man hostname
          

          Hope this helps!

Have another answer? Share your knowledge.