Setup on Ubuntu Server machine
DNS setup:
- Do not use any proxy! In services like Cloudflare use DNS only.
- Setup reverse DNS. Make sure your PTR and A records match.
- It is highly recommended to create a DKIM TXT record in your mailcow UI and set the corresponding TXT record in your DNS records.
TYPE |
NAME |
CONTENT |
A |
mail |
1.2.3.4 |
CNAME |
autoconfig |
mail. |
CNAME |
autodiscover |
mail. |
TXT |
dkim._domainkey |
“v=DKIM1; k=rsa; t=s; s=email; p=…” |
TXT |
_dmarc |
“v=DMARC1; p=reject; rua=mailto:[email protected]” |
TXT |
@ |
“v=spf1 mx -all” |
Docker and Docker-compose installation
# Update system
sudo apt update -y && sudo apt upgrade -y
# Remove anything regarding docker if installed
sudo apt-get remove docker docker-engine docker.io containerd runc
# Install packages
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
# Add docker to package manager
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# Update system after changes in package manager
sudo apt-get update
# Install Docker
sudo apt-get install docker-ce docker-ce-cli containerd.io
# Add user to docker group and logout to apply changes
sudo usermod -aG docker <yourusername>
logout
# Docker-compose installation(check docker-compose page for current version)
sudo curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Hostname setup
export USE_HOSTNAME=mail.<yourdomain.com>
sudo echo $USE_HOSTNAME > /etc/hostname
Mailcow setup
cd /opt
sudo git clone https://github.com/mailcow/mailcow-dockerized
cd mailcow-dockerized
sudo ./generate_config.sh
sudo docker-compose pull
sudo docker-compose up -d
Mailcow update (do at least once a month)
cd /opt/mailcow-dockerized/
sudo ./update.sh
docker system prune