How to raise the mailcow mail server

Greetings, dear reader. Today we will talk about setting up a personal Mailcow mail server.

I’ll make a reservation right away – I’m not a guru in this area, but there is quite a bit of information on the Internet about raising Mailcow, which is why this article was published.

We will need:
VPS(Virtual Private Server)
Domain
CloudFlare
A little time

Let's get started!


VPS:

Let's start with VPS.
Personally, I use the services Tietokettu

The servers are located in Finland, gigabit channel and good prices, high uptime and quite a lot of traffic. Don’t think that I’m advertising – no one pays me for this, I just liked this service

I will show by example aeza.net
Register on the site and log in.
Click on the big inscription aeza.
Select Virtual server and click Order.

At the time of writing this article there was such a promotion in Stockholm.

Name enter whatever you want, for example mailcow-server
Now you need to select OS. I prefer Debian 12
Also, if not needed, uncheck Enable backups.
We pay and wait for creation.
The server will be available here.

Updating VPS and installing Docker:

Now let's update and install the necessary programs.
We connect via ssh.
Open PowerShell and write (replace ip with yours. It is in the user panel):
ssh root@ip

Let's update the system:
apt update && apt upgrade

Now we will install Docker (on debian):
Installation commands:

  • apt install apt-transport-https ca-certificates curl software-properties-common

  • curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -

  • add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

  • apt update

  • apt install docker-ce

Just in case, let's turn on autorun if it doesn't turn on by itself.

You can check the status with the command

There should be a similar conclusion.

● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2024-03-29 04:38:52 EDT; 6min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 135217 (dockerd)
      Tasks: 27
     Memory: 46.3M
        CPU: 396ms
     CGroup: /system.slice/docker.service
             ├─135217 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
             ├─135353 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 1688 -container-ip 172.17.0.2 -container-port 1688
             └─135359 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 1688 -container-ip 172.17.0.2 -container-port 1688

The main thing is Active: active (running)

If everything is ok, we move on.


Buying a domain

This is what the domain looks like

I use GoDaddy.I really like the service, the prices are reasonable and the personal account is convenient. However, a foreign bank card is required for payment.

You can also use the services of any other registrar. For example, reg.ru.

I'll show you with an example GoDaddysince the registration process is approximately the same everywhere. Here registration page.

After registration we go here
Here we enter the name of interest.

Let's say this domain is mytopdomain.worldthen the domain will look like this.

The indicated price is €1.84 excluding VAT instead of €46.17. It also says for first year, which means that for the first year of use the price will be €1.84, and then €46.17 per year.

Next, click Make It Yours and go to the cart. There in the section Protect your domain choose No Domain Protection.

We also remove the check mark from Start your website for FREE.

We do not change the item Build credibility with a custom email address and leave No Professional Email.

We pay….

And… Congratulations! You have your own domain!


Mailcow installation

Mailcow

We connect via ssh and write:

You need to be careful here⚠️
Step 1 asks you to select hostname
He should be like mail.example.com
For example:

You will be asked to select a time zone.
Press Enter to leave the proposed one, do not change it.
An excellent time zone from a vps location can affect spam filters of other mail services.
Next, enter 1 to select a stable branch and wait for installation.

Once the installation is complete, go to the browser and enter the IP address of your server.

We go into the panel in pairs:
Login admin
Password moohoo

We immediately go to System => Configuration and change the login and password there to enter the panel.

Now go to E-mail and click on the green button Add domain

In field Domain enter mytopdomain.world (replace with yours)
Everything else can be left as default.
Click Add domain and restart SOGo


Setting up CloudFlare

Now we need CloudFlare. Let's go here and register.
After registration, log in and click Add site. There you will need to enter your domain and click Continue. Choose Free plan and click Continue.

CloudFlare will scan the DNS and show all the DNS records it finds. You can delete them all. Click Continue and click Confirm in the window that appears.

Important⚠️

We are looking for an item 3 With name Update your nameservers.
We go to the panel to our registrar and look for DNS records there.
We change the standard NS(Nameserver) to those issued by CloudFlare.
Do not close the CloudFlare tab. After changing the DNS we wait ~15 minutesand then go back to the tab with CloudFlare and click Check nameservers now.
Next is the Quick Start Guide. IN Improve security turn on Always Use HTTPS. The rest is default.

Now we will wait for such an inscription.

Once it appears, you can start setting it up.
It usually takes me about 30 minutes.

Now you can go to the DNS/Records tab.

This is the longest part. Checking with DNS Records from the mailcow panel.

Via button Add record create records.

  • Type 'A' | Name 'mail' | IPv4 address 'ip адрес вашего VPS' | Proxy status 'DNS only' | TTL 'Auto'

  • Type 'AAAA' | Name 'mail' | IPv6 address 'ip6 адрес вашего VPS' | Proxy status 'DNS only' | TTL 'Auto'

  • Type 'CNAME' | Name 'autoconfig' | Target 'mail.example.com' | Proxy status 'DNS only' | TTL 'Auto'

  • Type 'CNAME' | Name 'autodiscover' | Target 'mail.example.com' | Proxy status 'DNS only' | TTL 'Auto'

  • Type 'MX' | Name '@' | Mail Server 'mail.example.com' | TTL 'Auto' | Priority '1'

  • Type 'SRV' | Name '_autodiscover._tcp' | Priority '0' | Weight '1' | TTL 'Auto' | Port '443' | Target 'mail.example.com'

I have TSLA in DNS Records
3 1 1 11fd336a61b96828825a06e3053ca95c5ad4227489647cf78efaa410f51ec42f
Where
3 => Usage
1 => Selector
1 => Matching type
The long string is Certificate.

To me it would look like
Type 'TSLA' | Name '_25._tcp.mail' | TTL 'Auto' | Usage '3' | Selector '1' | Matching type'1' | Certificate '11fd336a61b96828825a06e3053ca95c5ad4227489647cf78efaa410f51ec42f'

And you indicate yours.

Go ahead.

Type 'TXT' | Name 'dkim._domainkey' | TTL 'Auto' | Content 'указан в DNS Records последней строчкой, длинная строка'

Type 'TXT' | Name '@' | TTL 'Auto' | Content ' "v=spf1 mx -all" '
Exactly in double quotes!

It should look something like this

That's it, we're done here.


Now we are waiting for everything to catch up, but it should work now. It's just that some mail, such as Gmail, will report suspicious traffic if you send an email there.

Now in the mailcow panel go to E-Mail -> Configuration -> Mailboxes and click the green button ** + Add mailbox**. Create a Username. Whichever one you want, for example something like this:

  • info@example.com

  • support@example.com

Generate a password or set your own.

Quarantine notification category put in Junk folder.

You can enable forced TLS.

As a client, you can use the built-in WebMail. From the desktop there is free Mozilla Thunderbird. You can also use the Outlook client.

And that’s it, your personal email client is ready. You can, of course, still carry out additional configuration, but that’s in another article! Thanks for reading! I will be glad to hear your comments in the comments!

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *