Skip to content

Commit cbf2b45

Browse files
authored
Merge pull request #2472 from rsyracuse/mail-in-a-box-update
[Update] How to Create an Email Server with Mail-in-a-Box
2 parents 75f28be + 41697ca commit cbf2b45

File tree

5 files changed

+29
-26
lines changed

5 files changed

+29
-26
lines changed

docs/email/how-to-create-an-email-server-with-mail-in-a-box/index.md

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,34 @@ description: 'This guide shows how to install and run Mail-in-a-Box, a simple, c
66
keywords: ["install mail-in-a-box", "webmail control panel", "caldav", "cardav", " TLS certificate"]
77
license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)'
88
published: 2017-08-29
9-
modified: 2017-08-30
9+
modified: 2019-03-19
1010
modified_by:
11-
name: Alexandru Andrei
11+
name: Faisal Misle
1212
title: How to Create an Email Server with Mail-in-a-Box
1313
contributor:
1414
name: Alexandru Andrei
1515
external_resources:
1616
- '[Mail-in-a-Box Official Website](https://mailinabox.email/)'
17+
- '[Mail-in-a-Box Forums](https://discourse.mailinabox.email/)'
1718
---
1819

1920

2021
![How to Create an Email Server with Mail-in-a-Box](Mail_in_a_box.jpg "How to Create an Email Server with Mail-in-a-Box")
2122

2223
If you chose to host your own email server, but after reading through [Running a Mail Server](/docs/email/running-a-mail-server/) you got discouraged by the complexity of this process, then there's another solution: Mail-in-a-Box. The name is fitting since the software manages to pack everything you need from a mail server, in one single allegorical box. It includes:
2324

24-
* Postfix, as the Simple Mail Transfer Protocol (SMTP) server.
25-
* Dovecot, as the Internet Message Access Protocol (IMAP) server; it's what allows you to sync mail with your phone, read/send messages, delete them, etc.
25+
* Postfix, as the *Simple Mail Transfer Protocol* (SMTP) server.
26+
* Dovecot, as the *Internet Message Access Protocol* (IMAP) server; it's what allows you to sync mail with your phone, read/send messages, delete them, etc.
2627
* CardDAV/CalDAV implemented through Nextcloud (a fork of OwnCloud that includes more features); this enables you to sync your address book and calendar events.
2728
* Z-push to implement the Exchange ActiveSync protocol so that mail can be "pushed" to your phone as soon as it arrives on the server.
2829
* Roundcube webmail, which helps you manage your email by using a web browser.
29-
* Nsd4 Domain Name System (DNS) server; this saves you the hassle of manually adding DNS entries to configure *Sender Policy Framework* (*SPF*), *DomainKeys Identified Mail* (*DKIM*) and *Domain-based Message Authentication, Reporting and Conformance* (*DMARC*), features used to battle spam on the Internet; properly configured, these increase the likelihood that your server will be seen as "legit" by other servers
30+
* Nsd4 *Domain Name System* (DNS) server; this saves you the hassle of manually adding DNS entries to configure *Sender Policy Framework* (SPF), *DomainKeys Identified Mail* (DKIM) and *Domain-based Message Authentication, Reporting and Conformance* (DMARC), features used to battle spam on the Internet; properly configured, these increase the likelihood that your server will be seen as "legit" by other servers
3031
* A backup service
3132
* A control panel, also accessible through the web browser, that:
3233
* Greets you with a comprehensive system status check that makes you aware of any possible problems with your server and offers advice on how to fix them;
3334
* Lets you add or remove mailboxes, change passwords, backup data, change DNS settings;
3435
* Does a great job at explaining what each setting does and how it should be used. It also includes examples on how to interact with its *Application Programming Interface* (API) so that you can automate tasks, such as creating a mailbox through your own application/website (e.g., user registers on your website to get an email account)
35-
* And more: if you're interested in the details, you can read about the components here: [Mail-in-a-Box Components](https://github.com/mail-in-a-box/mailinabox#the-box)
36+
* If you're interested in the details, you can read about the components here: [Mail-in-a-Box Components](https://github.com/mail-in-a-box/mailinabox#the-box)
3637

3738
The preconfigured box of software is also fairly security-conscious and you can read more about it here: [Security features enabled in Mail-in-a-Box](https://github.com/mail-in-a-box/mailinabox/blob/master/security.md)
3839

@@ -44,23 +45,25 @@ The preconfigured box of software is also fairly security-conscious and you can
4445

4546
3. It's highly recommended that you follow the instructions on [Hardening SSH access](/docs/security/securing-your-server/#harden-ssh-access) but **only** the steps regarding SSH; other steps might clash with what Mail-in-a-Box will set up (e.g., it implements its own `fail2ban` rules).
4647

47-
If you insist on using a password for root instead of a private key, at least use a **very good password**. Bots constantly scan the Internet for SSH servers and try random passwords. Some are more aggressive than others, and while `fail2ban` helps block IPs, there's always the next bot (with a different IP) that will visit and have another try. Keep in mind that strings such as "h4x0r123," while they may look strong because they mix letters and numbers, are actually very weak.
48+
If you insist on using a password for root instead of a private key, at least use a **very good password**. Bots constantly scan the Internet for SSH servers and try random passwords. Some are more aggressive than others, and while `fail2ban` helps block IPs, there's always the next bot (with a different IP) that will visit and have another try. Keep in mind that strings such as *h4x0r123*, while they may look strong because they mix letters and numbers, are actually very weak.
4849

49-
4. Wherever you see `example.com` in this tutorial, replace it with your domain name, and leave the prefix as it is. That is, don't change `box` to something else.
50+
{{< note >}}
51+
Wherever you see `example.com` in this tutorial, replace it with your domain name, and leave the prefix as it is. That is, don't change `box` to something else. Also, `203.0.113.1` is used as an example IP; your outputs should reflect your server IP instead.
52+
{{< /note >}}
5053

51-
## Launch Ubuntu 14.04 Server
54+
## Launch Ubuntu 18.04 Server
5255

5356
{{< caution >}}
5457
Use this server exclusively for Mail-in-a-Box. Installing extra software might cause unexpected behavior.
5558
{{< /caution >}}
5659

57-
Although Ubuntu 16.04 is available, Mail-in-a-Box has not been prepared or tested in that environment so you'll need to use the 14.04 release which still receives security fixes until April 2019.
58-
5960
Choose a server with at least 1GB of RAM. If you plan to host many users (mailboxes) and/or expect a high volume of email traffic, you can start out with 2GB or more. Don't forget to boot the server.
6061

62+
Make sure you select Ubuntu 18.04 as the *Operating System* (OS), as starting with version 0.40 only Ubuntu 18.04 is supported.
63+
6164
## Configure Your Domain Name
6265

63-
You'll have to check with the company where you've registered your domain name to see how you can change your nameservers and add glue records. Either search for this information on Google, the site's knowledge base, or ask their support to help you.
66+
You'll have to check with your registrar, the company where you've registered your domain name with, to see how you can change your nameservers and add glue records. Either search for this information on Google, the site's knowledge base, or ask their support to help you.
6467

6568
Here's what you'll need to do:
6669

@@ -74,7 +77,7 @@ Here's what you'll need to do:
7477
ns1.box.example.com 203.0.113.1
7578
ns2.box.example.com 203.0.113.1
7679

77-
You might have noticed you're using the same IP in both entries. There are a few registrars that have a problem with this, so in case you're unlucky, you won't be able to save these settings and will have to contact their support team.
80+
You might have noticed you're using the same IP in both entries. There are a few registrars that have a problem with this, so you may not be able to save these settings and will have to contact their support team. Alternatively, you can skip using your box as a DNS host, and keep your registrar's DNS host. You will find all the needed records in the **System -> External DNS** tab of the administration console, once you've completed installation.
7881

7982
Also note that some registrars may only require you to enter `ns1.box` as they autocomplete the rest of your hostname, `.example.com`. Carefully examine the page to see which variant you should use.
8083

@@ -90,7 +93,7 @@ You should see your nameservers at the end of the output:
9093
example.com. 300 IN NS ns2.box.example.com.
9194
dig: couldn't get address for 'ns1.box.example.com': no more
9295

93-
At this point you can continue. If you don't see the required data, then come back later and check - again. If after one hour it's still missing, then contact your registrar's support team.
96+
At this point you can continue. If you don't see the required data, then come back later and check again. If after one hour it's still missing, then contact your registrar's support team.
9497

9598
## Install Mail-in-a-Box
9699

@@ -110,31 +113,31 @@ If you notice a reboot is needed (usually when the Linux kernel is upgraded), ty
110113

111114
curl -s https://mailinabox.email/setup.sh | sudo bash
112115

113-
It will start to download software and after a while greet you with a *Text User Interface* (*TUI*), which is a way to present a more user-friendly install wizard under the limitations of a terminal. You can navigate the menus with the arrow keys and simply press `ENTER` to make the desired selections.
116+
It will start to download software and after a while greet you with a *Text User Interface* (TUI), which is a way to present a more user-friendly install wizard under the limitations of a terminal. You can navigate the menus with the arrow keys and simply press `ENTER` to make the desired selections.
114117

115-
Every step is thoroughly explained in the terminal output. The first steps are easy to follow. But here are the more interesting ones:
118+
Every step is thoroughly explained in the terminal output.
116119

117120
### Install Wizard Steps
118121

119122
1. When you're prompted to choose an email address, delete the pre-filled value and replace it with `your_name`@example.com. You can replace `your_name` with whatever you desire, as long as it's a valid username.
120123

121-
![Choose Main Email Address and Domain](mail-in-a-box-choose-email-and-domain-ubuntu1404.png)
124+
![Choose Main Email Address and Domain](mail-in-a-box-choose-email-and-domain-ubuntu1804.png)
122125

123126
2. In the next step, the hostname should look like this:
124127

125-
![Choose Hostname](mail-in-a-box-choose-hostname-ubuntu1404.png)
128+
![Choose Hostname](mail-in-a-box-choose-hostname-ubuntu1804.png)
126129

127130
Now, the install wizard should continue to download and configure software packages. Just wait for it to do its magic.
128131

129132
3. At the next step, you'll be prompted to choose your timezone. Use the arrow keys to make the desired selection and press `ENTER`.
130133

131-
![Choose Timezone](mail-in-a-box-choosing-timezone-ubuntu1404.png)
134+
![Choose Timezone](mail-in-a-box-choose-timezone-ubuntu1804.png)
132135

133136
Once again, Mail-in-a-Box will continue to pull in required packages and auto-configure them. Wait for it to finish, it will take longer this time.
134137

135-
4. When package auto-configuration is complete, you'll be prompted to install a *Transport Layer Security* (*TLS*) certificate. If Let's Encrypt cannot verify that you own your domain (i.e., DNS changes haven't yet propagated to its servers), then this step will be automatically skipped, but you can still request your certificate later from the control panel of Mail-in-a-Box.
138+
4. When it finishes installing the packages, the script will prompt you to choose a password for the administrative account. Choose a good password since this is the most powerful account that can make any change in the control panel. This will also be the password to the email account you set up in Step 1.
136139

137-
5. At the next step, you'll choose a password for the administrative account. Choose a good password since this is the most powerful account that can make any change in the control panel.
140+
5. When package auto-configuration is complete, you'll be prompted to install a *Transport Layer Security* (TLS) certificate. If Let's Encrypt cannot verify that you own your domain (i.e., DNS changes haven't yet propagated to its servers), then this step will be automatically skipped, but you can still request your certificate later from the control panel of Mail-in-a-Box.
138141

139142
6. At this point the script has finished its job and you'll be prompted with this message in the terminal output:
140143

@@ -173,19 +176,19 @@ Since it's very likely that a Let's Encrypt TLS certificate hasn't been installe
173176

174177
dig example.com
175178

176-
When you see this in the output, `203.0.113.1` (the IP address of your server), you can continue; otherwise try again later:
179+
When you see your server IP in the A record, you can continue; otherwise try again later.
177180

178181
;; ANSWER SECTION:
179182
example.com. 1724 IN A 203.0.113.1
180183

181-
2. In the top-left menu you'll notice an element called **System**. Click on it and then select **TLS (SSL) Certificates**. Now click on the blue button that says **Provision** and follow the instructions.
184+
2. In the top-left menu you'll notice an element called **System**. Click on it and then select **TLS (SSL) Certificates**. Now click on the blue button that says **Provision** and within a few minutes the certificate status should change to **Signed & valid**.
182185

183186
![Control Panel - TLS Certificates Page](mail-in-a-box-control-panel-tls-certificates-ubuntu1404.png)
184187

185-
3. Follow this guide, [How to Configure Reverse DNS on a Linode Server](/docs/networking/dns/configure-your-linode-for-reverse-dns/), to set up a pointer record (PTR). This step is important to execute and pass some antispam checks. Without it, some of the other mail servers will flag your outbound email as spam or will consider it suspicious that your IP doesn't point to your domain name.
188+
3. Follow this guide, [How to Configure Reverse DNS on a Linode Server](/docs/networking/dns/configure-your-linode-for-reverse-dns/), to set up a *pointer record* (PTR). Make sure you set it to `box.example.com`. This step is very important to execute and pass some antispam checks. Without it, a lot of mail servers will flag your outbound email as spam and will consider it suspicious that your IP doesn't point to your domain name, and sometimes even reject it.
186189

187190
## Conclusion
188191

189-
As you can see, it's very convenient when everything for an email server is packaged in one place and automagically configured. But convenience often has a price. Mail-in-a-box's centralization - that makes it easy to manage everything - also creates a single point of failure. There is a safety net though: email servers are intelligent enough to retry sending you their data for a few days, in case your server is unavailable.
192+
As you can see, it's very convenient when everything for an email server is packaged in one place and automatically configured. But convenience often has a price. Mail-in-a-box's centralization - that makes it easy to manage everything - also creates a single point of failure. There is a safety net though: email servers are intelligent enough to retry sending you their data for a few days, in case your server is unavailable.
190193

191-
But if you can't afford the delay, you should look at ways to make your setup more reliable. A beginner friendly approach is to set up a monitoring system that will notify you quickly in case of problems. Later on, you can look into secondary (slave) nameservers, secondary MX entries, cloning and syncing Mail-in-a-Box machines, so they can take over in case of failure and floating IPs.
194+
If you can't afford the delay, you should look at ways to make your setup more reliable. A beginner friendly approach is to set up a monitoring system that will notify you quickly in case of problems. Later on, you can look into secondary (slave) nameservers, secondary MX entries, cloning and syncing Mail-in-a-Box machines, and floating IPs.
91 KB
Loading
83 KB
Loading
104 KB
Loading
24.5 KB
Loading

0 commit comments

Comments
 (0)