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]. 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>
|
---|
29 |
|
---|
30 | <para><screen><userinput>cp /etc/aliases /etc/aliases.bak
|
---|
31 | cp /etc/postfix/main.cf /etc/postfix/main.cf.bak
|
---|
32 | cp /etc/postfix/master.cf /etc/postfix/master.cf.bak
|
---|
33 | sed "s/LOGIN/[user]/" /etc/aliases.bak > /etc/aliases
|
---|
34 | sed "s/#myhostname = host.domain.tld/myhostname = \
|
---|
35 | [localhost.localdomain]/" \
|
---|
36 | /etc/postfix/main.cf.bak > /etc/postfix/main.cf
|
---|
37 | /usr/bin/newaliases
|
---|
38 | /usr/sbin/postfix start</userinput></screen></para></sect3>
|
---|
39 |
|
---|
40 | <sect3><title>postfix init.d script</title>
|
---|
41 |
|
---|
42 | <para>To automate the running of postfix, use following command to create the init.d script:</para>
|
---|
43 |
|
---|
44 | <para><screen><userinput>cat > /etc/rc.d/init.d/postfix << "EOF"</userinput>
|
---|
45 | #!/bin/sh
|
---|
46 | # Begin $rc_base/init.d/postfix
|
---|
47 |
|
---|
48 | # Based on sysklogd script from LFS-3.1 and earlier.
|
---|
49 | # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
|
---|
50 |
|
---|
51 | source /etc/sysconfig/rc
|
---|
52 | source $rc_functions
|
---|
53 |
|
---|
54 | case "$1" in
|
---|
55 |
|
---|
56 | start)
|
---|
57 | echo "Starting Postfix..."
|
---|
58 | loadproc postfix start
|
---|
59 | ;;
|
---|
60 |
|
---|
61 | stop)
|
---|
62 | echo "Stopping Postfix..."
|
---|
63 | loadproc postfix stop
|
---|
64 | ;;
|
---|
65 |
|
---|
66 | reload)
|
---|
67 | echo "Reloading Postfix..."
|
---|
68 | loadproc postfix reload
|
---|
69 | ;;
|
---|
70 |
|
---|
71 | restart)
|
---|
72 | $0 stop
|
---|
73 | sleep 1
|
---|
74 | $0 start
|
---|
75 | ;;
|
---|
76 |
|
---|
77 | *)
|
---|
78 | echo "Usage: $0 {start|stop|reload|restart}"
|
---|
79 | exit 1
|
---|
80 | ;;
|
---|
81 | esac
|
---|
82 |
|
---|
83 | # End $rc_base/init.d/postfix
|
---|
84 | <userinput>EOF
|
---|
85 | chmod 755 /etc/rc.d/init.d/postfix</userinput></screen></para>
|
---|
86 |
|
---|
87 | <para>Create the symbolic links to this file in the relevant rc.d directory with the following commands:
|
---|
88 |
|
---|
89 | <screen><userinput>cd /etc/rc.d/init.d &&
|
---|
90 | ln -sf ../init.d/postfix ../rc0.d/K25postfix &&
|
---|
91 | ln -sf ../init.d/postfix ../rc1.d/K25postfix &&
|
---|
92 | ln -sf ../init.d/postfix ../rc2.d/K25postfix &&
|
---|
93 | ln -sf ../init.d/postfix ../rc3.d/S35postfix &&
|
---|
94 | ln -sf ../init.d/postfix ../rc4.d/S35postfix &&
|
---|
95 | ln -sf ../init.d/postfix ../rc5.d/S35postfix &&
|
---|
96 | ln -sf ../init.d/postfix ../rc6.d/K25postfix</userinput></screen></para>
|
---|
97 | </sect3>
|
---|
98 |
|
---|
99 | </sect2>
|
---|