-
-
Save ravituvar/a21dd05c82eb7287720c9bf0b1796d89 to your computer and use it in GitHub Desktop.
Install postfix server on aws linux ami
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOMAIN=example.com | |
USERNAME=admin | |
# Configure hostname | |
sed s/"127.0.0.1 localhost"/"127.0.0.1 $DOMAIN localhost"/ -i /etc/hosts | |
sed s/HOSTNAME.*/HOSTNAME=$DOMAIN/ -i /etc/sysconfig/network | |
# Intall server and mutt | |
yum install -y postfix mutt | |
#Configure postfix | |
cp /etc/postfix/main.cf /etc/postfix/main.cf.bak | |
cat << EOF > /etc/postfix/main.cf | |
alias_database = hash:/etc/aliases | |
alias_maps = hash:/etc/aliases | |
command_directory = /usr/sbin | |
config_directory = /etc/postfix | |
daemon_directory = /usr/libexec/postfix | |
data_directory = /var/lib/postfix | |
debug_peer_level = 2 | |
html_directory = no | |
inet_interfaces = all | |
inet_protocols = all | |
mail_owner = postfix | |
mailq_path = /usr/bin/mailq.postfix | |
manpage_directory = /usr/share/man | |
newaliases_path = /usr/bin/newaliases.postfix | |
queue_directory = /var/spool/postfix | |
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES | |
sample_directory = /usr/share/doc/postfix-2.6.6/samples | |
sendmail_path = /usr/sbin/sendmail.postfix | |
setgid_group = postdrop | |
unknown_local_recipient_reject_code = 550 | |
mydestination = \$myhostname, localhost.\$mydomain, localhost, \$mydomain | |
mydomain = $DOMAIN | |
myhostname = $DOMAIN | |
mynetworks_style = host | |
myorigin = \$mydomain | |
EOF | |
#Add user for receive mail | |
adduser $USERNAME | |
# Start postfixpoweroff | |
chkconfig --add postfix | |
service sendmail | |
service postfix start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment