Need Assistance?

In only two hours, with an average response time of 15 minutes, our expert will have your problem sorted out.

Server Trouble?

For a single, all-inclusive fee, we guarantee the continuous reliability, safety, and blazing speed of your servers.

How to install Postal on Ubuntu 24

Postal is an open-source mail server designed for sending large volumes of email reliably while providing complete control over your infrastructure and reputation. Here’s the guide to install Postal on Ubuntu 24.04 using Docker, ensuring you have a stable, scalable mail server for your application needs.

Prerequisites

  • Ubuntu 24.04 server with root or sudo access.
  • A domain name pointed to your server.
  • At least 8GB RAM and sufficient CPU for handling mail queues.

Step 1: Install Docker and system utilities.

If Docker is not installed, install it using:

sudo apt update
sudo apt install docker.io docker-compose

You need to install certain system utilities before you can run some Postal commands.

sudo apt install git curl jq

Step 2: Clone Postal from Git

Clone the Postal installation helper repository, which includes essential bootstrapping configurations and other resources to streamline the installation process.

git clone https://github.com/postalserver/install /opt/postal/install
sudo ln -s /opt/postal/install/bin/postal /usr/bin/postal

Step 3:  MariaDB (10.6 or higher)

You can run MariaDB as a container since you have Docker installed.

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

This will run MariaDB on port 3306. Please change the database name and password according to your choice. Be sure to choose a secure password.

Step 4: Initialize Postal

Before starting Postal, some configurations still need to be completed, even though the cloned repository already includes a portion of them. Run the below command and make sure change “postal.mydomain.com” to your desired hostname:

postal bootstrap postal.mydomain.com 

This process will generate three files in /opt/postal/config:

  • postal.yml – The main configuration file for Postal.
  • signing.key – The private key used for signing various components within Postal.
  • Caddyfile – The configuration file for the Caddy web server.

After these files are created, you should open /opt/postal/config/postal.yml and update it with the appropriate values for your setup, such as database credentials and other necessary settings.

After this initialize the database for which run the following commands which will create a schema and your first admin user.

postal initialize
postal make-user

Now you are all set to run Postal.

postal start

By executing the above command, you will start a number of containers and you can check the status by running:

postal status

To manage SSL termination and handle all web traffic, you’ll need to set up a web proxy. Here we use Caddy web server which is a lightweight web server that’s easy to configure and quick to get up and running.

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

Caddy will issue SSL for your domain and you can access the Postal web interface after this using the credentials of the admin user you created.

Step 5: Configure DNS Records

To ensure your mail server functions correctly, you need to configure several DNS records. Your postal.yml file includes a set of suggested DNS records you can add directly, or you can adjust the configuration to match the DNS records and domain names you plan to use. Make sure to add your domain names and IP address correctly while adding the records.

Example of your postal.yml file:

dns:
  # Specify the DNS records that you have configured. Refer to the documentation at
  # https://github.com/atech/postal/wiki/Domains-&-DNS-Configuration for further
  # information about these.
  mx_records:
    - mx.postal.mydomain.com
  spf_include: spf.postal.mydomain.com
  return_path_domain: rp.postal.mydomain.com
  route_domain: routes.postal.mydomain.com
  track_domain: track.postal.mydomain.com

A record

You need an A record for accessing the Postal web interface.

postal.mydomain.com A 78.47.37.198

You can specify a dedicated subdomain for mail delivery instead of using postal.mydomain.com for everything.

mx.postal.mydomain.com	A 78.47.37.198

SPF Record 

If you send emails from multiple domains, managing SPF records for each domain can become tedious. Postal allows you to configure a global SPF record to simplify this:

spf.postal.mydomain.com	TXT	v=spf1 ip4:78.47.37.198 ~all

Return Path

To handle bounces and improve deliverability, configure a dedicated return path domain:

rp.postal.mydomain.com	MX	10  postal.mydomain.com

rp.postal.mydomain.com        TXT	v=spf1 a mx include:spf.postal.mydomain.com ~all

postal._domainkey.rp.postal.mydomain.com	TXT	dkim record value

The dkim record value can be generated by running the below command

postal default-dkim-record

Route Domain

To receive and process incoming emails directly through Postal:

routes.postal.mydomain.com MX 10 postal.mydomain.com
  • Click & Open Tracking

To track email opens and link clicks with Postal:

track.postal.mydomain.com A 78.47.37.198

This ensures tracking URLs to avoid displaying error pages when users click tracked links and enables accurate open and click tracking for your email campaigns, helping you measure engagement effectively.

Conclusion

You now have Postal installed on Ubuntu 24.04 using Docker, providing a powerful, self-hosted email server to manage and deliver your transactional or bulk emails efficiently. Postal gives you the flexibility to manage your IP reputation, tracking, and delivery while retaining control over your infrastructure.

If you encounter any issues while trying to install Postal on Ubuntu 24 or need expert assistance in configuring a secure and optimized mail server, our team is here to help. At Skynats, we specialize in end-to-end server management services, ensuring smooth installation, configuration, and ongoing support for your infrastructure.

Contact us today to get professional support to install Postal on Ubuntu 24 and keep your mail server running efficiently and securely.

Liked!! Share the post.

Get Support right now!

Start server management with our 24x7 monitoring and active support team

Let us know your requirement.

Can't get what you are looking for?

Get Support Right Away!

Thank You

We have received your query and will get back to you soon.