Article

Fire Up your own Linux Server

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Next

Sending Email

By default, mail on Fedora Core 4 is handled by the sendmail program. sendmail can be configured to perform very complicated tasks, like running all the email for a company or an ISP. Entire books can (and have) been written about it. However, you're unlikely to want to make your LAMP server double as your mail server, and you're already likely to have a mail server. Some services on your LAMP server will generate email; for example, if a cron job fails, it will often email a description of its error to root@localhost, the root user's account's mailbox. That mail needs to be read, sometimes urgently, and it would be a pain to have to log in to your server to do so. The best approach is to ensure that all mail that goes to your Web server is sent to an address at which the system administrator can read it. We'll set up the Web server so that all the mail it receives is forwarded automatically to another email address.

The aliases File

Mail direction is controlled by the file /etc/aliases, which is shown below.

Example 4.11. /etc/aliases

#              
#  Aliases in this file will NOT be expanded in the header from              
#  Mail, but WILL be visible over networks or from /bin/mail.              
#              
#       >>>>>>>>>>      The program "newaliases" must be run after              
#       >> NOTE >>      this file is updated for any changes to              
#       >>>>>>>>>>      show through to sendmail.              
#              
             
# Basic system aliases -- these MUST be present.              
mailer-daemon:  postmaster              
postmaster:     root              
             
# General redirections for pseudo accounts.              
bin:            root              
daemon:         root              
adm:            root              
…              
marketing:      postmaster              
sales:          postmaster              
support:        postmaster              
             
             
# trap decode to catch security attacks              
decode:         root              
             
# Person who should get root's mail              
#root:          marc

Each line in this file is an email alias; the line postmaster: root means "if mail comes to the postmaster account, put it in root's mailbox." By default, Fedora's aliases file ensures that mail for all the "system" accounts on the machine (i.e., all the accounts that the computer creates, rather than the ones that you create) goes to root's mailbox. This is very useful, because then, all you have to do is ensure that the mail that's sent to root ends up in the administrator's mailbox. This is a two-step process. First, record in the aliases file that root's mail should go to the administrator's mailbox. To do so, uncomment the last line in /etc/aliases, and change marc to the administrator's email address.

Example 4.12. /etc/aliases (excerpt)

# Person who should get root's mail              
root:          kermit@myisp.net

Second, tell sendmail that the aliases file has changed by running the command newaliases:

[kermit@swinetrek ~]$ su              
Password:              
[root@swinetrek kermit]# newaliases              
/etc/aliases: 77 aliases, longest 16 bytes, 785 bytes total              
[root@swinetrek kermit]# exit              
exit              
[kermit@swinetrek ~]$

That's all that's required. From now on, any mail that's sent to root by any cron jobs (or similar) on your Web server will end up in your mailbox. If you've created additional accounts on your server (say, for individual system administrators), then you may wish also to add those accounts to /etc/aliases, making them forward their mail to root or other email addresses. Remember to run newaliases after you make the change.

Example 4.13. /etc/aliases (excerpt)

# Person who should get root's mail              
root:          kermit@myisp.net              
kermit:        root              
gonzo:         gonzo@myisp.net              
fozzie:        fozzie@myisp.net

Other Services

As you might expect, your Fedora Core system installs with a full set of graphical tools to ease the administration of various services on the system. There are too many tools to cover in depth here; instead, we'll look at the tools you'll use most frequently to configure and maintain both your system and the services it provides.

Preferences vs Settings

In Linux, the general convention is to call user-specific options "preferences." Those that affect the whole system are called "settings."

Samba

Samba allows you to share directories and printers with other machines. Typically, these machines are Windows machines, though they don't have to be. To start up the Samba Server Configuration tool shown in Figure 4.16, select Desktop > System Settings > Server Settings > Samba.

Figure 4.16. The Samba Server Configuration tool.
1505_4.16

To share a directory on your Linux server with others, click the Add Share button. The dialog shown in Figure 4.17, "The Create Samba Share dialog." will display.

Figure 4.17. The Create Samba Share dialog.
1505_4.17

The main Samba Configuration window displays a list of all the shares you've defined. By highlighting a share, you can glean more information about it; you can adjust its settings by clicking on the Properties button.

NFS

NFS, or Network File System, is the Linux-native equivalent to Samba. It allows client machines to mount parts of your machine's filesystem as if they were other devices.

The interface for the NFS configuration (accessible via Desktop > System Settings > Server Settings > NFS) is much the same as that provided for Samba configuration. The directory, the allowed hosts, and the permissions are all displayed in the main window. You can add or delete a share and, as with the Samba configuration, check and alter the properties of existing shares.

Mounting NFS Shares
You can mount NFS shares quickly and easily using the mount command. Instead of specifying a device file, such as /dev/fd0, you simply specify a server name and the name of the shared directory, separated by a colon.

[root@swinetrek kermit]# mkdir /mnt/kermit-oldserver              
[root@swinetrek kermit]# mount oldserver:/home/kermit \              
> /mnt/kermit-oldserver              
[root@swinetrek kermit]#

Apache Web Server

The Server Settings menu includes an HTTP option, which launches the graphical tool shown in Figure 4.18, "The graphical HTTP configuration tool.", allowing you to configure your Apache server.

Figure 4.18. The graphical HTTP configuration tool.
1505_4.18

We won't dig too deeply into the configuration tool here: we'll cover it in depth in Chapter 5, Building The Server. However, you can see that nearly every configuration option for your Apache server is available in this window.

If you liked this article, share the love:
Print-Friendly Version Suggest an Article

Sponsored Links