hostnamectl set-hostname fqdn.domain.tld
curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh
curl -SL https://github.com/docker/compose/releases/download/v2.24.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo apt install git curl jq net-tools mariadb-client -y
git clone https://postalserver.io/start/install /opt/postal/install
sudo ln -s /opt/postal/install/bin/postal /usr/bin/postal
docker run -d \
--name postal-mariadb \
-p 127.0.0.1:3306:3306 \
--restart always \
-e MARIADB_DATABASE=postal \
-e MARIADB_ROOT_PASSWORD=postal \
mariadb
docker run -d \
--name postal-rabbitmq \
-p 127.0.0.1:5672:5672 \
--restart always \
-e RABBITMQ_DEFAULT_USER=postal \
-e RABBITMQ_DEFAULT_PASS=postal \
-e RABBITMQ_DEFAULT_VHOST=postal \
rabbitmq:3.8
postal bootstrap fqdn.domain.tld
sudo nano /opt/postal/config/postal.yml
docker run -d \
--name postal-caddy \
--restart always \
--network host \
-v /opt/postal/config/Caddyfile:/etc/caddy/Caddyfile \
-v /opt/postal/caddy-data:/data \
caddy
postal initialize
postal make-user
postal start
postal default-dkim-record
docker stop $(docker ps -q --filter "name=postal-") && docker rm $(docker ps -aq --filter "name=postal-")
docker system prune -a
rm -rf /opt/postal /usr/bin/postal
cp /opt/postal/caddy-data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/fqdn.domain.tld/fqdn.domain.tld.crt /opt/postal/config/
cp /opt/postal/caddy-data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/fqdn.domain.tld/fqdn.domain.tld.key /opt/postal/config/
sudo chmod 644 /opt/postal/config/fqdn.domain.tld.crt /opt/postal/config/fqdn.domain.tld.key
Ref: https://gist.github.com/amanjuman/14c492b3bbb152426809491e9ca67453