Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

share|improve this question
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. – Marcin Kaminski Dec 18 '12 at 3:19
@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 '12 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. – Marcin Kaminski Dec 18 '12 at 4:03
@MartinOrda, thanks for your wise advice. – oli Dec 18 '12 at 4:37
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 '12 at 0:59
up vote 8 down vote accepted

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.

share|improve this answer
Indeed, it seems like the easiest solution, with a lot of built-in security. Thanks :) – oli Dec 21 '12 at 6:17
No problem! Good buck in getting it up! – Neojames Dec 21 '12 at 9:38, seems easier to me – user457015 Sep 8 '13 at 16:01
-1 limited support for new ubuntu release. – GusDeCooL Dec 12 '13 at 6:29

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.

share|improve this answer
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 '12 at 1:12
-1 What a pompous answer. – Tom Dworzanski Jun 22 '15 at 12:27

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

share|improve this answer


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

share|improve this answer
This was the best solution for me. Very easy to set up. – Chris Bornhoft Jun 30 '15 at 18:13

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

share|improve this answer
It looks very interesting, I will look at it. – oli Dec 16 '12 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 '12 at 0:34
Ringtail :) you a star. I would say the best solution – Gadgetroid Oct 10 '14 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.

share|improve this answer
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. – Kevin Bowen Jun 16 '15 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.

share|improve this answer

Ubuntu help / MailServer

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

share|improve this answer
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 '13 at 16:27
Not only it theoretically answer the question. It is answering the question. – user457015 Sep 8 '13 at 23:12
Did you read the link that is included in the comment? – Braiam Sep 8 '13 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 '13 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 '13 at 2:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.