Typo
[linux_from_scratch_hints.git] / OLD / exim.txt
blob8379f89b2a86712cd61f7281f634f1a96367b32c
2 ===============================================
4 Exim Quick Installation HOWTO v1
6 Patrick Kirk                Chris Seberino 
7 <patrick@enterprise-hr.com >        < seberino@spawar.navy.mil >
9 September 6, 2001
12 ===============================================
14 Overview
15 ----------
16 Why use Exim?  Exim is a powerful mail server available under the GPL.
17 Exim is a very widely used mail server on the Internet so its
18 functionality and track record are very well known.  Installed properly,
19 Exim is very secure.  It is easy to manage which is why it is the
20 default mail server in the Debian GNU/Linux distribution.  
22 Purpose of this document
23 --------------------------
24 This is intended as a quick start that enables you to install Exim and
25 make it available to other PCs on a LAN.  If you are planning to have in
26 excess of a million messages a day, please read the documentation on 
27 scalability on www.exim.org.  But if you are installing for a company up 
28 to 500 or so mail users, or as a mail server on  a home LAN, then this 
29 setup is fine.
31 ===============================================
33 Installation and Configuration
35 1. Users, Directories and Security Settings
36 --------------------------------------------
38 Exim is run as a local user whenever it does not need the privileges of root. 
39 This reduces the chances of problems caused by errors in the code..  First 
40 we must add a user and group as well as prepare mail and log directories.
42 Choose a user ID and group ID that suits you...having them both the same
43 just makes creating security permissions a little simpler for me, hence
44 choosing 111 for both.  In this example, the username is exim.
46 First in /etc/passwd, add :
48 exim:x:111:111::/var/spool/mail:/bin/false
50 Then in /etc/group, add :
51 exim:x:111:
53 For security reasons, we don't not have exim send messages to root but
54 to the systems administrator.  Edit, or create if it isn't there,
55 /etc/aliases:
57 postmaster: root
58 root: your login name
59 abuse: your login name
62 Then execute the following commands:
64 mkdir -p /var/spool/mail &&
65 mkdir -p /var/log/exim &&
66 chown exim:exim /var/spool/mail &&
67 chown exim:adm /var/log/exim &&
68 chmod 1777 /var/spool/mail &&
69 chmod 2750 /var/log/exim
71 The && after commands means you can copy all these commands as a unit
72 and paste them into a command box, and have it execute as one neat
73 series.  Don't say we don't look after you ;-)
76 2. Dependencies
77 -----------------
79 Exim requires a database.  Most Unix/Linux/BSD sytems comes with
80 Berkeley DB installed.  Its a free highly functional database.  If you
81 are unable to compile Exim because it can't find a database, download
82 Berkeley DB from www.sleepycat.com,  and run the following command:
84 cd /usr/src/ &&
85 tar xzvf /pathtoBerkeley.tar.gz &&
86 ./configure prefix=/usr && 
87 make && 
88 make install
90 This installs Berkeley database libraries in /usr/lib which is where
91 applications, that depend on it look first.
93 3. Getting the source code
94 ----------------------------
95 The latest version of Exim is always available on http://www.exim.org/mirrors.html
97 Uncompress and untar the Exim sources as follows.
99     cd /usr/src &&
100     mkdir /etc/exim             
101     tar xvfz /path-to/exim-<version>.tar.gz.
103 4. The Makefile 
104 -----------------
106 Change to the Exim source directory. Please do take a look at README. In
107 the Exim source directory, make a directory called Local.  In Local,
108 create a file, Makefile, with the following text (you ought to be able to just paste this
109 in):
111 # Where the executable will reside
112 BIN_DIRECTORY=/usr/local/bin
114 # The run time control file.  Best keep all run-time control #files in
115 # /etc as you can then backup all your system 
116 #configuration by copying /etc/
118 CONFIGURE_FILE=/etc/exim/exim.conf
120 # If you have not followed step 1 in making this user id 111, #set this
121 # equal to output of "id -u exim".
122 EXIM_UID=111
124 # If you have not followed step 1 in making this group id #111, set this
125 # equal to output of "id -g exim".
126 EXIM_GID=111
128 # Its best just assume that these are needed even if you don't # know
129 # how you will use them.
130 DIRECTOR_LOCALUSER=yes
131 DIRECTOR_FORWARDFILE=yes
132 DIRECTOR_ALIASFILE=yes
133 DIRECTOR_SMARTUSER=yes
134 TRANSPORT_APPENDFILE=yes
135 TRANSPORT_AUTOREPLY=yes
136 TRANSPORT_PIPE=yes
137 TRANSPORT_SMTP=yes
139 # Uncomment these only if using previously installed #OpenSSL when
140 # sending email.
141 #SUPPORT_TLS=yes
142 #TLS_LIBS=-lssl -lcrypto
144 MSGLOG_DIRECTORY_MODE=0700
145 SPOOL_DIRECTORY=/var/spool/mail
146 SPOOL_DIRECTORY_MODE=07
147 SPOOL_MODE=0600
148 LOG_FILE_PATH=/var/log/exim/exim_%slog
149 LOG_DIRECTORY_MODE=0750
150 LOG_MODE=0644
151 LOOKUP_DBM=yes
152 LOOKUP_LSEARCH=yes
153 ROUTER_DOMAINLIST=yes
154 ROUTER_LOOKUPHOST=yes
155 ROUTER_IPLITERAL=yes
156 ROUTER_QUERYPROGRAM=yes
158 5. Compiling and installing
159 -----------------------------
161 Execute "make" and "make install" as root.
163 6. Enabling Exim
164 --------------------
166 For historical reasons, many programs look for /usr/lib/sendmail to send
167 mail so lets make this service available.  
168     
169     ln -s /usr/local/bin/exim /usr/lib/sendmail &&
171     ln -s /usr/local/bin/exim /usr/sbin/sendmail
173 7. Creating a secure runtime configuration
174 --------------------------------------------
176 All the functionality of Exim is controlled from /etc/exim/exim.conf
178 Edit the new /etc/exim/exim.conf and find the following entries:
180 qualify_domain =  
181 # Set this the the name that appears after the @ in your email address 
183 local_domains =
184 # Set this to locahost and the name that appears after the @ 
185 # in your email address seperated by a colon.
186 # for example localhost:enterprise-hr.com for Patrick.
188 host_accept_relay = 127.0.0.1: 
190 # Add in the range used by machines on your LAN.  If you #do not have a
191 # LAN or are unsure, don't edit this.  Example: #for a LAN with IP
192 # Address range 192.168.0.0/24, you put #that in here:  
193 # host_accept_relay = 127.0.0.1:192.168.0.0/24
195 Everything else in /etc/exim/exim.conf should just work nicely out of the
196 box.
198 Tip:
199 -----
200 Debian developers have a neat interactive script that allows you to
201 customise Exim for all kinds of environments.  If you want to use this,
202 it is available here -
203 http://hints.linuxfromscratch.org/~ian/hints/exim/eximconfig
205 Just copy the text into a file called eximconfig.  Then 
206 chmod +x eximconfig &&
207 /path_to_/eximconfig
209 It requires that you be root to run it.
211 8. Activating Exim
212 --------------------
214 To receive email anytime execute the following:
216     killall sendmail &&
217     /usr/sbin/sendmail -bd -q15m
219 Exim is now listening on port 25 for mail from the machine itself or
220 from the address range you specified in /etc/exim/exim.conf
222 9. Housekeeping
223 -----------------
225 Add this file to /etc/init.d to enable the SysV type start|stop|restart commands.
227 #!/bin/sh
228 # Begin /etc/init.d/exim
231 # Include the functions declared in the /etc/init.d/functions file
234 source /etc/init.d/functions
236 case "$1" in
237         start)
238                 echo -n "Starting SMTP daemon: Exim"
239                 loadproc /usr/local/bin/exim -bd
240                 ;;
242         stop)
243                 echo -n "Stopping SMTP daemon: Exim"
244                 killproc /usr/local/bin/exim
245                 ;;
247         reload)
248                 echo -n "Reloading SMTP daemon: Exim"
249                 reloadproc /usr/local/bin/exim -HUD
250                ;;
252         restart)
253                 $0 stop
254                 /usr/bin/sleep 1
255                 $0 start
256                 ;;
258         status)
259                 statusproc /usr/local/bin/exim
260                 ;;
262         *)
263                 echo "Usage: $0 {start|stop|reload|restart|status}"
264                 exit 1
265         ;;
267 esac
269 # End /etc/init.d/exim
271 Execute this comand to have Exim start on boot.
273 chmod 754 /etc/init.d/exim &&
275 ln -s  ../init.d/exim /etc/rc0.d/K400exim &&
277 ln -s  ../init.d/exim /etc/rc1.d/K400exim &&
279 ln -s  ../init.d/exim /etc/rc2.d/K400exim &&
281 ln -s  ../init.d/exim /etc/rc3.d/S600exim &&
283 ln -s  ../init.d/exim /etc/rc4.d/S600exim &&
285 ln -s  ../init.d/exim /etc/rc5.d/S600exim &&
287 ln -s  ../init.d/exim /etc/rc6.d/K400exim
289 10. Congratulations!  
290 ----------------------
292 You now have a secure mail server at your disposal.  For more help or
293 details, please refer to: www.exim.org, the Exim mailing list
294 (accessible from www.exim.org) or "Exim, The Mail Transfer Agent" by
295 Philip Hazel and published by O'Reilly.