debian には標準で exim (exim4) がインストールされているのでそれをアンイ ンストールする(そうしないと後で qmail をインストールする際に衝突する). まず exim4 関連のパッケージを dpkg コマンドで確認する.
$ dpkg --list | grep exim ii exim4 4.72-6+squeeze2 metapackage to ease Exim MTA (v4) installation ii exim4-base 4.72-6+squeeze2 support files for all Exim MTA (v4) packages ii exim4-config 4.72-6+squeeze2 configuration for the Exim MTA (v4) ii exim4-daemon-light 4.72-6+squeeze2 lightweight Exim MTA (v4) daemon
これらを全てアンインストールする.
# aptitude remove exim4 exim4-base exim4-config exim4-daemon-light 以下のパッケージが削除されます: exim4 exim4-base exim4-config exim4-daemon-light 更新: 0 個、新規インストール: 0 個、削除: 4 個、保留: 9 個。 0 B のアーカイブを取得する必要があります。展開後に 4,141 kB のディスク領域が解放されます。 以下のパッケージには満たされていない依存関係があります: bsd-mailx: 依存: default-mta[仮想パッケージです] または mail-transport-agent[仮想パッケージです] 以下のアクションでこれらの依存関係の問題は解決されます: 以下のパッケージを削除する: 1) bsd-mailx 以下の依存関係を未解決のままにする: 2) apt-listchanges が exim4 | mail-transport-agent を推奨 3) at が exim4 | mail-transport-agent を推奨 4) cron が exim4 | postfix | mail-transport-agent を推奨 5) logrotate が mailx を推奨 6) mutt が default-mta | mail-transport-agent を推奨 7) procmail が default-mta | mail-transport-agent | fetchmail を推奨 この解決方法を受け入れますか? [Y/n/q/?] (enter) 以下のパッケージが削除されます: bsd-mailx{a} exim4 exim4-base exim4-config exim4-daemon-light 更新: 0 個、新規インストール: 0 個、削除: 5 個、保留: 9 個。 0 B のアーカイブを取得する必要があります。展開後に 4,342 kB のディスク領域が解放されます。 先に進みますか? [Y/n/?] (enter)
bsd-mailx パッケージもアンインストールされるが, 気にせず続行する.
qmail-src パッケージは non-free カテゴリのパッケージなので, ダウンロードする前に /etc/apt/sources.list に
deb http://dennou-h.gfd-dennou.org/debian/ squeeze main non-free ^^^^^^^^
と加筆しておく. デフォルトでは non-free パッケージはインストール されないので注意すること.
上記修正を行った後, qmail-src パッケージをダウンロード
# aptitude install po-debconf (qmail ビルド時に必要となる) # aptitude update # aptitude install qmail-src
qmail-src パッケージインストール中に "/va/qmail ディレクトリがない" と 警告が表示されるが無視する.
qmail-src と同時に ucspi-tcp-src パッケージもインストールされる. /usr/src/ 以下に
qmail-src ucspi-tcp-src
が作成され, それぞれのソースコードが格納される.
qmail, ucspi-tcp ともにビルド用のコマンドが用意されているので, それを用いる.
ucspi-tcp のビルドとインストール.
# build-ucspi-tcp This script unpacks the ucspi-tcp-src source into a directory, and compiles it to produce a binary ucspi-tcp*.deb file. The directory where this is done will end up containing the source and package files for the ucspi-tcp binary package, along with a directory containing the unpacked source. Enter a directory where you would like to do this [/tmp/ucspi-tcp] (enter) .... (ソースファイルの解凍メッセージが表示される) .... Binary package ucspi-tcp will be compiled now This can take long time, depending on your machine Press ENTER to continue... (enter) .... (コンパイルメッセージが表示される) .... It seems that all went ok Do you want to remove all files in /tmp/ucspi-tcp, except ucspi-tcp_0.88-15_i386.deb now? [Yn] Y Do you want to install ucspi-tcp_0.88-15_i386.deb now? [Yn] Y 未選択パッケージ ucspi-tcp を選択しています。 (データベースを読み込んでいます ... 現在 36639 個のファイルとディレクトリがインストールさ れています。) (ucspi-tcp_0.88-15_i386.deb から) ucspi-tcp を展開しています... 'ucspi-tcp による /usr/man/man5/tcp-environ.5.gz から /usr/man/man5/tcp-environ.5q.gz への退避 (divert)' を追加しています ucspi-tcp (0.88-15) を設定しています ... man-db のトリガを処理しています ... Do you want to purge ucspi-tcp-src now? [yN] N emember that you can install ucspi-tcp_0.88-15_i386.deb on other computers so you don't need to compile it again. Good luck!
qmail のビルドtとインストール.
# build-qmail This script unpacks the qmail source into a directory, and compiles it to produce a binary qmail*.deb file. The directory where this is done will end up containing the source and package files for the qmail binary package, along with a directory containing the unpacked source. !* WARNING *! There have been reports of undesired behavior when attempting to build qmail in a directory on a tmpfs based filesystem. Please do not try to build on an tmpfs filesystem. Enter a directory where you would like to do this [/tmp/qmail] (enter) .... (ソースファイルの解凍メッセージが表示される) .... Binary package qmail will be compiled now If you want to apply a custom patch, switch to another console and do it now The following patches have been applied for you automagically: netscape-progress - Fixes compatibility bug in POP3 daemon pop3-supplementarygroups - Update to checkpasswd to allow multiple groups qmailqueue - Allows use of external qmail-queue programs qregex - Allows use of regular expressions for anti-relay / spam control errno - Fixes glibc compatibility error qmail_local - Fixes memory corruption in certain .qmail files Patches already applied can be found in the patches/ directory where the qmail-src package was extracted. This can take long time, depending on your machine Press ENTER to continue... (enter) .... (コンパイルメッセージが表示される) .... It seems that all went ok Do you want to remove all files in /tmp/qmail, except qmail_1.03-49.2_i386.deb now? [Yn] (enter) Do you want to install qmail_1.03-49.2_i386.deb now? [Yn] (enter)
EP mail サーバ構築ドキュメントを参考に, 必要部分だけ設定する.
制御ファイルの設定
デフォルトのまま.
エイリアスアドレスの設定
# cd /var/qmail/alias # echo '&root' > .qmail-root # echo '&root' > .qmail-postmaster # echo '&root' > .qmail-mailer-daemon # echo '&root' > .qmail-bin # echo '&root' > .qmail-daemon # echo '&root' > .qmail-games # echo '&root' > .qmail-ingres # echo '&root' > .qmail-nobody # echo '&root' > .qmail-system # echo '&root' > .qmail-toor # echo '&root' > .qmail-uucp # echo '&root' > .qmail-usenet # echo '&root' > .qmail-anonymous # echo '&root' > .qmail-mail
パスの設定
/var/qmail/bin 以下のコマンドにパスを通す. 編集するファイルは /etc/profile (csh はインストールしていないので設定しない).
/etc/profile: PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/var/qmail/bin"
マニュアルパスの設定
パッケージインストールのため必要なし.
~/Mailbox への配送
/etc/profile に以下を書き加える.
MAIL="$HOME/Mailbox" MAILDROP="$HOME/Mailbox" export MAIL MAILDROP
パッケージをインストールした時点で起動スクリプト /etc/init.d/qmail もイ ンストールされ, qmail も起動される. 以下のデーモンが起動しているかどう かを確認する.
$ ps aux | grep qmail qmails 1133 0.0 0.1 1720 420 ? S Sep16 0:00 qmail-send qmaill 1142 0.0 0.2 1684 544 ? S Sep16 0:00 splogger qmail 2 root 1143 0.0 0.1 1684 364 ? S Sep16 0:00 qmail-lspawn |/usr/sbin/qmail-procmail qmailr 1144 0.0 0.1 1680 364 ? S Sep16 0:00 qmail-rspawn qmailq 1145 0.0 0.1 1672 372 ? S Sep16 0:00 qmail-clean qmaild 1148 0.0 0.2 1748 588 ? S Sep16 0:00 /usr/bin/tcpserver -R -H -u 64011 -g 65534 -x /etc/tcp.smtp.cdb 0 smtp /usr/sbin/qmail-smtpd root 1149 0.0 0.1 1552 304 ? S Sep16 0:00 splogger qmail 2 root 1150 0.0 0.1 1552 360 ? Ss Sep16 0:00 startpar -f -- qmail
あらかじめ "./Mailbox" と記載された .qmail と ~/Mailbox ファイルを用意 しておく.
ローカル配送テスト (1)
存在するローカルアカウント宛に送信し, そのアカウントのホームディレク トリ以下の Mailbox ファイルに送信されているか確認する.
$ echo "to: mondo6" | qmail-inject
同時に /var/log/mail.log もチェックする.
ローカル配送テスト (2)
存在しないローカルアカウント宛に送信し, バウンスメールが帰って来るか 確認する.
$ echo "to: noaddress" | qmail-inject
リモート配送テスト (1)
リモートホスト上のアカウントへ送ってみる.届いていれば OK . 届かなけれ ば /var/log/mail.log を参照して原因を追求する.
$ echo "to: hoge@ep.sci.hokudai.ac.jp" | qmail-inject
リモート配送テスト (2)
リモートホストからローカルアカウントへ送ってみる.届いていれば OK .