What this tutorial is *NOT* about
If you just need a no-cost mail server quickly and don't care about the technical mumbo-jumbo then this is the wrong place for you. There are ready solutions like iRedMail
if you are in a hurry. Don't expect to learn much though if you chose the dark side. I personally recommend you understand what you are doing - that's what the ISPmail tutorials are for. Experience from giving support in the #postfix channel on IRC shows that most hobby sysadmins fail because some detail in a complex setup goes wrong and they have no idea how to track it down. Actually I have a feeling that other projects use the ISPmail tutorials to get started, too. :)
What this tutorial is about
You are interested in learning all the basics about running your own mail server using Debian Squeeze? Be my guest. All you need is a computer running Debian (Squeeze) and an internet connection. This tutorial explains step-by-step how to set up such a server and give you lots of background information in the process. Depending on the internet connection and server hardware you will be able to run a reliable mail service for thousands of domains and users.
Soon you will be proud operator of a mail server that can:
- receive and store email for your users from other mail servers on the internet
- let your users retrieve the email through IMAP and POP3 - even using SSL-encrypted connections
- receive and forward ("relay") email for your users using SMTP authentication
- offer a webmail interface to read emails in a web browser
- detect most spam emails and filter them out or tag them
This tutorial is copyrighted 2011 Christoph Haas (firstname.lastname@example.org). It can be used freely under the terms of the GNU General Public License
. Don't forget to refer to this URL when using it. Thank you.
Things you will need
The server setup described here is totally standard work for a professional system administrator. Depending on your level of knowledge and experience you may walk through this document easily or curse the author and fail miserably. You will need to know or learn about different topics regarding basic system administration tasks, DNS, SMTP, MySQL and POP3/IMAP. What you will need:
- A computer to run Debian on (e.g. a dedicated server)
- A Debian installation medium (I prefer a Debian netinstall CD)
- An internet connection
- If your internet connection has a dynamic IP address then you will need an SMTP relay (most decent ISPs offer that) because you usually can't send out emails directly to other mail servers.
- An internet domain and control over its MX record
- Control over your firewall (if you have one) to open the needed ports for SMTP, IMAP and POP3.
- 1-8 hours of time depending on your knowledge.
About this tutorial
Many years ago I wanted to turn my Debian server into a mail server with virus scanning, spam detection, email forwarding, POP3 and IMAP access and a webmail service. All the components were available but it took a while until they worked properly together. So I summed up my desk full of scrawly notes into a tutorial that has become pretty famous. According to my web server statistics it's still the most frequently read article at workaround.org.
This document is not a simple copy-and-paste tutorial where you just copy the commands from the web site and run it on your server. Instead it will make you understand the different components that you are setting up. In the end you will be skilled enough to debug problems yourself. If you feel you need help with your setup then try the hints in the Troubleshooting section or ask on the mailing list
. Unlike many other Postfix tutorials on the internet this is already the sixth edition. Writing this tutorial took a lot of work so these are not just quick draft notes thrown together but a consistent document guiding you.
The whole tutorial is split into several chapters. Please use the links on the right side or below to navigate through the tutorial. If you prefer all content on a single page (e.g. for printing the tutorial) then use the "printer-friendly
" link below. You are also invited to comment on the pages - just click on the "Add new comment
" link at the bottom.
If you like the tutorial then a tiny donation
is appreciated to run the servers and pay for the internet connection.