[f45b1953] | 1 | <sect2>
|
---|
| 2 | <title>Configuring postfix</title>
|
---|
| 3 |
|
---|
| 4 | <sect3><title>Config files</title>
|
---|
[e80cc95] | 5 | <para><filename>/etc/aliases</filename>,
|
---|
| 6 | <filename>/etc/postfix/main.cf</filename> and
|
---|
| 7 | <filename>/etc/postfix/master.cf</filename></para>
|
---|
[f45b1953] | 8 | </sect3>
|
---|
| 9 |
|
---|
| 10 | <sect3><title>Configuration Information</title>
|
---|
| 11 |
|
---|
[896104b1] | 12 | <para><screen><userinput>cat > /etc/aliases << "EOF"</userinput>
|
---|
[f45b1953] | 13 | # Begin /etc/aliases
|
---|
| 14 |
|
---|
| 15 | MAILER-DAEMON: postmaster
|
---|
| 16 | postmaster: root
|
---|
| 17 |
|
---|
| 18 | root: LOGIN
|
---|
| 19 | # End /etc/aliases
|
---|
| 20 | <userinput>EOF</userinput></screen></para>
|
---|
| 21 |
|
---|
| 22 | <para>The /etc/aliases file that was just created, the main.cf and the
|
---|
| 23 | master.cf must be personalized for your system. The aliases file needs your
|
---|
| 24 | non-root login identity so mail addressed to root can be forwarded to
|
---|
| 25 | you at the user level. The main.cf file needs your fully qualified
|
---|
| 26 | hostname. The master.cf needs to be modified to prevent your machine from
|
---|
| 27 | becoming a relay for unauthorized entities. All of these edits can be done
|
---|
| 28 | with sed commands entered into the console with appropriate substitutions of
|
---|
| 29 | your non-root login name for [user] and your fully qualified hostname for
|
---|
[0566707b] | 30 | [localhost.localdomain]. You will find the main.cf file is self documenting, so load it into your editor to make the changes you need for your situation.</para>
|
---|
[f45b1953] | 31 |
|
---|
| 32 | <para><screen><userinput>cp /etc/aliases /etc/aliases.bak
|
---|
| 33 | cp /etc/postfix/main.cf /etc/postfix/main.cf.bak
|
---|
| 34 | cp /etc/postfix/master.cf /etc/postfix/master.cf.bak
|
---|
| 35 | sed "s/LOGIN/[user]/" /etc/aliases.bak > /etc/aliases
|
---|
| 36 | sed "s/#myhostname = host.domain.tld/myhostname = \
|
---|
| 37 | [localhost.localdomain]/" \
|
---|
| 38 | /etc/postfix/main.cf.bak > /etc/postfix/main.cf
|
---|
| 39 | /usr/bin/newaliases
|
---|
| 40 | /usr/sbin/postfix start</userinput></screen></para></sect3>
|
---|
| 41 |
|
---|
| 42 | <sect3><title>postfix init.d script</title>
|
---|
| 43 |
|
---|
| 44 | <para>To automate the running of postfix, use following command to create the init.d script:</para>
|
---|
| 45 |
|
---|
| 46 | <para><screen><userinput>cat > /etc/rc.d/init.d/postfix << "EOF"</userinput>
|
---|
| 47 | #!/bin/sh
|
---|
| 48 | # Begin $rc_base/init.d/postfix
|
---|
| 49 |
|
---|
| 50 | # Based on sysklogd script from LFS-3.1 and earlier.
|
---|
| 51 | # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
|
---|
| 52 |
|
---|
| 53 | source /etc/sysconfig/rc
|
---|
| 54 | source $rc_functions
|
---|
| 55 |
|
---|
| 56 | case "$1" in
|
---|
| 57 |
|
---|
| 58 | start)
|
---|
[086c6c6e] | 59 | echo "Starting Postfix..."
|
---|
[f45b1953] | 60 | loadproc postfix start
|
---|
| 61 | ;;
|
---|
| 62 |
|
---|
| 63 | stop)
|
---|
[086c6c6e] | 64 | echo "Stopping Postfix..."
|
---|
[f45b1953] | 65 | loadproc postfix stop
|
---|
| 66 | ;;
|
---|
| 67 |
|
---|
| 68 | reload)
|
---|
[086c6c6e] | 69 | echo "Reloading Postfix..."
|
---|
[f45b1953] | 70 | loadproc postfix reload
|
---|
| 71 | ;;
|
---|
| 72 |
|
---|
| 73 | restart)
|
---|
| 74 | $0 stop
|
---|
| 75 | sleep 1
|
---|
| 76 | $0 start
|
---|
| 77 | ;;
|
---|
| 78 |
|
---|
| 79 | *)
|
---|
| 80 | echo "Usage: $0 {start|stop|reload|restart}"
|
---|
| 81 | exit 1
|
---|
| 82 | ;;
|
---|
| 83 | esac
|
---|
| 84 |
|
---|
| 85 | # End $rc_base/init.d/postfix
|
---|
| 86 | <userinput>EOF
|
---|
| 87 | chmod 755 /etc/rc.d/init.d/postfix</userinput></screen></para>
|
---|
| 88 |
|
---|
| 89 | <para>Create the symbolic links to this file in the relevant rc.d directory with the following commands:
|
---|
| 90 |
|
---|
| 91 | <screen><userinput>cd /etc/rc.d/init.d &&
|
---|
| 92 | ln -sf ../init.d/postfix ../rc0.d/K25postfix &&
|
---|
| 93 | ln -sf ../init.d/postfix ../rc1.d/K25postfix &&
|
---|
| 94 | ln -sf ../init.d/postfix ../rc2.d/K25postfix &&
|
---|
| 95 | ln -sf ../init.d/postfix ../rc3.d/S35postfix &&
|
---|
| 96 | ln -sf ../init.d/postfix ../rc4.d/S35postfix &&
|
---|
| 97 | ln -sf ../init.d/postfix ../rc5.d/S35postfix &&
|
---|
| 98 | ln -sf ../init.d/postfix ../rc6.d/K25postfix</userinput></screen></para>
|
---|
| 99 | </sect3>
|
---|
| 100 |
|
---|
| 101 | </sect2>
|
---|