1) Choose the right machine for the job.
The most important consideration for Mail is disk I/O. Every step, every transaction, every process of a mail server uses the disk. The faster your disk I/O the faster your mail will move.
If your total mail count is around 8000 messages a day then you can easily use a 450MHz machine with an IDE disk subsystem and about 128Mb of RAM.
If your total is 24000 messages a day then you should consider using LVD drives and a 600MHz machine.
If you are going to run supplemental programs on the mail server like SpamAssassin (to remove spam) or Mailscanner (to remove viruses from emails) then you will also need to increase your RAM considerably.
2) Install Red Hat Linux 8.0 on your server.
Set it up to boot in run level 3 (command line, not GUI). It's cool to have X setup on the machine, but you really want all that processing power devoted to moving and processing mail.
You can change the run level of a machine by modifying the initdefault line of the file /etc/inittab
id:3:initdefault:Later, if you are in command line and want to startup an X-session, you can simply type in:
startx===
During the setup of your disk drives, you should set /var as a separate partition and give it plenty of space. All of your mail queues and mail spools will run on /var, so it needs plenty of space.
/var/spool/mqueue - contains your outgoing mail queue /var/spool/mail - contains your users mail spools (mail waiting to be downloaded by your users)===
Your machine will need a valid domain name that resolves via DNS, and a valid IP address that will also resolve via DNS. Even if the mail server is running on an private network behind a NAT Firewall the server must be able to resolve its own name and address via an internal DNS server.
===
If you setup firewall services on the server, be sure to open up SMTP (port 25) and POP (port 110). You may also wish to open up IMAP (port 143).
The secure version of POP3 uses port 995 and the secure version of IMAP uses port 993. These require that SSL be loaded and configured on the server.
3)DNS setup for Mail services
The most important step in setting up Mail services is to properly define the servers in your domain's DNS!
As an example, here is TriLUG's mail server information: IP address: 64.244.27.132 Domain name: mail.trilug.org Thus the DNS file from TriLUG.org looks something like this: === @ IN SOA ns1.trilug.org. hostmaster.trilug.org. ( 2002082605 ; Serial YYYYMMDDNN 7200 ; Refresh 600 ; Retry 36000 ; Expire 3600 ) ; Minimum IN NS ns.trilug.org. IN NS ns1.darkcanvas.com. IN MX 10 mail.trilug.org. IN MX 100 mail-bak.trilug.org. www IN A 64.244.27.132 mail IN A 64.244.27.132 mail-bak IN A 64.244.27.133 ===Important things to note about the above configuration:
- The "IN MX" lines point to two servers which can handle mail for trilug.org. All mail will first attempt to go mail.trilug.org. If that is too busy or for some reason a connection cannot be made, then mail will be dropped off at mail-bak.trilug.org, and then forwarded on to mail.trilug.org at some later time (when it becomes available again).
- Both mail.trilug.org and mail-bak.trilug.org are defined by "IN A" records.
Mail services are so completely dependent on proper DNS access/setup that I recommend each Mail server also be setup as a secondary caching DNS for your domain (but that is another class altogether!).
4)Setting up Sendmail on your server
By default Sendmail and its configuration files are installed on your server (rpm -i sendmail-8.12.5-7.i386.rpm), so you don't need to worry about installing Sendmail - but you will need to install the "sendmail-cf" package yourself. The rpm is on the third disk of the distribution:
The sendmail.cf file is Sendmail's main configuration file. This configuration file controls how Sendmail handles mail and smtp connections. The default file is fairly good, but we will need to make some changes to it.
Making changes to Sendmail.cf is easy when you use the the macro config file: /etc/mail/sendmail.mc. To make changes you will need to edit sendmail.mc then run the following commands:
cp /etc/mail/sendmail.cf /etc/mail/bak.sendmail.cf m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf service sendmail stop service sendmail startThis backs up the current sendmail.cf file, then regenerates it from the newly edited sendmail.mc file. After changing the sendmail.cf file you must stop sendmail completely then restart it, for the changes to be used.
===
Lets go ahead and edit the sendmail.mc file right now...
There are two lines we need to address. First we need to open up SMTP services so that the Mail server listens for SMTP connections on all interfaces. We do this by commenting out the following line:
dnl DAEMON_OPTIONS('Port=smtp,Addr=127.0.0.1, Name=MTA')The "dnl" in front of the line comments it out.
Next we need to identify our host name to Sendmail. By default it is set to "localhost.localdomain". We need to change that to the fully qualified domain name of our host:
Cwmail.trilug.orgThose are the only two changes that you really want to make
In the file, one of the comments tells you "We strongly recommend to comment this one out ..." - Please don't. I strongly recommend that you ignore that.
===
After you apply the above changes to Sendmail (by running the m4 command and then stopping and restarting Sendmail), you should test the changes.
To test your changes above run:
netstat -na |grep ":25 "The output should looks similar to:
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
You should also be able to telnet to localhost on port 25 and see the new hostname.
===
One last change and your Sendmail configuration should be done. Edit the files:
/etc/mail/local-host-names
/etc/mail/access
Put your domain name and your fully qualified domain name into both of these files. As an example, the following entries would be good for TriLUG.
trilug.org RELAY mail.trilug.org RELAY
===
IMPORTANT NOTE (added Feb 27, 2003):
5) Setting up POP or basic IMAP services on your server
Now that Email is collecting on your mail server, you will need a way to let local users download the mail being stored there. You'll need to install the "imap" rpm from disk 2 of the distribution:
rpm -i imap-2001a-15.i386.rpmThis will add: ipop3, imap, pop3s, and imaps to your system. In order to activate these services you will have to go to the /etc/xinetd.d directory and edit the files for the services that you want to enable. I recommend that you start with the file: ipop3.
Edit /etc/xinetd.d/ipop3 and change the "disable" line to read:
disable = noYes, it is a double negative... Now stop and start the xinetd service (by default it is turned on, but with all services disabled).
service xinetd stop service xinetd startAnd test that your server now allows POP access:
telnet localhost 110If successful, you will see an "+OK POP3 ..." banner. To quit the telneted POP process, type "quit".
Your basic mail services are complete.