mirror of
https://github.com/Zeckmathederg/glfs.git
synced 2025-01-25 07:42:13 +08:00
8101388646
git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@1797 af4574ff-66df-0310-9fd7-8a98e5e911e0
121 lines
3.8 KiB
XML
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 > /etc/aliases << "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 &&
|
|
cp /etc/postfix/main.cf /etc/postfix/main.cf.bak &&
|
|
cp /etc/postfix/master.cf /etc/postfix/master.cf.bak &&
|
|
sed "s/LOGIN/<replaceable>[user]</replaceable>/" /etc/aliases.bak > /etc/aliases &&
|
|
sed "s/#myhostname = host.domain.tld/myhostname = \
|
|
<replaceable>[localhost.localdomain]</replaceable>/" \
|
|
/etc/postfix/main.cf.bak > /etc/postfix/main.cf &&
|
|
/usr/bin/newaliases &&
|
|
/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 > /etc/rc.d/init.d/postfix << "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 &&
|
|
ln -sf ../init.d/postfix ../rc0.d/K25postfix &&
|
|
ln -sf ../init.d/postfix ../rc1.d/K25postfix &&
|
|
ln -sf ../init.d/postfix ../rc2.d/K25postfix &&
|
|
ln -sf ../init.d/postfix ../rc3.d/S35postfix &&
|
|
ln -sf ../init.d/postfix ../rc4.d/S35postfix &&
|
|
ln -sf ../init.d/postfix ../rc5.d/S35postfix &&
|
|
ln -sf ../init.d/postfix ../rc6.d/K25postfix</command></userinput></screen>
|
|
</sect3>
|
|
|
|
</sect2>
|