qmail インストール
qmailのインストール
qmail
qmailインストール
sendmailの停止
sendmailがインストールされている場合はsendmailを停止させます。# /etc/init.d/sendmail stop
sendmail を停止中: [ OK ]
sm-client を停止中: [ OK ]
# chkconfig sendmail off
# chkconfig --list sendmail
sendmail 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# mv sendmail.sendmail sendmail.sendmail.bak
# chmod 0 sendmail.sendmail.bak
# ls -la sendmail.sendmail.bak
---------- 1 root smmsp 732356 9月 1 2004 sendmail.sendmail.bak
インストールディレクトリの作成
# mkdir /var/qmail
# chmod 755 /var/qmail/
グループとユーザの作成
uidは既存のユーザと重複しないものであれば何でもよいです。# groupadd -g 500 nofiles
# groupadd -g 501 qmail
# useradd -u 500 -g nofiles -d /var/qmail/alias \
-m -k /dev/null -s /sbin/nologin alias
# useradd -u 501 -g nofiles -d /var/qmail -m -k /dev/null -s /sbin/nologin qmaild
# useradd -u 502 -g nofiles -d /var/qmail -m -k /dev/null -s /sbin/nologin qmaill
# useradd -u 503 -g nofiles -d /var/qmail -m -k /dev/null -s /sbin/nologin qmailp
# useradd -u 504 -g qmail -d /var/qmail -m -k /dev/null -s /sbin/nologin qmailq
# useradd -u 505 -g qmail -d /var/qmail -m -k /dev/null -s /sbin/nologin qmailr
# useradd -u 506 -g qmail -d /var/qmail -m -k /dev/null -s /sbin/nologin qmails
解凍と展開
qmail-1.03.errno.patch glibc 2.3.1 以降だと errno の定義に互換性が無くコンパイル時にエラーとなるので必要。# gzip -d qmail-date-localtime.patch.gz
# tar xzfv qmail-1.03.tar.gz
# cd qmail-1.03
patch適用
# cp -p ../qmail-date-localtime.patch ..
# cp -p ../qmail-1.03.errno.patch .
# patch < qmail-date-localtime.patch
patching file date822fmt.c
# patch < qmail-1.03.errno.patch
patching file cdb_seek.c
patching file dns.c
patching file error.3
patching file error.h
インストール
# make setup check
# make check
#./config-fast mail.server-memo.net
起動ファイルのコピー
# cd /var/qmail/boot
# cp -p home ../rc
sendmail Wrpperの設定
# ln -s /var/qmail/bin/sendmail /usr/sbin/sendmailFedoraCoreなんかは以下の設定も必要かも・・・
# ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
# rm /etc/alternatives/mta
# ln -s /var/qmail/bin/sendmail /etc/alternatives/mta
起動スクリプトの作成
/etc/init.d/qmail#!/bin/sh
#
# qmail: /var/qmail
# chkconfig: 2345 99 99
# description: qmail with tcpserver
#
# Source function library.
. /etc/rc.d/init.d/functions
PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin
[ -f /var/qmail/rc ] || exit 0
case "$1" in
start)
# Start qmail
echo "Starting qmail..."
csh -cf '/var/qmail/rc &'
tcpserver -v -u 501 -g 500 -x /etc/tcp.smtp.cdb \
0 smtp /var/qmail/bin/qmail-smtpd 2>&1 | /var/qmail/bin/splogger smtpd 3 &
echo
touch /var/lock/qmail
;;
stop)
# Stop qmail
echo "Shutting down qmail..."
PID=`/bin/ps -aefw | grep qmail | awk '{print $2}'`
if [ ! -z "$PID" ] ; then
/bin/kill ${PID} 1> /dev/null 2>&1
fi
echo
rm -f /var/lock/qmail
;;
*)
echo "Usage: S99qmail {start|stop}"
exit 1
esac
exit 0
パーミッションの変更
作成したスクリプトに、実行権限をあたえます。# chmod +x /etc/init.d/qmail
tcpserverのインストール
必要なファイル
ucspi-tcp-0.88.tar.gz# tar xvfz ../ucspi-tcp-0.88.tar.gz
# cd ucspi-tcp-0.88/
# make setup check
# tcpserver -v -u[qmaildのUID] -g[nofilesのGID]\
-x /etc/tcp.smtp.cdb 0 smtp /var/qmail/bin/qmail-smtpd 2>&1 |\
/var/qmail/bin/splogger smtpd 3 &
自動起動設定
FedoraCoreの場合# chkconfig --add qmail
# chkconfig qmail on
# chkconfig --list qmail
qmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off
root宛メールの転送設定
qmailはインストールされた状態のままでは、root / postmaster / mailer-daemon宛等のメールを受け取らないので転送設定を行いそれらのメールを受信できるようにします。# touch ~alias/.qmail-postmaster
# touch ~alias/.qmail-mailer-daemon
# touch ~alias/.qmail-root
# chmod 644 /var/qmail/alias/.qmail-*

