glfs/server/mail/postfix/postfix-config.xml
Igor Živković 8101388646 postfix corrections
git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@1797 af4574ff-66df-0310-9fd7-8a98e5e911e0
2004-02-10 21:43:55 +00:00

121 lines
3.8 KiB
XML

<sect2>
<title>Configuring <application>Postfix</application></title>
<sect3><title>Config files</title>
<para><filename>/etc/aliases</filename>,
<filename>/etc/postfix/main.cf</filename> and
<filename>/etc/postfix/master.cf</filename></para>
</sect3>
<sect3><title>Configuration Information</title>
<screen><userinput><command>cat &gt; /etc/aliases &lt;&lt; "EOF"</command>
# Begin /etc/aliases
MAILER-DAEMON: postmaster
postmaster: root
root: LOGIN
# End /etc/aliases
<command>EOF</command></userinput></screen>
<para>The <filename>/etc/aliases</filename> file that was just created,
the <filename>main.cf</filename> and the <filename>master.cf</filename>
must be personalized for your system. The <filename>aliases</filename> file
needs your non-root login identity so mail addressed to root can be forwarded
to you at the user level. The <filename>main.cf</filename> file needs your
fully qualified hostname. All of these edits can be done with sed commands
entered into the console with appropriate substitutions of your non-root
login name for <replaceable>[user]</replaceable> and your fully qualified
hostname for <replaceable>[localhost.localdomain]</replaceable>. You will
find the <filename>main.cf</filename> file
is self documenting, so load it into your editor to make the changes you need
for your situation.</para>
<screen><userinput><command>cp /etc/aliases /etc/aliases.bak &amp;&amp;
cp /etc/postfix/main.cf /etc/postfix/main.cf.bak &amp;&amp;
cp /etc/postfix/master.cf /etc/postfix/master.cf.bak &amp;&amp;
sed "s/LOGIN/<replaceable>[user]</replaceable>/" /etc/aliases.bak > /etc/aliases &amp;&amp;
sed "s/#myhostname = host.domain.tld/myhostname = \
<replaceable>[localhost.localdomain]</replaceable>/" \
/etc/postfix/main.cf.bak > /etc/postfix/main.cf &amp;&amp;
/usr/bin/newaliases &amp;&amp;
/usr/sbin/postfix start</command></userinput></screen></sect3>
<sect3><title>Postfix init.d script</title>
<para>To automate the running of Postfix, use following command to create the init.d script:</para>
<screen><userinput><command>cat &gt; /etc/rc.d/init.d/postfix &lt;&lt; "EOF"</command>
#!/bin/sh
# Begin $rc_base/init.d/postfix
# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
. /etc/sysconfig/rc
. $rc_functions
case "$1" in
start)
echo "Starting Postfix..."
loadproc postfix start
;;
stop)
echo "Stopping Postfix..."
loadproc postfix stop
;;
reload)
echo "Reloading Postfix..."
loadproc postfix reload
;;
abort)
echo "Aborting Postfix..."
loadproc postfix abort
;;
flush)
echo "Flushing Postfix..."
loadproc postfix flush
;;
check)
echo "Checking Postfix..."
loadproc postfix check
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|reload|abort|flush|check|restart}"
exit 1
;;
esac
# End $rc_base/init.d/postfix
<command>EOF
chmod 755 /etc/rc.d/init.d/postfix</command></userinput></screen>
<para>Create the symbolic links to this file in the relevant
<filename>rc.d</filename> directory with the following commands:</para>
<screen><userinput><command>cd /etc/rc.d/init.d &amp;&amp;
ln -sf ../init.d/postfix ../rc0.d/K25postfix &amp;&amp;
ln -sf ../init.d/postfix ../rc1.d/K25postfix &amp;&amp;
ln -sf ../init.d/postfix ../rc2.d/K25postfix &amp;&amp;
ln -sf ../init.d/postfix ../rc3.d/S35postfix &amp;&amp;
ln -sf ../init.d/postfix ../rc4.d/S35postfix &amp;&amp;
ln -sf ../init.d/postfix ../rc5.d/S35postfix &amp;&amp;
ln -sf ../init.d/postfix ../rc6.d/K25postfix</command></userinput></screen>
</sect3>
</sect2>