I am looking for a simple way to install a mail server on my Ubuntu server. I would like to be able to receive and send emails though a webmail (e.g. roundcube).

I have a domain name. The web server already works without any problem.

When I googled "simple method to install mail server on Ubuntu", I arrive on blogs with literally hundreds of steps to install a mail server:

  1. A Mailserver on Ubuntu 12.04: Postfix, Dovecot, MySQL
  2. Creating a Mail Server on Ubuntu
  3. Postfix

But, for sure I will make a mistake, if I follow those tutorials, and it will be very very time consuming. Most of the steps look very easy to automate, though.

I've try several install methods:

sudo apt-get install dovecot-postfix

sudo tasksel install mail-server

But from there, I have no idea how to add email accounts, and test if it actually works.

Do you know if there is an automated way to install a mail server?



A very interesting open source project that turns a ubuntu machine into an email server:


  • 3
    It looks to me that you're trying to run a publicly accessible service which interacts with other servers while not willing to spend time learning about it and even much less to administer it. What will you do when it gets abused? How will you troubleshoot it without knowing rudimentary details about its operation? This is one of those things that should be left to a *nix admin who knows what they're doing. Dec 18, 2012 at 3:19
  • 6
    @MartinOrda, I understand your point. However you could say the same for a web server. It is publicly available and it can be abused. Still, I can do "sudo apt-get install lamp^", find my ip, move my webpage to "/var/www/", and access it from anywhere. Those are three easy steps. Moreover, often, the most secured options are chosen by default. For the mail server, I believe that 90% of the setup steps described in the links I posted would be completely useless to teach me how to secure my mail server. At best, it can discourage noobies. But, it does not help anyone to learn how to secure it.
    – oli
    Dec 18, 2012 at 3:39
  • Sure, of course it applies to other systems that interact with each other. With regards to securing services - to do so, you first need to understand the basics. If you really intend to run such an MTA you should look at the list of available choices, choose one that's packaged (ideally) for your distribution and has the features you want and that you feel you'd be comfortable working with. And then read the friendly manual, documentation, etc. which most likely explains how to test it and verify whether it's appropriately secured. If I had to recommend one to you - I'd say Postfix. Dec 18, 2012 at 4:03
  • Please see my answer, @MartinOrda is correct. Running a mail server incorrectly, can lead to very serious fines, and in some rare cases jail time (though I don't think the jail time part has made it though the courts yet). Running in incorrectly configured web server won't hurt anyone but you.
    – coteyr
    Dec 19, 2012 at 0:59
  • ...(Sorry, pressed enter) Running an incorrectly configured, publicly addressable mail server will get you literally BANNED from ever sending a deliverable email again. This happens all the time. I deal with it all the time. If you don't take your time to learn this piece of software correctly, you will end up in a whole mess of trouble, ranging from not being able to ever email from that domain again, to huge fines from various governments. For this reason, postfix is set to local delivery only. I can not stress enough, that you learn first with email servers on a local lan that...
    – coteyr
    Dec 19, 2012 at 1:04

8 Answers 8


This is the best/simple method.

sudo apt-get install postfix

That's it a mail server is installed.

Now administrating that mail server is a whole different story.

By default postfix will deliver and relay for all local user accounts. That should get you started. If you want something more complex then you REALLY REALLY need to read, study, learn, apprentice, etc. Mail servers are very very complex to setup correctly. Even when setup correctly they take constant supervision and monitoring. If your doing anything more then local delivery then I 100% recommend that you do not setup your own mail server.

Do not forget to setup DNS and SPF records if your going to be sending emails to non-local addresses. This is a bare minimum and will not result in deliverable mail to most ISPs.

Again, I strongly urge you to read, and fully understand what you are doing before you even attempt to run a public mail server. Keep in mind, that (at least in the US) you can be fined per email, for emails sent from your server incorrectly. This is rare but has happened. A more common effect is that you get blacklisted, shunned, and marked as a generally evil person and are banned from ever running an email server again (this happens quite frequently).

If your going to run a public server make sure you speak with your ISP/Hosting first. You will need, at a minimum a static IP and their permission. Most ISPs will block you 100% from every getting back on the internet for running an incorrectly configured mail server for an extended period of time.

I add all these warnings so that you know, local delivery, intranet delivery, your fine. Remote delivery, know what you are doing before you even attempt it. Incorrectly configured mail servers can bring on a whole world of disaster if not handled correctly.

  • You also seem to be looking for a MTA and MUA. These are very separate. There is no "easy" way because there are about 9 bazillion options out there. If you are truly serious about running your own mail server the speak with your ISP's logistics/integration team. They will have some solutions that you will need to implement to get started. IF your hosting at a VPS, then the VPS company will likely have very specific rules, and guidelines.
    – coteyr
    Dec 19, 2012 at 1:12
  • 1
    It's not exactly a pompous answer because if you've ever tried it, it's a nightmare. However, It makes NO sense why it is so difficult. NONE. I should be able to open a port, and be done with it.
    – Jonathan
    Sep 3, 2018 at 0:35

Zimbra is a great and easy to setup mailserver with collaboration, it might be a bit heavy for some people's needs, but the first time I installed it I had it up and running in under 30 min. It even has paid support, if you really need it.

  • Indeed, it seems like the easiest solution, with a lot of built-in security. Thanks :)
    – oli
    Dec 21, 2012 at 6:17
  • No problem! Good buck in getting it up!
    – Neojames
    Dec 21, 2012 at 9:38
  • help.ubuntu.com/community/MailServer, seems easier to me
    – user457015
    Sep 8, 2013 at 16:01
  • -1 limited support for new ubuntu release.
    – GusDeCooL
    Dec 12, 2013 at 6:29


A very interesting open source project that turns a ubuntu machine into an email server:


  • This was the best solution for me. Very easy to set up. Jun 30, 2015 at 18:13

If you are new to email server but still want to set up one. You can check out my blog page Tiny VPS Postfix.

It is a good starting point to learn, and you can expend the configuration for full setup in future.

What it does

  • Send/Receive mail for your domain
  • Forward all incoming email to another email address according to configuration.

What it does not

  • NO local account, all [email protected] are configure for forwarding
  • NO webmail. You will be using third party email service (eg. Yahoo, GMail, etc)

IF this is what you want, THEN I will copy the instruction over here. ELSE I will just leave this answer as is.


I use the all-encompassing WEBMIN. Found here

It has different modules that you can incorporate (or not) into managing your server. These modules ie: Apache, RAID, Sendmail and the like are a plug-in for Webmin and therefore become manageable when installed. Webmin can also manage your current installations and reports.

This simple application is the administrators backbone for setting up VOIP, Mail, DATABASE, cloud, firewall and more.

You can keep it simple or roll with the big boys with this.

Any well played system administrator has used this or something like it. This IS the front-end GUI to A Mailserver on Ubuntu 12.04: Postfix, Dovecot, MySQL etc. enter image description here

  • It looks very interesting, I will look at it.
    – oli
    Dec 16, 2012 at 22:37
  • @oli even if you didn't use the mail module you are still able to admin your server remotely
    – Ringtail
    Dec 17, 2012 at 0:34
  • Ringtail :) you a star. I would say the best solution
    – Gadgetroid
    Oct 10, 2014 at 10:17

You should also consider one of the inspirations for "mailinabox," Drew Crawford's post on how to NSA-proof your email in 2 hours.

  • 1
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Jun 16, 2015 at 15:59

This is not short but you won't find anything short. It is easy to follow and very easy to administer as the users, domains, forward tables will be virtual in MySQL. Mail users doesn't need a system account to login to POP or IMAP. Works with StartTLS or SSL.

It guides you to build the mysql queries and to hook them in postfix to use mysql as virtual backend and to install antivirus, anti-spam filters and webmail (SquirrelMail). There are various versions of the guide for different releases of Ubuntu.



Ubuntu help / MailServer https://help.ubuntu.com/community/MailServer

Ubuntu official documentation is most of the time, easy enough.

  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – Braiam
    Sep 8, 2013 at 16:27
  • Not only it theoretically answer the question. It is answering the question.
    – user457015
    Sep 8, 2013 at 23:12
  • Did you read the link that is included in the comment?
    – Braiam
    Sep 8, 2013 at 23:20
  • I was looking for something simple to install... You have provided a long list of software to install, with so many steps to install each of them... A single mistake in only one step and nothing works.... I wanted something more all-in-one, with an easy configuration.
    – oli
    Sep 9, 2013 at 1:09
  • Most of the step are copy/paste in the terminal. Is it not "easy" because it is not in a GUI ?
    – user457015
    Sep 9, 2013 at 2:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .