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