

Install Postal Mail Server on Ubuntu 20.04/18.04
source link: https://computingforgeeks.com/install-and-configure-postal-mail-server-on-ubuntu/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Having a fully featured email solution is a basic requirement of any business, institution or company. Here we will discuss the installation of Postal Mail Server on Ubuntu 20.04/18.04. Postal is a mail delivery platform for both incoming and outgoing emails. It is a complete and fully featured mail server that should satisfy all your websites & web servers email requirements.
The minimum specification for Postal is as follows:
- At least 4GB of RAM
- At least 2 CPU cores
- At least 100GB of disk space
Install Postal Mail Server on Ubuntu 20.04/18.04
The installation of Postal Mail Server on Ubuntu is not as complicated as others say. By sparing some minutes and following below few steps, you should have Postal Mail Server running on Ubuntu 20.04/18.04 server.
Step 1: Update your system
Like all other installation guides available on Computingforgeeks, we start the installation by ensuring our system is updated.
sudo apt update
sudo apt -y upgrade
sudo apt -y install git jq
Step 2: Install Docker & Docker Compose
Run the command below to install Docker
wget -qO- https://get.docker.com/ | sudo bash
To run Docker as a non-privileged user, consider setting up the Docker daemon in rootless mode for your user:
dockerd-rootless-setuptool.sh install
Install Docker Compose:
Step 3: Install MySQL / MariaDB database server
The other requirement of Postal Mail server is a database server.
sudo apt install mariadb-server
Also install libmysqlclient-dev
sudo apt -y install libmysqlclient-dev
After installation of MariaDB/MySQL database server, create a user and database for Seafile.
First login to MySQL shell as root user:
$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 48
Server version: 10.3.11-MariaDB-1:10.3.11+maria~bionic-log mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
We will create a database for each of these server components.
CREATE DATABASE postal CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci;
Create a database user and grant privileges for created databases.
CREATE USER 'postal'@'localhost' IDENTIFIED BY 'StrongPassword';
GRANT ALL ON postal.* TO 'postal'@'localhost';
Postal will handle the creation of databases for your mail servers but you need to give it access to do this. Allow postal
user to manage all databases that are prefixed with postal-
.
GRANT ALL PRIVILEGES ON `postal-%`.* to `postal`@`localhost` IDENTIFIED BY "StrongPassword";
FLUSH PRIVILEGES;
QUIT
Confirm access by Logging into the database as postal
user:
$ mysql -u postal -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 49
Server version: 10.3.11-MariaDB-1:10.3.11+maria~bionic-log mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| postal |
+--------------------+
4 rows in set (0.001 sec)
MariaDB [(none)]> QUIT
Bye
Step 4: Install and Configure RabbitMQ
Postal uses RabbitMQ for queueing. Install RabbitMQ on Ubuntu using the link below:
How to install Latest RabbitMQ Server on Ubuntu
You can skip the section of configuring RabbitMQ Management Dashboard and Set RabbitMQ Cluster. A single node RabbitMQ installation should be enough for small usage.
Postal requires its own RabbitMQ vhost and user to connect with. You can create these using the following commands:
sudo rabbitmqctl add_vhost postal
sudo rabbitmqctl add_user postal StrongPassword
sudo rabbitmqctl set_permissions -p postal postal ".*" ".*" ".*"
Step 5: Install and Configure Postal Mail Server on Ubuntu 20.04/18.04
Cloning the Postal repository
git clone https://postalserver.io/start/install /opt/postal/install
Create a symlink for Postal binary.
sudo ln -s /opt/postal/install/bin/postal /usr/bin/postal
Run the command below and replace postal.yourdomain.com
with the actual hostname you want to access your Postal web interface at
$ sudo postal bootstrap postal.yourdomain.com
Latest version is: 2.0.0
=> Creating /opt/postal/config/postal.yml
=> Creating /opt/postal/config/Caddyfile
=> Creating signing private key
Generating RSA private key, 1024 bit long modulus (2 primes)
.....+++++
.................+++++
e is 65537 (0x010001)
This will generate three files in /opt/postal/config
.
postal.yml
is the main postal configuration filesigning.key
is the private key used to sign various things in PostalCaddyfile
is the configuration for the Caddy webserver
Open Postal configuration file.
sudo vim /opt/postal/config/postal.yml
At the minimum, have the following settings:
web:
# The host that the management interface will be available on
host: postal.example.com
# The protocol that requests to the management interface should happen on
protocol: https
main_db:
# Specify the connection details for your MySQL database
host: localhost
username: postal
password: StrongPassword
database: postal
message_db:
# Specify the connection details for your MySQL server that will be house the
# message databases for mail servers.
host: localhost
username: postal
password: StrongPassword
prefix: postal
rabbitmq:
# Specify the connection details for your RabbitMQ server.
host: 127.0.0.1
username: postal
password: StrongPassword
vhost: /postal
dns:
# Specifies the DNS record 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.example.com
smtp_server_hostname: postal.example.com
spf_include: spf.postal.example.com
return_path: rp.postal.example.com
route_domain: routes.postal.example.com
track_domain: track.postal.example.com
smtp:
# Specify an SMTP server that can be used to send messages from the Postal management
# system to users. You can configure this to use a Postal mail server once the
# your installation has been set up.
host: 127.0.0.1
port: 2525
username: # Complete when Postal is running and you can
password: # generate the credentials within the interface.
from_name: Postal
from_address: [email protected]
Edit the file to fit your Postal settings.
For DNS, you can use DnsMasq if you’re looking for a self-hosted simple DNS solution.
When done Initialize database by adding all the appropriate table:
$ sudo postal initialize
Pulling web ... done
Pulling smtp ... done
Pulling worker ... done
Pulling cron ... done
Pulling requeuer ... done
Creating postal_runner_run ... done
Initializing database
......
Create your initial admin user
$ sudo postal make-user
Creating postal_runner_run ... done
Postal User Creator
Enter the information required to create a new Postal user.
This tool is usually only used to create your initial admin user.
E-Mail Address : [email protected]
First Name : Admin
Last Name : User
Initial Password: : ********
User has been created with e-mail address [email protected]
Starting the application
Run the following command to start the Postal application
$ sudo postal start
Creating postal_worker_1 ... done
Creating postal_cron_1 ... done
Creating postal_smtp_1 ... done
Creating postal_requeuer_1 ... done
Creating postal_web_1 ... done
This will run a number of containers on your machine.
You can look at the status at any time using:
$ sudo postal status
Name Command State Ports
-------------------------------------------------------------------
postal_cron_1 /docker-entrypoint.sh post ... Up
postal_requeuer_1 /docker-entrypoint.sh post ... Up
postal_smtp_1 /docker-entrypoint.sh post ... Up
postal_web_1 /docker-entrypoint.sh post ... Up
postal_worker_1 /docker-entrypoint.sh post ... Up
Step 6: Configuring Caddy Web Server
A web proxy is required all web traffic and SSL termination. There are many options for Proxy – Nginx, Apache, HAProxy, e.t.c. In this guide we’re going to use Caddy.
We can run Caddy web server using Docker:
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
Once this has started, Caddy will issue an SSL certificate for your domain and you’ll be able to immediately access the Postal web interface and login with the user you created in one of the previous steps.
Step 7: Access Postal Admin Web Dashboard
Access Postal Administration page on https://postal.example.com
Login with admin user email created earlier.
Refer to the Postal Administration guide for further configurations.
Recommend
-
37
Postal code validation for multiple countries can always be a pain, but thanks to the Laravel Postal Code Validation package by Choraimy Kroonstuiver , validating postal codes is...
-
12
Postal non-conspiracies Writing Software, technology, sysadmin war stories, and more. Wednesday, June 15, 2011 Postal non-conspiracies Google c...
-
6
Panicking Etsy Sellers Are Afraid Of One-Star Reviews If Postal Delays Ruin Christmas Orders “It does kind of feel like Etsy’s left us to the sharks," said one seller who fears customers will take out their US...
-
9
MySQL Query - select the corresponding postal codes advertisements I need to make a selection based on the first 2 characters of a field, so f...
-
8
UpshotThe Postal Service Survived the Election. But It Was Crushed by Holiday Packages. ...
-
12
-
6
United States Postal Service suspends mail deliveries to New Zealand The United States Postal Service (USPS) has suspended mail deliveries to New Zealand due to an unavailability of transportation.
-
98
Install Zimbra 9 Mail Server on Rocky Linux 8|AlmaLinux 8|RHEL 8Search ComputingForGeeksZimbra
-
9
Using a Different System? ...
-
7
<?xml encoding="utf-8" ??>Introduction Mail-in-a-box (MiaB) takes care of all the complicated configurations required to avoid security problems, provides a solid spam detection system and gives...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK