Lab 8 - SMTP Server (Postfix)
The SMTP server we will use is postfix. It provides easier configuration and better security than sendmail. Postfix and sendmail are now both included with Red Hat. If you need to install postfix it is on disk 2 (FC1 disk 3).
1. Log in as root (or su -).
Add your nameserver to Linux so that postfix can resolve the MX and A records for your domains.
Do this by adding nameserver 10.11.9.x to the beginning of the
/etc/resolv.conf file.
2. Postfix has hundreds of configuration parameters. We only need to set three to get things working. If you are receiving email for more than one domain, or you have aliases then things get more complex.
Edit the file /etc/postfix/main.cf:
# The server name to be used in outgoing email myhostname = mail.hogwarts.com #A list of domains to receive mail for mydestination = $myhostname, localhost.$mydomain, hogwarts.com # Which networks to listen on inet_interfaces = all
3. Since Red Hat comes with two SMTP servers we have to tell Red Hat that we want to use Postfix. If you do not have this command you can install it from RH9 disk 3. (FC1 disk 1)
# redhat-switch-mail
This will show you which mail server is now being used and give you the oportunity to change it.
Select Postfix and click OK. (This program will stop sendmail, switch postfix to the default MTA,
and start postfix as well as make the neccessary changes to chkconfig.)
4. Test postfix locally by sending an email from the commandline with the mail command.
Make sure you send it to a user that exists on your system. You tell the mail command that you are done
your email by typing a period as the only character on the line. It will then ask if you want to cc it
to anyone, you can just press enter.
$ mail -s "I am in need of assistance" ron@hogwarts.com Ron, Lord Voldamort has me prisoner. Help! Harry . CC: $
The email should be delivered to the sender's email file on the server. By default this will
be a file called /var/spool/mail/username.
5. Test postfix by setting a up an email client on your Windows PC and set the DNS and send and receive mail server to your Linux server. Send an email to a user that exists on your server.
6. Have your work checked by the instructor.