Copyright ©1996, Que Corporation. All rights reserved. No part of this book may be used or reproduced in any form or by any means, or stored in a database or retrieval system without prior written permission of the publisher except in the case of brief quotations embodied in critical articles and reviews. Making copies of any part of this book for any purpose other than your own personal use is a violation of United States copyright laws. For information, address Que Corporation, 201 West 103rd Street, Indianapolis, IN 46290 or at support@mcp .com.
Now that you've got Linux installed and accounts created, you can move on to getting your servers set up. Start with the one that's often the most necessary and useful: your electronic mail server. After all, e-mail is the most used tool on the Internet other than, perhaps, Ping!
There are three e-mail servers you may want to install. One is the Sendmail server, which will handle your SMTP mail to and from the Internet. Simple Mail Transport Protocol (SMTP) is the standard method for transmitting electronic mail from one site to another.
The second is a Post Office Protocol (POP) mail server. A POP server holds mail for people just like a post office box. Users can connect to the POP server as they wish and it will transfer their mail to them. Some POP servers can also send mail out to the rest of the Internet.
Finally, there is a Unix to Unix Copy (UUCP) server. UUCP, in a way, is between SMTP and POP. It gets and sends out its files in batches at regular intervals, and doesn't require a permanent connection as long as it's connected during its file transfers. Many sites are more likely to have their users using UUCP from home to get and send their mail, than use it for their own mail transfer. This server is useful for more than e-mail, it also can transfer news (chapter 9, "Installing UseNet Server Software," has more about setting up this function).
In this chapter, you learn how to set up:
The Sendmail server was conveniently installed during the Linux setup process that you went through in chapter 4, "Installing Linux from the CD-ROM." This includes a basic Sendmail configuration file (sendmail.cf). Although the basic configuration file was set up during the installation process, there is more work to be done to configure it for your particular needs.
If you have not installed Sendmail, log in as root and type setup. Add a package; the Sendmail items are on disk set N. To save a little time, choose the option that sets up your sendmail.cfg file.
Although there are entire books on the subject of Sendmail, I'm going to show you how to set up your Sendmail server for the basic tasks that you need to be able to perform. In the section, "Setting Up Sendmail for Local Mail Delivery," you'll learn how to configure your mail server to handle the following functions:
Don't get the Sendmail files confused with the smail files. Smail is a completely different mail server!
Smail is an older program that was written so people wouldn't have to deal with the complexity of Sendmail. However, because you can now start with a generic sendmail.cf file and simply modify it, Sendmail has become much easier to use (you used to have to do it all from scratch). So, smail is not so necessary anymore.
Additionally, smail is only really suited for small use. Sendmail is necessary for running a full Internet site.
Anything that you do in this chapter, you'll do from your root account.
You're already equipped for basic local mail delivery if you chose to let the Linux installation program set up your sendmail.cfg file (see fig. 6.1). You'll need to take care of a few items, though, to make sure things run smoothly.
Fig. 6.1 Local mail delivery.
First, you need to make the Sendmail daemon launch at boot time. A daemon is a program that runs in the background and watches for the items it's supposed to handle, in this case, mail. If you don't have your Sendmail daemon running, it won't be sitting and waiting to process incoming and outgoing mail.
To make sure the Sendmail daemon is loaded, do the following:
if [-f /usr/lib/sendmail ]; then (cd /usr/spool/mqueue; rm -f lf*) /usr/lib/sendmail -bd -q1h; echo -n 'sendmail' > /dev/console fi
The code for the Sendmail daemon is not as complicated as it looks. It breaks down as follows:
Now, set a few aliases for Sendmail to make life a little more convenient and to make your system a little more in tune with the other sites on the Net.
To set the aliases, do the following:
#sendmail aliases postmaster: root admin: root info: dee rob: rjl steven: stephen
The following are some general alias ideas:
Fig. 6.2 Aliasing an address to multiple userids.
Setting up your mail server to handle mail to and from the Internet is a little more complicated than processing local mail (see fig. 6.3). In this section, you'll learn to use the sendmail.cf file. Fortunately, you've got a sample config file already on your system that's preset to meet your TCP/IP and UUCP needs, so your work's been started for you!
Fig. 6.3 Sending mail out to the Internet.
The following are a few tips to keep in mind when you're digging your way through a sendmail.cf file:
Fortunately, there's really little you have to change at first if you chose the appropriate default file during your Linux installation. As you add more services-especially such services as electronic mail to fax-you'll need to get a bit more technical with your sendmail.cf file.
It takes a little getting used to, but just remember that commands are only one character long in your sendmail.cf file, and the first letters on the line are the commands, as shown in table 6.1.Table 6.1 Commands Used in sendmail.cf
Command Use Syntax D Defining macros D[macro][value] C Defining class macro C[class][word1][...] F Defining class macros F[class][filename] from files or pipes H Defining headers H[?flag?][name]:[format] M Defining mailers M[name],[field]=[value] O Defining options O[option][value] P Defining delivery P[name]=[value] priorities R Defining rewriting rules R[lhs][rhs][comment] S Declaring new ruleset S[number] starts T Declaring trusted users T[user1][user2][...]
The following are some examples and a more in-depth discussion of the two straightforward sendmail.cf commands:
Purgent=100 Pjunk=-100
Phighest=100 Phigh=50 Pnormal=0 Plow=-50 Plowest=-100
Troot daemon uucp
The rest of the Sendmail commands have their own extra parameters, and there are entire books on how to use them properly. Instead of going into an exhaustive discussion about what each parameter can do, I will recommend the changes that you should make.
All these changes are at the beginning of the sendmail.cf file, where the machine and site information is stored (the macro definition section). When multiple machines are mentioned-and there are different changes to make to different machines-I am referring to the individual sendmail.cf files on each machine. I recommend you make sure the following lines exist:
If you're using UUCP as well, there really aren't any changes you have to make as long as you used the sendmail.cf that includes UUCP capability. However, only your main server (in ABC's case red) should have the UUCP version of this file. The other computers' sendmail.cf files should not have UUCP capability (see fig. 6.4).
Fig. 6.4 Sending out UUCP mail.
You may not want to send or get mail by UUCP, but you may have dial-in users sending and getting mail by UUCP. If this is so, you still need to have UUCP defined in your sendmail.cf file.
If you need to install UUCP on your site, you can find it on the n disk set.
Now, if you don't intend to offer POP mail, you're finished setting up your mail server! Move ahead to the next chapter. If you do intend to offer POP mail, read the next section.
To offer POP mail, you need to set up your POP mail server (see fig. 6.5). However, this is such a simple task, you won't even realize you've done any more work! Simply do the following:
Fig. 6.5 Getting POP mail.
pop3 stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.pop3d
A line is commented out in these files if it begins with a number sign (#).
POP2 is simply an older version of the POP server than POP3. When people refer to POP servers in general, they're referring to POP3. Some sites simply haven't upgraded to it yet.
If you want to allow people to use the Eudora e-mail client from a Windows or Macintosh machine to access your POP server, you need to get the server QPOPPER. It's available via FTP at sunsite.unc.edu/pub/Linux/system/mail.
One thing many Internet sites run is mailing lists. With mailing lists, you can have a centralized distribution point to send a piece of mail to a small or large number of people. You can have them for all of your users, for people interested in a particular hobby or discussion topic, or really anything else you might want a number of people to be able to talk about together.
In a way, a mailing list is like a members-only newsgroup. Everyone sees the posts that go to the list, but only if they're subscribed to it through the list software.
You can find majordomo on the FTP site ftp.greatcircle.com, in the directory /pub/majordomo. The first file you should look at is majordomo-1.93.README (the version number may be different when you go to download the file). It walks you through the installation process. The file itself is majordomo-1.93.tar.Z. You also may want to take a look through the other text files in this directory, such as the CERT file and the SECURITY file.
You may want to wait until you've installed some of the servers in this book before installing majordomo if you are new to compiling programs.
Some tips on running mailing lists:
Once you get a server installed, it's time to test it. With Sendmail, this is simple! Just send two pieces of mail. The first you should send to yourself. The second is mail to someone on another site on the Internet. Then, get the person to write you back (or write to an autoresponder that will write you back immediately).
If the mail you sent to yourself doesn't come back, check root's mail (or postmaster if you gave it a different account). An error message was likely sent there telling you where things might be misconfigured. If there's no mail in root, type mailq as root. If the mail you sent was stuck in the queue, then it will be listed along with its status. You can then force it to process (flush) the queue by typing sendmail -q.
If the mail you sent to yourself comes back, but the mail you sent out to the Internet doesn't arrive there, once again first check root's (or postmaster's) mail for any error messages. Also, check the mail queue again. If it's not in the queue, you can look in your system's logs for sendmail statements. If there's not a listing for that piece of mail stating Accepted for delivery, your uplink server (say, your provider's mail server) hasn't accepted the mail. If it wasn't accepted, there will be an error message-if you keep getting deferred as an error you may need to talk to your provider and see if it's having problems with its mail system.
If the first two tests worked, but the incoming mail doesn't arrive, first check root/postmaster's mail to see if there's an error message. Also, your logs will show a connection from the mail server it was coming from, but you won't see any messages about errors with the transfer. Other than that, you'll need to find out from the sender of the note if the mail bounced back, and what kind of error it bounced back with.
For technical support for our books and software contact support@mcp.com
Copyright ©1996, Que Corporation