Professional Documents
Culture Documents
Hiteshjethva
How to Setup Postal Mail Server on Ubuntu 18.04
35 posts | 4 followers
Hiteshjethva March 2, 2020 7,693 " 0
Follow
In this tutorial, we will learn how to install and configure Postal on an Alibaba Cloud Elastic Compute Service (ECS)
Ubuntu 18.04 server.
Related Products
In this tutorial, we will learn how to install and configure a Postal mail server on an Alibaba Cloud Elastic
Compute Service (ECS) Ubuntu 18.04 server.
Alibaba Mail
Prerequisites Alibaba Mail is one of the only email service providers in
the industry that supports public cloud services and
A fresh Alibaba Cloud instance with Ubuntu 18.04 installed. provides fast, secure, and stable services.
A root password is set up to your instance.
A valid domain name is configured with your instance. Learn More
Create a new ECS instance and connect to your instance as the root user.
Once you are logged into your Ubuntu 18.04 instance, run the following command to update your base Web Hosting
system with the latest available packages.
Explore how our Web Hosting solutions help small and
medium sized companies power their websites and online
apt-get update -y
businesses.
Learn More
Install and ConWgure MariaDB
First, you will need to install MariaDB database server to your server. You can install it with the following
command: Web Hosting Solution
After installing MariaDB, you will need to secure it first. You can secure it by running the following command: Learn More
mysql_secure_installation
Enter current password for root (enter for none): How to Archive VM Backups on Alibaba Cloud with
Set root password? [Y/n]: N Simple 4 Steps?
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y How to Install Zabbix Monitoring Server on Ubuntu
Remove test database and access to it? [Y/n]: Y 20.04
Reload privilege tables now? [Y/n]: Y
Git Branching Naming Convention - Best Practices
Once the MariaDB server is secured, log in to MariaDB shell with the following command: Basics of Working with JSON in SQL Server
Enter your root password, then create a database and user for Postal: Why Is A Database Backup Essential for Enterprises?
MariaDB [(none)]> GRANT ALL ON postal.* TO 'postal'@'localhost'; What are the main Differences Between Cloud Hosting
MariaDB [(none)]> GRANT ALL PRIVILEGES ON `postal-%`.* to `postal`@`localhost` IDENTIFIED BY "password"; and Shared Hosting?
Next, flush the privileges and exit from the MariaDB shell with the following command:
Next, you will need to install Ruby to your server. By default, Ruby is not available in the Ubuntu 18.04 default
repository. So, you will need to add Ruby repository to your server.
You can add the Ruby repository with the following command:
Next, update the repository and install Ruby with the following command:
apt-get update -y
apt-get install ruby2.3 ruby2.3-dev build-essential -y
RabbitMQ is an open source message broker software that implements the Advanced Message Queuing
Protocol. Postal uses RabbitMQ for queueing. So, you will also need to install RabbitMQ and Erlang to your
server.
First, download and add the Erlang GPG key with the following command:
Next, update the repository and install Erlang with the following command:
apt-get update -y
apt-get install erlang -y
Once Erlang has been installed, you can proceed to install RabbitMQ.
First, download and add the RabbitMQ GPG key with the following command:
Next, update the repository and install RabbitMQ with the following command:
apt-get update -y
apt-get install rabbitmq-server -y
Once the RabbitMQ has been installed, check the status of RabbitMQ service with the following command:
Next, you will need to create RabbitMQ vhost and user for postal. You can do this with the following
command:
Install Nodejs
By default, the latest version of Nodejs is not available in the Ubuntu 18.04 default repository. So, you will
need to add repository for that.
You can add the Nodejs repository with the following command:
Next, update the repository and install Nodejs with the following command:
Install Postal
Before installing Postal, you will need to create a user for postal mail server. You can create it with the
following command:
Next, allow ruby to listen on web ports with the following command:
Next, install all the required gems with the following command:
Next, create a directory structure for Postal with the following command:
mkdir -p /opt/postal/app
Next, download the latest version of Postal with the following command:
wget https://postal.atech.media/packages/stable/latest.tgz
Once the download is completed, extract the downloaded file with the following command:
Next, create a symlink for Postal binary with the following command:
ln -s /opt/postal/app/bin/postal /usr/bin/postal
Next, install all the required dependencies with the following command:
postal initialize-config
nano /opt/postal/config/postal.yml
web:
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: password
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: password
prefix: postal
rabbitmq:
# Specify the connection details for your RabbitMQ server.
host: 127.0.0.1
username: postal
password: password
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: postal@yourdomain.com
Save and close the file. Then, initialize database with the following command:
postal initialize
Next, you will need to create a admin user for Postal. You can do this with the following command:
postal make-user
postal start
You can check the status of Postal with the following command:
postal status
You can stop the Postal service any time with the following command:
postal stop
Next, you will need to create a systemd service file to manage Postal service. You can do this with the
following command:
nano /etc/systemd/system/postal.service
[Unit]
Description=Postal Mail Platform
After=mysql.service rabbitmq-server.service
Wants=mysql.service rabbitmq-server.service
[Service]
ExecStart=/usr/bin/postal start
ExecStop=/usr/bin/postal stop
ExecReload=/usr/bin/postal restart
User=postal
Restart=on-failure
Type=forking
[Install]
WantedBy=mysql.service rabbitmq-server.service
Save and close the file. Then, reload the systemd with the following command:
systemctl daemon-reload
Next, start Postal service and enable it to start on boot with the following command:
You can check the status of Postal service with the following command:
Next, you will need to install Nginx to access Postal mail server. First, install Nginx with the following
command:
cp /opt/postal/app/resource/nginx.cfg /etc/nginx/sites-available/default
mkdir /etc/nginx/ssl/
openssl req -x509 -newkey rsa:4096 -keyout /etc/nginx/ssl/postal.key -out /etc/nginx/ssl/postal.cert -days 365 -nodes
Next, open the Nginx default virtual host file and define your domain:
nano /etc/nginx/sites-available/default
server_name postal.example.com;
Save and close the file. Then, restart Nginx service with the following command:
Now, open your web browser and type the URL https://postal.example.com . You will be redirected to the
following page:
Provide your administrator email and password which you have created earlier. Then, click on the Login
button. You should see the following page:
Next, click on the Create the first organization. You should see the following page:
Next, provide your organization name and click on the Create organization button. You should see the
following page:
That's it! Now, you can easily build your own mail server for your organization.
"0 # 0 $ 0 Share on
% & '
Read previous post: Read next post:
How to Monitor Your Ubuntu 18.04 System with How to Install and Configure Prisma Server on
Sysdig Ubuntu 18.04
An Introduction to Logrotate: Manage Log Files on Alibaba How to Set Up Zimbra Collaboration Tool on ECS Ubuntu
Cloud 18.04
How to Install Chkrootkit Security Scanner on Ubuntu How to Install and Configure Prisma Server on Ubuntu
18.04 18.04
How to Setup Kamailio SIP server on Ubuntu 18.04 How to Setup Shinken Monitoring Tool on ECS Ubuntu
18.04
Hiteshjethva - January 8, 2020
Hiteshjethva - December 12, 2019
Comments
Post
Alibaba Group Taobao Marketplace Tmall Juhuasuan AliExpress Alibaba.com 1688 Alimama Alitrip YunOS AliTelecom AutoNavi UCWeb Umeng Xiami DingTalk Alipay