Internal Preparation
Update Firewall
Check if any needed port is currently in use:
ss -tlpn | grep -E -w '25|80|110|143|443|465|587|993|995|4190'
If all of them are free, then you could consider adding some firewall rules allowing incoming traffic to these ports:
Attention: the dockerised version of mailcow may have problems with UFW rules, Please double check your mailserver with https://mxtoolbox.com/diagnostic.aspx
sudo ufw allow proto tcp from any to any port 25 comment 'SMTP Port'
sudo ufw allow proto tcp from any to any port 80 comment 'HTTP Port'
sudo ufw allow proto tcp from any to any port 110 comment 'POP Port'
sudo ufw allow proto tcp from any to any port 143 comment 'IMAP Port'
sudo ufw allow proto tcp from any to any port 443 comment 'HTTPS Port'
sudo ufw allow proto tcp from any to any port 465 comment 'SMTPS Port'
sudo ufw allow proto tcp from any to any port 587 comment 'Submission Port'
sudo ufw allow proto tcp from any to any port 993 comment 'IMAPS Port'
sudo ufw allow proto tcp from any to any port 995 comment 'POPS Port'
sudo ufw allow proto tcp from any to any port 4190 comment 'Sieve Port'
Feel free to check that the new rules are active with:
sudo ufw status verbose
Enable NTP
It is of critical importance that the mail server have the correct time all the time, this can be ensured via NTP and you can check its status with:
timedatectl status
In case you do not have the appropriate service installed, follow these instructions
sudo timedatectl set-ntp true
sudo nano /etc/systemd/timesyncd.conf
And check that the line is populated:
[Time]
NTP=0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org
Create Swap file
The mailserver will require a minimum of 1Gb of Swap memory and if you can dedicate a Swap of half the size of the server's RAM, better. Check how much Swap you have with:
free
total used free shared buff/cache available
Mem: 8140276 114048 7943984 8808 82244 7844436
Swap: 1048576 0 1048576
If you need to add a Swap file, please refer to this manual here
Install Docker
sudo apt remove docker docker-engine docker.io containerd runc
sudo apt update
sudo apt install ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo docker run hello-world