In this guide, we’ll walk you through the process of installing PowerMTA 4.5r1 on CentOS 7. PowerMTA is a robust email delivery system used by email service providers to manage large-scale outbound email. Whether you’re sending transactional emails or high-volume marketing emails, PowerMTA ensures that emails are delivered efficiently and securely. By the end of this guide, you’ll have PowerMTA installed, configured, and ready to handle your email needs.
Prerequisites
Before starting, make sure you have the following:
- A CentOS 7 server with root or sudo access.
- The PowerMTA 4.5r1 installation ZIP file (you can get it from your cloud server).
- A valid PowerMTA license. You can purchase it from here.
- A basic understanding of Linux commands and email configurations.
Steps to Install PowerMTA 4.5r1 on CentOS 7
1. Set the Hostname
First, you need to set the correct hostname for your server. This is essential for email services. Replace mail.domain.xyz
with your actual domain:
hostnamectl set-hostname mail.domain.xyz
2. Download and Install PowerMTA
Now, let’s download and install PowerMTA. Start by installing the necessary tools and then get the PowerMTA ZIP file:
yum -y install unzip && unzip -q pmta-45r1.zip
- Buy PowerMTA 4.5r1 / 5.0r3 Licenses Including Full Installation Gudie
3. Install Dependencies and PowerMTA
Install the required dependencies and PowerMTA:
yum -y install net-tools
yum -y install firewalld
chmod 777 install.sh
systemctl enable firewalld
systemctl start firewalld
./install.sh
reboot
After the reboot, PowerMTA should be installed on your CentOS 7 instance.
4. Copy License and Configuration Files
After the system restarts, you need to copy the license folder to the /etc/pmta/License
directory. You also need to upload the configuration and virtual host files to /etc/pmta
, replacing the default ones. Use WinSCP or FileZilla to replace the domain and IP addresses in the configuration files (you can use the “Find and Replace” option for this).
cd /etc/pmta
5. Generate DKIM Keys
Generating DKIM keys is crucial for email authentication. Run the following command to generate your DKIM keys:
openssl genrsa -out dkim.private.key 1024 && openssl rsa -in dkim.private.key -out dkim.public.key -pubout -outform PEM
6. Configure Firewall and Open Ports
Open the necessary ports for PowerMTA. These ports are used for email sending and management:
firewall-cmd --zone=public --permanent --add-port=1234/tcp
firewall-cmd --zone=public --permanent --add-port=8080/tcp
firewall-cmd --zone=public --permanent --add-port=25/tcp
firewall-cmd --zone=public --permanent --add-port=2525/tcp
firewall-cmd --reload
service pmta restart
service pmtahttp restart
service pmta reload
reboot
7. Increase Max Open Files
For optimal performance, increase the maximum number of open files that PowerMTA can handle:
sysctl -w fs.file-max=262144
8. Debugging PowerMTA (If Not Running)
If PowerMTA is not running as expected, you can debug it by using the following command:
/usr/sbin/pmtad --debug
9. Check and Kill Conflicting Processes
If ports 25 or 2525 are already in use by other processes, you need to identify and kill those processes:
netstat -tulpn | grep :2525
netstat -tulpn | grep :25
kill -9 [PID]
10. Remove PowerMTA Mail Queue
If you need to clear the PowerMTA mail queue, you can 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
DNS Records (DKIM, SPF, DMARC)
DKIM
After generating the DKIM keys, you need to add the DKIM record to your DNS. Here’s an example of what the DKIM record should look like (replace dkim.public.key.pem
with your actual public key):
default._domainkey.domain.xyz
v=DKIM1; k=rsa; p=(paste public key here)
SPF
Next, you need to set up the SPF record. This record authorizes your IP to send emails on behalf of your domain:
domainname.xyz
v=spf1 a mx ip4:xx.xx.xx.xx ~all
DMARC
You should also add a DMARC record to your DNS to protect your domain from unauthorized use:
_dmarc.domain.xyz
v=DMARC1; p=none;
MX Records
Ensure you have added the appropriate MX records for email delivery.
Change rDNS (PTR Record)
To ensure your emails are delivered without issues, it’s important to set up reverse DNS (rDNS) for your server. The process varies by cloud provider, but in most cases, you can change the rDNS settings through your provider’s control panel. For example, in Linode, you can easily change the rDNS in the network settings of your instance.
Conclusion
By following these steps, you have successfully installed PowerMTA 4.5r1 on your CentOS 7 server and configured it for efficient email delivery. To ensure better email performance, don’t forget to set up DKIM, SPF, and DMARC records in your DNS settings.
For a smooth PowerMTA experience, make sure to purchase a valid PowerMTA license from here.
If you’re also looking to install PowerMTA 5.0r3 on Rocky Linux 8, check out our related article on How to Install PowerMTA 5.0r3 on Rocky Linux 8.