Skip to content

Instantly share code, notes, and snippets.

@opentaq
Last active April 24, 2025 16:48
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

@sametakofficial
Copy link

if you are struggling with slow dashboard and high system resource useage, you need to install docker via the original documantation and then enter docker compose up -d because in latest versions it changed from docker-compose to docker compose. İts adding docker to apt-get packet manager and its make way more easier to update to new versions.
The main problem when ı tried this ı had an error called Solved: APT GPG Error NO_PUBKEY, thats because of /etc/opt/keyrings/docker.gpg file is didnt downloaded or it have wrong key, ı solved it with downloading key manualy with this commands:

sudo apt-get install gnupg
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

after this, you will have latest version of docker with connected apt-get. It will make mailcow system way more faster atleast its been like that

@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?

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