Skip to content

Instantly share code, notes, and snippets.

@opentaq
Last active June 13, 2025 00:05
Show Gist options
  • Save opentaq/2ce85108bee528700477c6db89610968 to your computer and use it in GitHub Desktop.
Save opentaq/2ce85108bee528700477c6db89610968 to your computer and use it in GitHub Desktop.
Mailserver Installation

Fail2Ban

sudo install fail2ban

UFW

sudo install ufw

UFW Settings

sudu ufw default deny incomoing

sudo ufw default allow outgoins

sudo ufw allow 22,25,80,110,143,443,465,587,993,995,4190/tcp

sudo ufw enable

Mailserver

Install curl and git

sudo apt install curl git -y

Install Docker

su

curl -sSL https://get.docker.com/ | CHANNEL=stable sh

systemctl enable --now docker

Install Docker Compose

curl -sSL https://github.com/docker/compose/releases/download/v$(curl -Ls https://www.servercow.de/docker-compose/latest)/docker-compose-$(uname -s)-$(uname -m) > /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose

Install the mail server

su

cd /opt

git clone https://github.com/mailcow/mailcow-dockerized

cd mailcow-dockerized

./generate_config.sh

Start the mail server

docker-compose pull

docker-compose up -d

@abirhossain-git
Copy link

Hi! I am able to receive mails but can't send can anyone help me on that?

@usmanjaved02
Copy link

@abirhossain-git what error you are getting on sending email?

@ukpagrace
Copy link

And also the: ./generate_config.sh

any one always wondering, what changed here it this
Available Branches:

  • master branch (stable updates) | default, recommended [1]
  • nightly branch (unstable updates, testing) | not-production ready [2]
  • legacy branch (supported until February 2026) | deprecated, security updates only [3]
    Choose the Branch with it's number [1/2/3]

Likely to go with number 1

📌 Here’s what each option means(according chatgpt, please correct if wrong):
🥇 [1] master branch

The stable and recommended branch.

Regular, tested updates.

Suitable for production servers.

What you should pick if you just want a working, reliable Mailcow installation.

👉 Choose this one.
🛠️ [2] nightly branch

Bleeding-edge updates.

New features and bug fixes not yet fully tested.

Can break things — for testing only.

Not recommended for live email servers unless you’re actively developing or debugging Mailcow itself.

⚠️ [3] legacy branch

Older version, no new features.

Only gets critical security updates.

Being phased out (supported until Feb 2026).

Only pick this if you have a specific reason (like compatibility with old configs or existing installations).

@ukpagrace
Copy link

I recommend instead using this install script for docker as it makes it far easier to manage the versions, removing, and updating: https://docs.docker.com/engine/install/debian/#install-using-the-repository

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

If you install with apt-get
don't forget it's docker compose not docker-compose

@ukpagrace
Copy link

Hey everyone,
logging in with mail.domain, won't work for admin

from mailcow team
Breaking Changes

Logins for Administrator, Domain Administrator, and Users have been separated:

Administrator Login: /admin
Domain Administrator Login: /domainadmin
Users: /

Direct SOGo login is now disabled. All unauthenticated requests to /SOGo will be redirected to /.
Users must use the mailcow login.
Administrators can define whether a user should be redirected to the mailcow UI or SOGo after login.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment