Installing PowerMTA

The original PowerMTA installation article recovered from the former WordPress website.

Originally published 2023-01-14Updated 2023-01-19By Ilirjan TrushillaHistorical guide
PowerMTARecovered articleOriginal commands preserved
Historical note: This article preserves the original CentOS-era commands and PowerMTA 4.0r6 package example. Review package names, firewall syntax, repository URLs, and operating-system compatibility before using them on a current server.

PowerMTA introduction

PowerMTA is a Commercial Mail Transfer Agent (MTA) used by many email service providers (ESPs), mass mailing companies, and paid SMTP providers such as SendGrid, Mandrill, SMTP.com, Sendloop, and many others.

Install Webmin

cat > /etc/yum.repos.d/webmin.repo << EOF
[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1
EOF
rpm --import http://www.webmin.com/jcameron-key.asc
yes | yum update
yum -y install webmin
chkconfig webmin on
yum -y install nano

Open the required firewall ports

iptables -I INPUT -p tcp --dport 10000 -j ACCEPT
iptables -I INPUT -p tcp --dport 20000 -j ACCEPT
iptables -I INPUT -p tcp --dport 31425 -j ACCEPT
iptables -I INPUT -p tcp --dport 2087 -j ACCEPT
iptables -I INPUT -p tcp --dport 110 -j ACCEPT
iptables -I INPUT -p tcp --dport 25 -j ACCEPT
iptables -I INPUT -p tcp --dport 2525 -j ACCEPT
iptables -I INPUT -p tcp --dport 26 -j ACCEPT
iptables -I INPUT -p tcp --dport 465 -j ACCEPT
iptables -I INPUT -p tcp --dport 587 -j ACCEPT
iptables -I INPUT -p tcp --dport 993 -j ACCEPT
iptables -I INPUT -p tcp --dport 995 -j ACCEPT
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -j ACCEPT
iptables -I INPUT -p udp --dport 53 -j ACCEPT
iptables -I INPUT -p tcp --dport 53 -j ACCEPT
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
iptables -I INPUT -p tcp --dport 2096 -j ACCEPT
iptables -I INPUT -p tcp --dport 2031 -j ACCEPT
iptables -I INPUT -p tcp --dport 2030 -j ACCEPT
iptables -I INPUT -p tcp --dport 143 -j ACCEPT
service iptables save
service iptables restart

Install CentOS Web Panel

cd /usr/local/src
wget http://centos-webpanel.com/cwp-latest
sh cwp-latest

Install required packages

yum -y install mysql mysql-devel mysql-server mod_auth_mysql
yum -y install gdb php-gd php-cli php-common php-mysql
yum -y install bind.x86_64 bind-utils.x86_64
yum -y install ntp.x86_64 gcc.x86_64 dos2unix.x86_64 sudo.x86_64 wget.x86_64 make.x86_64
yum -y install perl-ExtUtils-MakeMaker.x86_64 cronie.x86_64 cronie-anacron.x86_64 crontabs.noarch iptraf.x86_64 nano.x86_64 telnet.x86_64 lsof.x86_64

Install PowerMTA

rpm -ivh /home/PowerMTA-4.0r6.x86_64.rpm

Create directories and set permissions

chown pmta:pmta /etc/pmta/config
chmod 640 /etc/pmta/config
mkdir -p /var/spool/pmtaPickup/
mkdir -p /var/spool/pmtaPickup/Pickup
mkdir -p /var/spool/pmtaPickup/BadMail
mkdir -p /var/spool/pmtaIncoming
chown pmta:pmta /var/spool/pmtaIncoming
chmod 755 /var/spool/pmtaIncoming
chown pmta:pmta /var/spool/pmtaPickup/*
mkdir -p /var/log/pmta
mkdir -p /var/log/pmtaAccRep
mkdir -p /var/log/pmtaErr
mkdir -p /var/log/pmtaErrRep
chown pmta:pmta /var/log/pmta
chown pmta:pmta /var/log/pmtaAccRep
chown pmta:pmta /var/log/pmtaErr
chown pmta:pmta /var/log/pmtaErrRep
chmod 755 /var/log/pmta
chmod 755 /var/log/pmtaAccRep
chmod 755 /var/log/pmtaErr
chmod 755 /var/log/pmtaErrRep

Basic relay and listener example

# relay-domain
relay-domain example.com
smtp-listener 0/0:2525

Fix “Insufficient process resources”

ulimit -H -n 80000

nano /etc/sysctl.conf

# Add this line:
fs.file-max = 80000

# Or apply it immediately:
sysctl -w fs.file-max=80000

# Load the configuration:
sysctl -p

Configure system limits

nano /etc/security/limits.conf
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
sudo sysctl -p

# Reload systemd on CentOS 7
sudo systemctl daemon-reload

reboot
Search Trushilla Documentation