Setting Up iRedMail with Digital Ocean

Posted March 25, 2016 17.5k views

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 “

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

After performing those things and running “bash” 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.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
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 “”).

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 localhost localhost.localdomain

This would make your FQDN for the host to be '’

If you were planning on using your own domain you could change to whatever you domain is, for example (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 '’ (or similar) and not just 'iredmail’.

After this you should be able to run

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 “” to be considered an FQDN?

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

      • /etc/hostname contains:

        /etc/hosts contains: iredmail-testEmailServer iredmail localhost 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:

 iredmail localhost

          then either restart your droplet or run this command:

          hostname -b -F /etc/hostname

          After which hostname -f should return ‘’ 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

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

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

          man hostname

          Hope this helps!