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