In today’s guide, we will walk you through the process of installing PowerMTA 5.0r3 on Rocky Linux 8, one of the most popular open-source Linux distributions. This setup is essential for anyone looking to manage high-volume email delivery, ensuring emails are sent efficiently while staying compliant with email authentication standards like DKIM, SPF, and DMARC.
Prerequisites
Before you begin, ensure that you have the following:
- A Rocky Linux 8 instance with root or sudo access.
- PowerMTA 5.0r3 RPM file.
- A valid PMTA 5.0r3 License (you can purchase the license here).
- Basic knowledge of command-line Linux operations.
Suggested : How to Install PowerMTA 4.5r1 on CentOS 7
Steps to Install PowerMTA 5.0r3 on Rocky Linux 8
1. Update the System
First, ensure that your system is up-to-date by running:
sudo dnf update -y
2. Disable SELinux (Optional)
Sometimes, SELinux can cause issues with PowerMTA. To disable it temporarily and make it permissive, run:
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
3. Install Dependencies
To make sure all required dependencies are installed, run the following command:
sudo dnf install -y wget net-tools tar vim
4. Set Hostname
Next, configure your server’s hostname. Replace mail.domain.xyz
with your actual domain:
hostnamectl set-hostname mail.domain.xyz
5. Install PowerMTA
Now, let’s install PowerMTA 5.0r3. Start by downloading and installing the RPM package:
cd /root/
- Buy Sparkpost PowerMTA License for Sending Bulk Emails
sudo dnf install -y PowerMTA-5.0r3.rpm
Note: If needed, you can also install PowerMTA without weak dependencies by running:
sudo dnf install -y --setopt=install_weak_deps=False PowerMTA-5.0r3.rpm
6. Stop PMTA Services
Stop any running PowerMTA services to avoid conflicts:
service pmta stop
service pmtahttp stop
sudo systemctl status pmta
7. Remove Original Files
Sometimes, PowerMTA installs with default files that may need to be replaced. Remove the existing files:
rm -rf /usr/sbin/pmtad
rm -rf /usr/sbin/pmtahttpd
8. Copy Modified Config Files
Copy the required modified and configuration files from your local directory to the system directories:
cd /root/usr/sbin
cp * /usr/sbin
cd /root/etc/pmta
cp * /etc/pmta
chmod 777 /usr/sbin/pmtad
chmod 777 /usr/sbin/pmtahttpd
9. Open Ports for PowerMTA
PowerMTA requires certain ports to be open for smooth operation. The most common ports are 25, 587, 2525, and the management port (default: 1234). Open these ports in your firewall:
sudo firewall-cmd --permanent --add-port=25/tcp
sudo firewall-cmd --permanent --add-port=587/tcp
sudo firewall-cmd --permanent --add-port=2525/tcp
sudo firewall-cmd --permanent --add-port=1234/tcp
sudo firewall-cmd --reload
10. Generate DKIM Keys
Generate the DKIM keys necessary for email authentication:
cd /etc/pmta
openssl genrsa -out dkim.private.key 1024 && openssl rsa -in dkim.private.key -out dkim.public.key -pubout -outform PEM
11. Increase Max Open Files
For optimal performance, increase the number of open files that PowerMTA can use:
sysctl -w fs.file-max=262144
12. Reboot the Server
After making all necessary changes, reboot your server:
sudo reboot
Enable and Start PowerMTA
Once your server reboots, enable and start the PowerMTA service to begin sending emails:
sudo systemctl enable pmta
sudo systemctl start pmta
sudo systemctl status pmta
Debugging PowerMTA
If PowerMTA is not running as expected, you can debug the service using the following command:
/usr/sbin/pmtad --debug
Also, if you find that ports like 25 or 2525 are already in use, you can identify and kill the conflicting processes using:
netstat -tulpn | grep :2525
netstat -tulpn | grep :25
kill -9 [PID]
Related : How to Use Amazon WorkMail for Bulk Email Sending 📩🚀
Removing PowerMTA Email Queue
If you need to clear the PowerMTA email queue, use the following commands:
service pmta stop
cd /var/spool/pmta/
rm -rf *
service pmta start
service pmta restart
service pmtahttp restart
service pmta reload
Configure DNS Records (DKIM, SPF, DMARC)
After setting up PowerMTA, it’s crucial to configure your DNS records for authentication.
DKIM
Add the following DKIM record to your DNS (replace dkim.public.key.pem
with your actual DKIM public key):
default._domainkey.domain.xyz
v=DKIM1; k=rsa; p=(paste public key here)
SPF
Ensure you have the proper SPF record to authorize your mail server’s IP:
domainname.xyz
v=spf1 a mx ip4:xx.xx.xx.xx ~all
DMARC
Add a DMARC record to your DNS for email validation:
_dmarc.domain.xyz
v=DMARC1; p=none;
MX Records
Finally, add the necessary MX records for email routing.
Changing rDNS (PTR Record)
To improve email deliverability, configure the reverse DNS (rDNS). The process for this varies by cloud provider, but in most cases, you can edit the network settings in the cloud panel. For example, in Linode, you can change it from the network tab of the instance.
Conclusion
By following this guide, you will have successfully installed and configured PowerMTA 5.0r3 on Rocky Linux 8. With proper configuration of DKIM, SPF, and DMARC, you can ensure your email server operates effectively and securely, avoiding common email deliverability issues.
For your PMTA 5.0r3 License, remember to purchase here.