競合するパッケージのアンインストール
exim4-daemon-lightはqmailと競合するので削除する。
# apt-get remove exim4-daemon-light
ucspi-tcp-srcのインストール
# apt-get install ucspi-tcp-src
作業ディレクトリの入力を求められるが、そのまま「Enter」
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]
ビルドがうまく行くと,以下のようなメッセージが出る。
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を入力する。/tmp/qmail以下でdebファイル以外の全ファイルが削除される。
続いてすぐにdebパッケージをインストールするか聞かれる。
Do you want to install ucspi-tcp_0.88-15_i386.deb now? [Yn]
Yを入力する。
uscpi-tcp-srcパッケージを消すか聞かれる
Do you want to purge ucspi-tcp-src now? [yN]
Nを入力する。
Remember 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-srcのインストール
# apt-get install qmail-src
Warning: The home dir /var/qmail/alias you specified can't be accessed: そのようなファイルやディレクトリはありません
Adding system user `alias' (UID 64010) ...
Adding new user `alias' (UID 64010) with group `nogroup' ...
Not creating home directory `/var/qmail/alias'.
Warning: The home dir /var/qmail you specified can't be accessed: そのようなファイルやディレクトリはありません
Adding system user `qmaild' (UID 64011) ...
Adding new user `qmaild' (UID 64011) with group `nogroup' ...
Not creating home directory `/var/qmail'.
Warning: The home dir /var/qmail you specified can't be accessed: そのようなファイルやディレクトリはありません
Adding system user `qmails' (UID 64012) ...
Adding new user `qmails' (UID 64012) with group `qmail' ...
Not creating home directory `/var/qmail'.
Warning: The home dir /var/qmail you specified can't be accessed: そのようなファイルやディレクトリはありません
Adding system user `qmailr' (UID 64013) ...
Adding new user `qmailr' (UID 64013) with group `qmail' ...
Not creating home directory `/var/qmail'.
Warning: The home dir /var/qmail you specified can't be accessed: そのようなファイルやディレクトリはありません
Adding system user `qmailq' (UID 64014) ...
Adding new user `qmailq' (UID 64014) with group `qmail' ...
Not creating home directory `/var/qmail'.
Warning: The home dir /var/qmail you specified can't be accessed: そのようなファイルやディレクトリはありません
Adding system user `qmaill' (UID 64015) ...
Adding new user `qmaill' (UID 64015) with group `nogroup' ...
Not creating home directory `/var/qmail'.
Warning: The home dir /var/qmail you specified can't be accessed: そのようなファイルやディレクトリはありません
Adding system user `qmailp' (UID 64016) ...
Adding new user `qmailp' (UID 64016) with group `nogroup' ...
Not creating home directory `/var/qmail'.
#
一瞬あせるが、これで問題ないようだ。
qmailのビルドと、インストール
# build-qmail
作業ディレクトリの入力を求められるので、そのまま「Enter」
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]
ビルドがうまく行くと,以下のようなメッセージが出る。
It seems that all went ok
Do you want to remove all files in /tmp/qmail,
except qmail_1.03-47_i386.deb now? [Yn]
Yを入力する。/tmp/qmail以下でdebファイル以外の全ファイルが削除される。
続いてすぐにdebパッケージをインストールするか聞かれる。
Do you want to install qmail_1.03-47_i386.deb now? [Yn]
Yを入力する。
qmail-srcパッケージを消すかと聞いてくる。
Do you want to purge qmail-src now? [yN]
Nを入力する。
Remember that you can install qmail_1.03-47_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!
/var/qmail/controls ファイルの編集
# echo mx.hoge.jp > /var/qmail/control/me
# echo hoge.jp > /var/qmail/control/defaultdomain
# echo localhost > /var/qmail/control/locals
# echo mx.hoge.jp >> /var/qmail/control/locals
# echo hoge.jp > /var/qmail/control/plusdomain
# echo localhost > /var/qmail/control/rcpthosts
# echo hoge.jp >> /var/qmail/control/rcpthosts
エイリアスを定義する
# cd ~alias
#touch .qmail-postmaster .qmail-mailer-daemon .qmail-webmaster .qmail-root
# chmod 644 .qmail*
# echo '&hoge@hoge.jp' >.qmail-postmaster
# echo '&hoge@hoge.jp' >.qmail-mailer-daemon
# echo '&hoge@hoge.jp' >.qmail-webmaster
# echo '&hoge@hoge.jp' >.qmail-root
Maildirの作成
各ユーザにsuして作成
$ maildirmake ~/Maildir
新規ユーザ登録のとき自動的に作れるようにする
maildirmake /etc/skel/Maildir
SMTP 接続用の tcpserver ルールを作成
# vi /etc/tcp.smtp
/etc/tcp.smtp の内容。
127.0.0.1:allow,RELAYCLIENT=""
192.168.:allow,RELAYCLIENT=""
:allow
tcpserver の接続制御データベースを作成する。中継を許可したいネットワークを追加した場合には tcp.smtp.cdb を再作成する。
# tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
qmail 起動
# /etc/init.d/qmail start
qmail関係のプロセスが起動されたことを確認する
# ps ax | grep qmail
10481 pts/0 S 0:00 qmail-send
10482 pts/0 S 0:00 splogger qmail 2
10483 pts/0 S 0:00 qmail-lspawn ./Maildir/
10485 pts/0 S 0:00 qmail-rspawn
10487 pts/0 S 0:00 qmail-clean
10489 pts/0 S 0:00 /usr/bin/tcpserver -R -H -u 64011 -g 65534 -x /etc/tcp.smtp.cdb 0 smtp /usr/sbin/qmail-smtpd
10490 pts/0 S 0:00 splogger qmail 2
10493 pts/0 S+ 0:00 grep qmail
SMTP 接続チェック
# telnet localhost smtp
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mx.hoge.jp ESMTP
QUITを入力
QUIT
221 mx.hoge.jp
Connection closed by foreign host.
vpopmail のインストール
実行に必要なグループとユーザを作成する。
# groupadd vchkpw
# useradd -g vchkpw -d /home/vpopmail -m -s /bin/true vpopmail
vpopmailの入手し解凍する。入手先はこちら(
http://inter7.com/vpopmail/)
# bzip2 -cd vpopmail-5.4.27.tar.bz2 | tar xvf -
コンパイルと、インストール
# ./configure --enable-logging=y \
--enable-relay-clear-minutes=40 \
--enable-roaming-users=y \
--enable-tcpserver-file=/etc/tcp.smtp \
--enable-logging=y
# make
# make install-strip
POP3 接続用の tcpserver ルールを作成
# vi /etc/tcp.pop3
/etc/tcp.pop3 の内容。
:allow
tcpserver の接続制御データベースを作成する。
# tcprules /etc/tcp.pop3.cdb /etc/tcp.pop3.tmp < /etc/tcp.pop3
/etc/init.d/qmail の pop3 に関する箇所を追記
# Uncomment the following lines to automatically start the pop3 server
sh -c "start-stop-daemon --start --quiet --user root \
--pidfile /var/run/tcpserver_pop3d.pid --make-pidfile \
--exec /usr/bin/tcpserver -- -l0 -R -H -x /etc/tcp.pop3.cdb \
0 pop3 /usr/sbin/qmail-popup mallet.jp \
/home/vpopmail/bin/vchkpw \
/usr/sbin/qmail-pop3d Maildir &"
# Uncomment the following line if you have enabled the pop3 server
start-stop-daemon --user root --stop --quiet --oknodo --pidfile /var/run/tcpserver_pop3d.pid --exec /usr/bin/tcpserver
qmail 再起動
# /etc/init.d/qmail restart
POPへのアクセス後一定時間経ったらSMTPの許可リストをクリアするために、cronで一定の周期でプログラムを実行させる。
# vi /etc/cron.d/clearopensmtp
*/10 * * * * root /home/vpopmail/bin/clearopensmtp 2 >&1 > /dev/null
# /etc/init.d/cron restart
POP3 接続チェック
# telnet localhost pop3
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK <14548.1241951655@hoge.jp>
QUITを入力
QUIT
+OK
Connection closed by foreign host.
qmail + vpopmail によるバーチャルドメイン管理
新規ドメインの追加
# cd ~vpopmail
# ./bin/vadddomain hoge.jp
Please enter password for postmaster:*********
enter password again:*********
新規ユーザの追加
# ./bin/vadduser hoge@hoge.jp
Please enter password for postmaster:*********
enter password again:*********
qmailadmin のインストール
qmailadmin を入手し解凍する。入手先はこちら(
http://inter7.com/qmailadmin/)
# gzip -cd qmailadmin-1.2.12.tar.gz | tar xvf -
コンパイルと、インストール
# ./configure \
--enable-htmldir=/home/www/htdocs \
--enable-cgibindir=/home/www/cgi-bin/qmailadmin \
--enable-cgipath=/cgi-bin/qmailadmin/qmailadmin \
--enable-imagedir=/home/www/htdocs/cgi-img/qmailadmin \
--enable-imageurl=/cgi-img/qmailadmin \
--enable-ezmlmdir=n \
--enable-maxmailinglists=0 \
--enable-autoresponder-bin=n \
--enable-autoresponder-path=n
# make clean
# make
# make install-strip
アクセスしてみる。
apache2 の設定にて、内部からのみアクセスできるようにする
# vi /etc/apache2/conf.d/qmailadmin
<Directory "/home/www/cgi-bin/qmailadmin">
<Files "qmailadmin">
order deny,allow
deny from all
allow from 127.0.0.1
allow from 192.168.1
</Files>
</Directory>
ブログ一覧 |
Debian GNU/Linux | パソコン/インターネット
Posted at
2009/05/10 13:31:13