Debian GNU/Linux(Sarge)でqmailをインストールしてみる
恥ずかしながら私はメールサーバを構築したことがない.これではいろんな実験,検証をする際に不便な場合があるので,構築してみた.
qmailのバイナリパッケージが見当たらないので(※),作業概要は以下のようになった.
- 競合するパッケージのアンインストール
- ソースパッケージucspi-tcp-srcのインストール
- ucspi-tcpのビルド
- ソースパッケージqmail-srcのインストール
- qmailのビルド
- 競合するパッケージに連座したパッケージをインストール
※ qmailのライセンス(変更した場合は,ソースとして配布しなければならない)とDebianのポリシー(qmailのディレクトリ構造などがDebianとしてはよろしくない)とが,うまくいかず,折衷案としたこうなったらしい.
eximはqmailと競合するので,あらかじめ削除しておく.
# apt-get remove exim私の環境では同時に
at mailx postgresqlが消された. あとで入れ直す.
# apt-get install ucspi-tcp-srcすると
To build ucspi-tcp binary package, you have to run
build-ucspi-tcp
Press ENTER to continue...
となる.
ソースパッケージのインストールは以上.
ソースパッケージインストール時の案内どおり,以下を実行.
# build-ucspi-tcp This script unpacks the ucspi-tcp 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]build-ucspi-tcpはスクリプトで,ucspi-tcpのソースをアンパックして,コンパイルして,バイナリのucspi-tcp*.debを作成してくれるらしい. そして,その作業ディレクトリの入力を求められる. デフォルトで続けると,パッチを当てるタイミングで一度止まる. パッチは当てないので,Enterを押して続ける. やはりビルドがうまく行くと,以下のようなメッセージが出る.
It seems that all went ok Do you want to remove all files in /tmp/ucspi-tcp, except ucspi-tcp_0.88-9_i386.deb now? [Yn]Yを入力すると,/tmp/qmail以下でdebファイル以外の全ファイルが削除される. 続いてすぐにdebパッケージをいれるか聞かれる.
Do you want to install ucspi-tcp_0.88-9_i386.deb now? [Yn]Yでインストールする. そしてuscpi-tcp-srcパッケージを消すか聞かれるので,Nと答える.
Do you want to purge ucspi-tcp-src now? [yN] Remember that you can install ucspi-tcp_0.88-9_i386.deb on other computers so you don't need to compile it again. Good luck!作成したdebファイルは別マシンでもインストール可能らしい... 最後に祝福されて終る.
まず,qmailのソースをインストールする.
# apt-get install qmail-srcすると,
build-qmailしろと確認ダイアログが出て来るので,[OK]を押す. 次に警告が出て来る.
build-qmailでビルドされたバイナリパッケージは,パッケージをビルドシステムのuidとgidに依存する. もし,初めてqmailをビルドしてインストールしている場合, /etc/passwd, /etc/shadow, /etc/groupをチェックし, すべてのqmailのuidとgidを削除し,qmail-srcを再インストールするよう,強く推める.うーん,バイナリパッケージが無い辺りから薄々感じていたが,qmailのインストールには何だか複雑な事情があるらしい.
# grep 'qmail' /etc/{passwd,shadow,group,gshadow}
...mailでgrepすると引っかかるのだが,qmailで引っかからないからいいのだろうか.
とりあえず[OK]を押し,継続してみる.
インストーラはqmailユーザが新しく作成したりして終了する.
No qmail accounts present, creating them now Adding group `qmail' (64010)... Done. adduser: Warning: The home dir you specified does not exist. Adding system user `alias'... Adding new user `alias' (64010) with group `nogroup'. Not creating home directory. adduser: Warning: The home dir you specified does not exist. Adding system user `qmaild'... Adding new user `qmaild' (64011) with group `nogroup'. Not creating home directory. adduser: Warning: The home dir you specified does not exist. Adding system user `qmails'... Adding new user `qmails' (64012) with group `qmail'. Not creating home directory. adduser: Warning: The home dir you specified does not exist. Adding system user `qmailr'... Adding new user `qmailr' (64013) with group `qmail'. Not creating home directory. adduser: Warning: The home dir you specified does not exist. Adding system user `qmailq'... Adding new user `qmailq' (64014) with group `qmail'. Not creating home directory. adduser: Warning: The home dir you specified does not exist. Adding system user `qmaill'... Adding new user `qmaill' (64015) with group `nogroup'. Not creating home directory. adduser: Warning: The home dir you specified does not exist. Adding system user `qmailp'... Adding new user `qmailp' (64016) with group `nogroup'. Not creating home directory....何か最初に自動でqmailユーザの有無チェックをしてるみたいだな. まぁ,ユーザアカウントの処理だけに,無言で全自動実行も問題なので,先のダイアログは妥当だろうか.
続いて,インストール時の案内どおり,
# build-qmailしてみる.
# 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]build-qmailはスクリプトで,qmailのソースをアンパックして,コンパイルして,バイナリのqmail*.debを作成してくれるらしい. そして,その作業ディレクトリの入力を求められる. このディレクトリにtmpfsを指定するとまずいらしい... デフォルトで続ける. するとソースをアンパックしたので,パッチをあてるなら今だ,と言って,すでに当たっているパッチの一覧も出て来る. パッチをあてるには別コンソールで作業してから,このコンソールの作業に戻るらしい. パッチは当てないのでこのまま続ける. ビルドがうまく行くと,以下のようなメッセージが出る.
It seems that all went ok Do you want to remove all files in /tmp/qmail, except qmail_1.03-38_i386.deb now? [Yn]Yを入力すると,/tmp/qmail以下でdebファイル以外の全ファイルが削除される. 続いてすぐにdebパッケージをいれるか聞かれる.
Do you want to install qmail_1.03-38_i386.deb now? [Yn]Yでインストールする. すると,qlistは分割されたとか言われる... よく分からないが,必要なら
http://pobox.com/~djb/qlist.htmlから取得可能らしい. 次にqmailを今起動するかを聞かれる. 勢いでYesとした. そしてuscpi-tcp-srcパッケージを消すか聞かれるので,Nと答える.
Do you want to purge qmail-src now? [yN] Remember that you can install qmail_1.03-38_i386.deb on other computers so you don't need to compile it again. Don't forget to setup a /etc/qmail/rcpthosts file to prevent open relaying! Good luck!作成したdebファイルは別マシンでもインストール可能らしい. とにかく不正中継を防止するために
/etc/qmail/rcpthostsを設定せよとのこと. 最後に祝福されて終る.
インストール作業の後始末として,eximをアンインストールした際に連座したパッケージを元通りインストールしなおしておく.
私の環境では同時に
at mailx postgresqlが消されたので,
# apt-get install at mailx postgresqlとした.
以下で起動する.
# /etc/init.d/qmail startするとsyslogに
warning: dropping connection, unable to read /etc/tcp.smtp.cdb: file does not existとか出た. そこで,
# /etc/init.d/qmail cdb Rebuilding tcp.smtp.cdb. # ls /etc/tcp.smtp.cdb /etc/tcp.smtp.cdb再起動すると直った.

