65 lines
1.4 KiB
Bash
Executable File
65 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# INSTALL PMTA ON NEW SERVER
|
|
# Usage: ./install-pmta.sh <SERVER_IP> <PMTA_LICENSE>
|
|
|
|
SERVER_IP=$1
|
|
PMTA_LICENSE=$2
|
|
|
|
if [ -z "$SERVER_IP" ] || [ -z "$PMTA_LICENSE" ]; then
|
|
echo "Usage: $0 <SERVER_IP> <PMTA_LICENSE>"
|
|
exit 1
|
|
fi
|
|
|
|
echo "🚀 Installing PowerMTA on $SERVER_IP"
|
|
|
|
ssh root@$SERVER_IP << 'REMOTE'
|
|
# Update system
|
|
apt-get update && apt-get upgrade -y
|
|
|
|
# Install dependencies
|
|
apt-get install -y wget curl vim htop net-tools dnsutils
|
|
|
|
# Download PMTA (adjust URL for your version)
|
|
cd /tmp
|
|
wget -q "https://download.port25.com/pmta/pmta-5.0r2-ubuntu22.04.amd64.deb"
|
|
|
|
# Install PMTA
|
|
dpkg -i pmta-5.0r2-ubuntu22.04.amd64.deb || apt-get install -f -y
|
|
|
|
# Create directories
|
|
mkdir -p /etc/pmta /var/log/pmta /var/spool/pmta
|
|
|
|
# Basic config
|
|
cat > /etc/pmta/config << 'PMTACONF'
|
|
# PowerMTA Configuration
|
|
postmaster postmaster@localhost
|
|
|
|
# Logging
|
|
<logging>
|
|
log-file /var/log/pmta/pmta.log
|
|
accounting-log /var/log/pmta/acct.log
|
|
</logging>
|
|
|
|
# Default VMTA
|
|
<virtual-mta default>
|
|
smtp-source-host 0.0.0.0
|
|
max-smtp-out 20
|
|
max-msg-rate 100/h
|
|
backoff-retry-after 10m
|
|
backoff-max 1h
|
|
</virtual-mta>
|
|
|
|
# Management interface
|
|
http-mgmt-port 8080
|
|
http-access 0.0.0.0/0 admin admin123
|
|
PMTACONF
|
|
|
|
# Start PMTA
|
|
systemctl enable pmta
|
|
systemctl start pmta
|
|
|
|
echo "✅ PMTA installed successfully"
|
|
REMOTE
|
|
|
|
echo "✅ PMTA installation complete on $SERVER_IP"
|