Easy Steps to Install our beloved exim-4.63 daemon A sample step on installing exim on a debian box, installation will vary on different box make sure there's smtp at /etc/services: ------------------------- root@mywisdom-Vostro1310:/# cat /etc/services | grep smtp smtp 25/tcp # Simple Mail Transfer Protocol ssmtp 465/tcp smtps # SMTP over SSL -------------------------- to run in daemon mode we need it on /etc/inetd.conf to install inetd: ---------------- apt-get install openbsd-inetd ----------------- root@mywisdom-Vostro1310:/# cat /etc/inetd.conf | grep exim smtp stream tcp nowait root /usr/sbin/exim in.exim -bs add this line to inetd.conf: --------------------------------- smtp stream tcp nowait root /usr/sbin/exim in.exim -bs -------------------------------- preparing db-devel -------------------------------------- su - apt-get install libdb4.8-dev libperl-dev libsasl2-dev yum install db4-devel cyrus-sasl-devel apt-get install libssl-dev ---------------------------------- download and install pcre: here i use pcre 8.01 ------------------------------------ wget http://ftp.exim.llorien.org/pcre/pcre-8.01.tar.gz tar zxvf pcre-8.01.tar.gz;./configure;make;make install ------------------------------------ wget http://exim-ftp.itsoft.at/exim/exim4/exim-4.63.tar.gz tar zxvf exim-4.63.tar.gz -------------------- before compiling the source, go to exim-4.63/src and edit this file :tls-openssl.c find this code and comment it!!! -------------------- if (!(SSL_CTX_set_info_callback(ctx, (void (*)())info_callback))) return tls_error(US"SSL_CTX_set_info_callback", host); ------------------------ becomes: ---------------------- /**if (!(SSL_CTX_set_info_callback(ctx, (void (*)())info_callback))) return tls_error(US"SSL_CTX_set_info_callback", host);**/ ---------------------- add group and user exim --------------------------- groupadd -g 31 exim && useradd -d /dev/null -c "Exim Daemon" -g exim -s /bin/false -u 31 exim ------------------------------ build: ------------------------ echo "PERL_CC=`/usr/bin/perl -MConfig -e 'print $Config{cc}'`" cd exim-4.63/Local perl -pi -e 's/^EXTRALIBS/#EXTRALIBS/' Makefile perl -pi -e 's/HAVE_ICONV=yes/HAVE_ICONV=no/' Makefile cd .. ----------------- use this to prepare build exim with some directives: ----------------------------- sed -e 's,^BIN_DIR.*$,BIN_DIRECTORY=/usr/sbin,' \ -e 's,^CONF.*$,CONFIGURE_FILE=/etc/exim.conf,' \ -e 's,^EXIM_USER.*$,EXIM_USER=exim,' \ -e 's,^EXIM_MONITOR,#EXIM_MONITOR,' src/EDITME > Local/Makefile && make make install && install -v -m644 doc/exim.8 /usr/share/man/man8 && install -v -d -m755 /usr/share/doc/exim-4.67 && install -v -m644 doc/* /usr/share/doc/exim-4.67 && ln -sv exim /usr/sbin/sendmail ------------------------------------- a simple exim4 shell script at /etc/init.d taken from exim4.72 put it at /etc/init.d: root@mywisdom-Vostro1310:/home/mywisdom/exim-4.63# cat /etc/init.d/exim4 --------------------- #! /bin/sh # /etc/init.d/exim4 # # Written by Miquel van Smoorenburg . # Modified for Debian GNU/Linux by Ian Murdock . # Modified for exim by Tim Cutts # Modified for exim4 by Andreas Metzler # and Marc Haber ### BEGIN INIT INFO # Provides: exim4 # Required-Start: $remote_fs $syslog $named $network $time # Required-Stop: $remote_fs $syslog $named $network # Should-Start: postgresql mysql clamav-daemon greylist spamassassin # Should-Stop: postgresql mysql clamav-daemon greylist spamassassin # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: exim Mail Transport Agent # Description: exim is a Mail Transport agent ### END INIT INFO set -e test -x /usr/lib/exim4/exim4 || exit 0 . /lib/lsb/init-functions if [ -n "$EX4DEBUG" ]; then echo "now debugging $0 $@" set -x fi LANG=C export LANG #read default file QUEUERUNNER='combined' QUEUEINTERVAL='30m' UPEX4OPTS='' PIDFILE="/var/run/exim4/exim.pid" QRPIDFILE="/var/run/exim4/eximqr.pid" [ -f /etc/default/exim4 ] && . /etc/default/exim4 upex4conf() { UPEX4CONF="update-exim4.conf" OLDIFS="$IFS" IFS=: for p in $PATH; do if [ -x "$p/$UPEX4CONF" ]; then IFS="$OLDIFS" $p/$UPEX4CONF $UPEX4OPTS return 0 fi done IFS="$OLDIFS" } # Exit if exim runs from /etc/inetd.conf if [ -f /etc/inetd.conf ] && grep -E -q '^[[:space:]]*((\*|[[:alnum:].-]+):)?smtp[[:space:]]' /etc/inetd.conf then upex4conf exit 0 fi DAEMON="/usr/sbin/exim4" NAME="exim4" # this is from madduck on IRC, 2006-07-06 # There should be a better possibility to give daemon error messages # and/or to log things log() { case "$1" in [[:digit:]]*) success=$1; shift;; *) :;; esac log_action_begin_msg "$1"; shift log_action_end_msg ${success:-0} "$*" } start_exim() { [ -e /var/run/exim4 ] || \ install -d -oDebian-exim -gDebian-exim -m750 /var/run/exim4 case ${QUEUERUNNER} in combined) start_daemon -p "$PIDFILE" \ "$DAEMON" -bd "-q${QFLAGS}${QUEUEINTERVAL}" \ ${COMMONOPTIONS} \ ${QUEUERUNNEROPTIONS} \ ${SMTPLISTENEROPTIONS} log_progress_msg "exim4" ;; separate) start_daemon -p "$PIDFILE" \ "$DAEMON" -bd \ ${COMMONOPTIONS} \ ${SMTPLISTENEROPTIONS} log_progress_msg "exim4_listener" start_daemon -p "$QRPIDFILE" \ "$DAEMON" -oP $QRPIDFILE \ "-q${QFLAGS}${QUEUEINTERVAL}" \ ${COMMONOPTIONS} \ ${QUEUERUNNEROPTIONS} log_progress_msg "exim4_queuerunner" ;; queueonly) start_daemon -p "$QRPIDFILE" \ "$DAEMON" -oP $QRPIDFILE \ "-q${QFLAGS}${QUEUEINTERVAL}" \ ${COMMONOPTIONS} \ ${QUEUERUNNEROPTIONS} log_progress_msg "exim4_queuerunner" ;; no|ppp) start_daemon -p "$PIDFILE" \ "$DAEMON" -bd \ ${COMMONOPTIONS} \ ${SMTPLISTENEROPTIONS} log_progress_msg "exim4_listener" ;; nodaemon) ;; esac } stop_exim() { # we try to kill eximqr and exim SMTP listener, no matter what # ${QUEUERUNNER} is set to, we could have switched since starting. if [ -f "$QRPIDFILE" ]; then killproc -p "$QRPIDFILE" "$DAEMON" log_progress_msg "exim4_queuerunner" fi if [ -f "$PIDFILE" ]; then killproc -p "$PIDFILE" "$DAEMON" log_progress_msg "exim4_listener" fi } reload_exim() { case ${QUEUERUNNER} in combined|no|ppp) killproc -p "$PIDFILE" "$DAEMON" -HUP log_progress_msg "exim4" ;; separate) killproc -p "$PIDFILE" "$DAEMON" -HUP log_progress_msg "exim4_listener" killproc -p "$QRPIDFILE" "$DAEMON" -HUP log_progress_msg "exim4_queuerunner" ;; esac } kill_all_exims() { SIG="${1:-TERM}" for pid in $(pidof $NAME); do if [ "$(readlink /proc/$pid/root)" = "/" ]; then kill -$SIG $pid fi done } status() { # the exit value of this function reflects the status of the SMTP # service. Output shows the status of the queue runner as well. SMTPNAME="SMTP listener daemon" QRNAME="separate queue runner daemon" if [ "${QUEUERUNNER}" = "combined" ]; then SMTPNAME="combined SMTP listener and queue runner daemon" fi log_action_begin_msg "checking $QRNAME" if pidofproc -p "$QRPIDFILE" >/dev/null; then log_action_end_msg 0 "running" else if [ -e "$QRPIDFILE" ]; then log_action_end_msg 1 "$QRNAME failed" else log_action_end_msg 0 "not running" fi fi log_action_begin_msg "checking $SMTPNAME" if pidofproc -p "$PIDFILE" >/dev/null; then log_action_end_msg 0 "running" exit 0 else if [ -e "$PIDFILE" ]; then log_action_end_msg 1 "$SMTPNAME failed" exit 1 else log_action_end_msg 0 "not running" exit 3 fi fi } # check for valid configuration file isconfigvalid() { if ! $DAEMON -bV > /dev/null ; then log 1 "Warning! Invalid configuration file for $NAME. Exiting." exit 1 fi } # check for non-empty paniclog warn_paniclog() { if [ -s "/var/log/exim4/paniclog" ]; then if [ -z "$E4BCD_PANICLOG_NOISE" ] || grep -vq "$E4BCD_PANICLOG_NOISE" /var/log/exim4/paniclog; then log_failure_msg "ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken" fi fi } case "$1" in start) log_daemon_msg "Starting MTA" # regenerate exim4.conf upex4conf isconfigvalid start_exim log_end_msg 0 warn_paniclog ;; stop) log_daemon_msg "Stopping MTA" stop_exim log_end_msg 0 warn_paniclog ;; restart) log_daemon_msg "Stopping MTA for restart" # regenerate exim4.conf upex4conf isconfigvalid stop_exim log_end_msg 0 sleep 2 log_daemon_msg "Restarting MTA" start_exim log_end_msg 0 warn_paniclog ;; reload|force-reload) log_daemon_msg "Reloading $NAME configuration files" # regenerate exim4.conf upex4conf isconfigvalid reload_exim log_end_msg 0 warn_paniclog ;; status) status ;; what) exiwhat ;; force-stop) kill_all_exims $2 ;; *) echo "Usage: $0 {start|stop|restart|reload|status|what|force-stop}" exit 1 ;; esac exit 0 # vim:tabstop=2:expandtab:shiftwidth=2 ---------- then we're ready to start our exim4-63 --------------- /etc/init.d/exim4 start ----------------- checking daemon banner as easy as kicking ass: ---------------- root@mywisdom-Vostro1310:/home/mywisdom/exim-4.63# nc localhost 25 220 mywisdom-Vostro1310 ESMTP Exim 4.63 Fri, 31 Dec 2010 00:57:02 +0700