Installing Postfix


Postfix is a fast, secure replacement for Sendmail. Although it shares several standard Sendmail configuration files (such as the /etc/aliases file), it was designed for maximum security in a modern email environment (that is, one filled with spam, viruses, attacks against the server software, and so on).

Our goal in this section is to replace Sendmail completely. Consult the Postfix documentation for information about using Postfix for sending mail without touching your existing Sendmail installation, or for using Postfix with a virtual host, also without modifying an existing Sendmail setup.

Postfix is the default Unix mailer on Mac OS X systems, so Mac users can skip this section.

To install Postfix (Fedora Core)

We'll install Postfix (Code Listing 8.3) from the source for that freshly brewed flavor.

1.

Use your favorite Web browser to visit the Postfix download page (www.postfix.org/download.html).

2.

Click the link for a mirror that's close to you. You can't choose wrong on the download page.

3.

Download the latest official release ("2.1 patchlevel 5" as of this writing) and save the file.

4.

tar -xzf postfix-2.1.5.tar.gz

Unpack the Postfix source code. This creates a postfix-2.1.5 directory.

5.

cd postfix-2.1.5

Change to the Postfix source directory.

6.

make

Build Postfix from the source code.

Code listing 8.3. Installing Postfix on Fedora Core.
 [chrish@dhcppc1 ~] tar -xzf postfix-2.1.5.tar.gz [chrish@dhcppc1 ~] cd postfix-2.1.5 [chrish@dhcppc1 postfix-2.1.5] make ... [chrish@dhcppc1 postfix-2.1.5] su - Password: [root@dhcppc1 postfix-2.1.5] groupadd -r postfix [root@dhcppc1 postfix-2.1.5] groupadd -r postdrop [root@dhcppc1 postfix-2.1.5] useradd -g postfix -G mail -M -n -r -s /bin/false postfix [root@dhcppc1 postfix-2.1.5] make install ... [root@dhcppc1 postfix-2.1.5] echo postfix: root >> /etc/aliases [root@dhcppc1 postfix-2.1.5] newaliases [root@dhcppc1 postfix-2.1.5] cd /etc/rc.d/init.d [root@dhcppc1 init.d] ln -s /usr/sbin/postfix postfix [root@dhcppc1 init.d] cd /etc/rc.d/rc5.d [root@dhcppc1 rc5.d] ln -s /etc/rc.d/init.d/postfix S63postfix [root@dhcppc1 rc5.d] service sendmail stop Shutting down sendmail:              [OK] [root@dhcppc1 rc5.d] chkconfig --del sendmail [root@dhcppc1 rc5.d] postfix start postfix/postfix-script: starting the Postfix mail system 

7.

su -

The rest of the configuration commands need to be done as root, so we'll use the su command to become root.

8.

groupadd -r postfix

Create a new system group named postfix for our Postfix installation.

9.

groupadd -r postdrop

Create a new system group named postdrop.

10.

useradd -g postfix -G mail -M -n -r -s /bin/false postfix

Use the useradd command to create a new user named postfix. The -g option puts it in the postfix group, and the-G option puts it in the mail groups, too. The -n option means this user has no home directory, and the -s option specifies /bin/false as a shell. (That stops people from being able to log in as this user.)

11.

make install

Install our fresh new Postfix.

You will be prompted for several Postfix configuration options; press Enter for each one to go with the default.

12.

echo postfix: root >> /etc/aliases

Add an alias for the postfix address to the "aliases" file.

13.

newaliases

Rebuild the alias database.

14.

cd /etc/rc.d/init.d

Change to the system-startup-script directory.

15.

ln -s /usr/sbin/postfix postfix

Create a symbolic link to the postfix control program.

16.

cd /etc/rc.d/rc5.d

Change to the run level 5 startup-script directory.

17.

ln -s /etc/rc.d/init.d/postfix S63postfix

Create a symbolic link to start Postfix during the boot process.

18.

service sendmail stop

Stop the Sendmail service.

19.

chkconfig --del sendmail

Remove Sendmail from the list of services to start at boot time.

20.

postfix start

Start the Postfix daemon.

Tips

  • You can use up2date to install Postfix from a binary package:

     up2date --install postfix 

  • If you specifically select Postfix as your mail system while installing Fedora Core, Sendmail won't be installed at all.


Code listing 8.4. Installing Postfix on FreeBSD.
 bsd# cd /usr/ports/mail/postfix bsd# make install clean ... bsd# vi /etc/rc.conf ... bsd# cd /usr/local/etc/rc.d bsd# ln -s /usr/local/sbin/postfix postfix.sh bsd# vi /etc/periodic.conf ... bsd# /etc/rc.d/sendmail stop bsd# /usr/local/etc/rc.d/postfix.sh start postfix/postfix-script: starting the Postfix mail system bsd# 

To install Postfix (FreeBSD)

We install Postfix (Code Listing 8.4) from the ports collection on FreeBSD.

1.

Log in as root or use su to become root.

2.

cd /usr/ports/mail/postfix

Change to the Postfix directory in the ports collection.

3.

make install clean

We're going to build Postfix, install it, and then clean up.

The ports build process displays the "Postfix configuration options" dialog (Figure 8.1).

Figure 8.1. The "Postfix configuration options" dialog appears during installion of Postfix on FreeBSD.


4.

None of the options are required for a basic installation; if you're setting up a more complex authentication scheme, refer to the Postfix documentation.

Press Tab to move your cursor to the OK button in the "Postfix configuration options" dialog, and then press Enter to continue with the build process.

5.

During installation, Postfix will create two new groups (postfix and maildrop) and a new user (postfix). You will also be prompted to add the postfix user to the mail group.

Press Y, then press Enter to add the postfix user to the mail group.

6.

When prompted to activate Postfix in /etc/mail/mailer.conf, press Y, then press Enter to continue. This replaces the existing Sendmail with our new Postfix.

7.

Using your favorite text editor, edit /etc/rc.conf and add the following line:

 sendmail_enable="NO" 

This prevents Sendmail from starting during the boot process.

8.

cd /usr/local/etc/rc.d

Change to the local rc.d directory.

9.

ln -s /usr/local/sbin/postfix postfix.sh

Create a symbolic link from the postfix command to postfix.sh in the local rc.d directory. This lets Postfix start during the boot process.

10.

Use your favorite text editor to edit (or create) the /etc/periodic.conf file so that it includes the following lines:

 daily_clean_hoststat_enable="NO" daily_status_mail_rejects_enable  ="NO" daily_status_include_submit_mailq  ="NO" daily_submit_queuerun="NO" 

These are all Sendmail-related daily cleanup tasks that aren't necessary with Postfix.

11.

/etc/rc.d/sendmail stop

Stop the running Sendmail daemon.

12.

/usr/local/etc/rc.d/postfix.sh start

Start the new Postfix daemon.



    Unix Advanced. Visual QuickPro Guide
    Unix Advanced: Visual QuickPro Guide
    ISBN: 0321205499
    EAN: 2147483647
    Year: 2003
    Pages: 116

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net