| 導購 | 订阅 | 在线投稿
分享
 
 
 

Qmail Toaster (Linux版)

來源:互聯網  2008-05-31 00:05:01  評論

Qmail Toaster (Linux版)

原文:Bill's Qmail Toaster

整理:FunBSD

版本:0.8

最後更新:2006年1月6日

准備

* 系統需求

* 軟件下載

* apache

* php

* mysql

安裝

* daemontools

* ucspi-tcp

* netqmail

* vpopmail

* toaster

* courier-imap

* autorespond

* ezmlm

* qmailadmin

* igenus

* squirrelmail

* spamassassin

* clamav

* simscan

* qmailmrtg7

* 系統需求

刪除其他MAIL系統:

rpm -e --nodeps sendmail postfix

確認下列軟件已安裝:

rpm -qa gcc g++ gcc-g++ gdbm gdbm-devel openssl openssl-devel stunnel krb5-devel bzip2 bzip2-devel gmp-devel

* 軟件下載

定義環境變量:

export DOMAIN=domain.com

export PKG_DIR=/home/pkg

mkdir -p $PKG_DIR/src

下載軟件:

cd $PKG_DIR/src

wget -r -l1 -np -nd http://www.funbsd.net/down/qmail

生成初始安裝包:

cd $PKG_DIR

tar xzf src/netqmail-1.05.tar.gz

cd netqmail-1.05

./collate.sh

* apache

安裝:

groupadd -g 8080 apache

useradd -u 8080 -g apache apache

cd $PKG_DIR

tar jxf src/httpd-*

cd httpd-*

./configure --prefix=/usr/local/apache --enable-so --enable-modules=most

make

make install

配置(/usr/local/apache/conf/httpd.conf):

NameVirtualHost *:*

DocumentRoot /usr/local/apache/htdocs

ServerName mail.domain.com

設置環境變量,並啓動:

echo 'export PATH=/usr/local/apache/bin:$PATH' /etc/profile

echo "/usr/local/apache/bin/apachectl start" /etc/rc.local

export PATH=/usr/local/apache/bin:$PATH

apachectl start

* php

安裝:

cd $PKG_DIR

tar jxf src/php-*

cd php-*

./configure --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --with-mysql=/usr/local/mysql

make

make install

cp php.ini-recommended /usr/local/apache/conf/php.ini

配置apache(/usr/local/apache/conf/httpd.conf):

DirectoryIndex index.php index.html index.html.var

LoadModule php4_module modules/libphp4.so

AddType application/x-httpd-php .php

重啓apache:

apachectl restart

* mysql

安裝:

groupadd -g 3306 mysql

useradd -u 3306 -g mysql -M -d /nonexistent mysql

cd /usr/local

tar zxf $PKG_DIR/src/mysql-standard-*

mv mysql-standard-* mysqld

cd mysql

chown -R root ./

chown -R mysql data

chgrp -R mysql ./

scripts/mysql_install_db --user=mysql

cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql

chmod 755 /etc/rc.d/init.d/mysql

chkconfig --add mysql

設置環境變量,並啓動:

echo 'export PATH=/usr/local/mysql/bin:$PATH' /etc/profile

service mysql start

更改初始密碼:

export PATH=/usr/local/mysql/bin:$PATH

mysqladmin -u root password 'mysqlpwd'

* daemontools

daemontools是一個收集可管理的UNIX服務的工具。

網址:http://cr.yp.to/daemontools.html

mkdir /package

chmod 1755 /package

cd /package

tar zxf $PKG_DIR/src/daemontools-0.76.tar.gz

cd admin/daemontools-0.76

patch -p1

package/install

* ucspi-tcp

ucspi-tcp包括tcpserver和tcpclient,是一個建立client-server應用程序的命令行工具。

網址:http://cr.yp.to/ucspi-tcp.html

cd $PKG_DIR

tar zxf src/ucspi-tcp-0.88.tar.gz

cd ucspi-tcp-0.88

patch -p1

make

make setup check

* netqmail

netqmail是qmail加上一些推薦的最基本的補丁。

網址:http://qmail.org/netqmail/

mkdir /var/qmail

groupadd nofiles

useradd -g nofiles -d /var/qmail/alias alias

useradd -g nofiles -d /var/qmail qmaild

useradd -g nofiles -d /var/qmail qmaill

useradd -g nofiles -d /var/qmail qmailp

groupadd qmail

useradd -g qmail -d /var/qmail qmailq

useradd -g qmail -d /var/qmail qmailr

useradd -g qmail -d /var/qmail qmails

# 注:有些RedHat/Fedora版本需要執行以下命令才能安裝成功

ln -s /usr/kerberos/include/com_err.h /usr/kerberos/include/krb5.h /usr/kerberos/include/profile.h /usr/include/

cd $PKG_DIR/netqmail-1.05/netqmail-1.05

make

make setup check

echo 3 /var/qmail/control/spfbehavior

echo 20 /var/qmail/control/concurrencyincoming

chmod 644 /var/qmail/control/concurrencyincoming

echo ./Maildir/ /var/qmail/control/defaultdelivery

echo postmaster@$DOMAIN /var/qmail/alias/.qmail-root

echo postmaster@$DOMAIN /var/qmail/alias/.qmail-postmaster

echo postmaster@$DOMAIN /var/qmail/alias/.qmail-mailer-daemon

chmod 644 /var/qmail/alias/.qmail*

./config-fast mail.$DOMAIN

* vpopmail

vpopmail是一個基于qmail的郵件虛擬域軟件。

網址:http://vpopmail.sf.net/

設置安裝環境:

groupadd -g 89 vchkpw

useradd -u 89 -g vchkpw vpopmail

mkdir /home/vpopmail/etc

cd /home/vpopmail/etc

echo "$DOMAIN" defaultdomain

echo '127.:allow,RELAYCLIENT=""' tcp.smtp

tcprules tcp.smtp.cdb tcp.smtp.tmp

echo "localhost|0|vpopuser|vpoppwd|vpopmail" vpopmail.mysql

chmod 640 vpopmail.mysql

chown -R vpopmail:vchkpw ./

mysql -u root --password="mysqlpwd"

CREATE DATABASE vpopmail;

GRANT select,insert,update,delete,create,drop ON vpopmail.*

TO vpopuser@localhost IDENTIFIED BY 'vpoppwd';

FLUSH PRIVILEGES;

QUIT

EOF

安裝:

cd $PKG_DIR

tar zxf src/vpopmail-*

cd vpopmail-*

./configure --enable-domainquotas --enable-auth-module=mysql --enable-libdir=/usr/local/mysql/lib --enable-incdir=/usr/local/mysql/include --enable-mysql-limits --enable-sql-logging --enable-logging=v --enable-valias

make

make install-strip

設置郵箱空間警告:

echo "郵件被拒絕,用戶的郵箱已滿。" /home/vpopmail/domains/.over-quota.msg

cat /home/vpopmail/domains/.quotawarn.msg

From: 郵箱管理員

Reply-To:

Subject: 郵箱空間警告

您的郵箱空間已經達到90%。如果想繼續使用,請刪除一些信件。

如需幫助,請聯系郵箱管理員。

Email : postmaster@$DOMAIN

EOF

添加虛擬域和用戶:

echo 'export PATH=/home/vpopmail/bin:$PATH' /etc/profile

export PATH=/home/vpopmail/bin:$PATH

vadddomain -q 100M $DOMAIN pmpwd

vmoddomlimits -q 100M $DOMAIN

vadduser user userpwd

#!/bin/sh

#A simple vadduser script

cat user.txt | while read NAME USER PASSWORD

do

vadduser -c $NAME $USER $PASSWORD

done

安裝選項參考:

vpopmail 5.4.10

Current settings

---------------------------------------

vpopmail directory = /home/vpopmail

uid = 89

gid = 89

roaming users = OFF --disable-roaming-users (default)

password learning = OFF --disable-learn-passwords (default)

md5 passwords = ON --enable-md5-passwords (default)

file locking = ON --enable-file-locking (default)

vdelivermail fsync = OFF --disable-file-sync (default)

make seekable = ON --enable-make-seekable (default)

clear passwd = ON --enable-clear-passwd (default)

user dir hashing = ON --enable-users-big-dir (default)

address extensions = OFF --disable-qmail-ext (default)

ip alias = OFF --disable-ip-alias-domains (default)

domain quotas = ON --enable-domainquotas

auth module = mysql --enable-auth-module=mysql

mysql replication = OFF --disable-mysql-replication (default)

sql logging = ON --enable-sql-logging

mysql limits = ON --enable-mysql-limits

MySQL valias = ON --enable-valias

auth inc = -I/usr/local/mysql/include

auth lib = -L/usr/local/mysql/lib -lmysqlclient -lz -lm

system passwords = OFF --disable-passwd (default)

pop syslog = log success and errors including passwords

--enable-logging=v

auth logging = ON --enable-auth-logging (default)

all domains in one SQL table = --enable-many-domains (default)

* toaster

Bill's Qmail Toaster。

網址:http://shupp.org/

安裝:

cd $PKG_DIR

tar zxf src/toaster-scripts-0.8.tar.gz

cd netqmail-1.05/netqmail-1.05

bunzip2 -c ../../src/qmail-toaster-0.8.patch.bz2 | patch -p0

make clean

make

make setup check

make cert

make tmprsadh

chown -R vpopmail:vchkpw /var/qmail/spam

crontab -e

SHELL=/bin/bash

PATH=/sbin:/bin:/usr/sbin:/usr/bin

MAILTO=postmaster@domain.com

HOME=/root

0 0 * * * /var/qmail/bin/update_tmprsadh /dev/null 2%26amp;1

添加運行腳本:

cd $PKG_DIR

mkdir -p /var/qmail/supervise/qmail-send/log

mkdir -p /var/qmail/supervise/qmail-smtpd/log

mkdir -p /var/qmail/supervise/qmail-pop3d/log

mkdir -p /var/qmail/supervise/qmail-pop3ds/log

cp toaster-scripts-0.8/send.run /var/qmail/supervise/qmail-send/run

cp toaster-scripts-0.8/send.log.run /var/qmail/supervise/qmail-send/log/run

cp toaster-scripts-0.8/smtpd.run /var/qmail/supervise/qmail-smtpd/run

cp toaster-scripts-0.8/smtpd.log.run /var/qmail/supervise/qmail-smtpd/log/run

cp toaster-scripts-0.8/pop3d.run /var/qmail/supervise/qmail-pop3d/run

cp toaster-scripts-0.8/pop3d.log.run /var/qmail/supervise/qmail-pop3d/log/run

cp toaster-scripts-0.8/pop3ds.run /var/qmail/supervise/qmail-pop3ds/run

cp toaster-scripts-0.8/pop3ds.log.run /var/qmail/supervise/qmail-pop3ds/log/run

chmod 755 /var/qmail/supervise/qmail-send/run

chmod 755 /var/qmail/supervise/qmail-send/log/run

chmod 755 /var/qmail/supervise/qmail-smtpd/run

chmod 755 /var/qmail/supervise/qmail-smtpd/log/run

chmod 755 /var/qmail/supervise/qmail-pop3d/run

chmod 755 /var/qmail/supervise/qmail-pop3d/log/run

chmod 755 /var/qmail/supervise/qmail-pop3ds/run

chmod 755 /var/qmail/supervise/qmail-pop3ds/log/run

mkdir -p /var/log/qmail/smtpd

mkdir -p /var/log/qmail/pop3d

mkdir -p /var/log/qmail/pop3ds

chown -R qmaill /var/log/qmail

cp toaster-scripts-0.8/rc /var/qmail

cp toaster-scripts-0.8/qmailctl /var/qmail/bin

cp toaster-scripts-0.8/vpopmailctl /var/qmail/bin/vpopmailctl

chmod 755 /var/qmail/rc

chmod 755 /var/qmail/bin/qmailctl

chmod 755 /var/qmail/bin/vpopmailctl

ln -s /var/qmail/bin/qmailctl /usr/bin

ln -s /var/qmail/bin/vpopmailctl /usr/bin

ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail

ln -s /var/qmail/bin/sendmail /usr/lib/sendmail

啓動:

ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service

ln -s /var/qmail/supervise/qmail-pop3d /var/qmail/supervise/qmail-pop3ds /service

相關命令:

qmailctl {start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help}

vpopmailctl {start|stop|restart|stat|pause|cont|help}

到這裏qmail安裝完成,可用outlook或foxmail進行測試。

* courier-imap

Courier-IMAP支持通過IMAP/SIMAP訪問郵件系統。

網址:http://www.courier-mta.org/

安裝Courier認證庫:

cd $PKG_DIR

tar jxf src/courier-authlib-0.58.tar.bz2

cd courier-authlib-0.58

./configure --with-redhat

# 注: RedHat/Fedora需要加"--with-redhat"選項

make

make install-strip

make install-configure

cp courier-authlib.sysvinit /etc/init.d/courier-authlib

chmod 755 /etc/init.d/courier-authlib

chkconfig --add courier-authlib

安裝Courier-IMAP:

cd $PKG_DIR

tar jxf src/courier-imap-4.0.6.tar.bz2

cd courier-imap-4.0.6

chown -R vpopmail:vchkpw ./

su vpopmail

./configure --with-redhat

# 注: RedHat/Fedora需要加"--with-redhat"選項

make

exit

make install-strip

make install-configure

cp courier-imap.sysvinit /etc/init.d/courier-imap

chmod 755 /etc/init.d/courier-imap

chkconfig --add courier-imap

設置:

cd /usr/local/etc/authlib

sed -i".bak" 's/^authmodulelist=.*/authmodulelist="authvchkpw"/g' authdaemonrc

cd /usr/lib/courier-imap/etc

sed -i".bak" "s/^IMAPDSTART=.*/IMAPDSTART=YES/g;s/^MAXPERIP=.*/MAXPERIP=500/g" imapd

sed -i".bak" "s/^IMAPDSSLSTART=.*/IMAPDSSLSTART=YES/g" imapd-ssl

sed -i".bak" "s/^CN=.*/CN=mail.$DOMAIN/g;s/^emailAddress=.*/emailAddress=postmaster@$DOMAIN/g" imapd.cnf

啓動:

service courier-authlib start

service courier-imap start

* autorespond

autorespond是一個自動回複工具。

網址:http://qmailadmin.sf.net

安裝:

cd $PKG_DIR

tar zxf src/autorespond-2.0.4.tar.gz

cd autorespond-2.0.4

patch -p1

make

make install

* ezmlm

ezmlm是一個快速,強大的郵件列表程序。

網址:http://www.ezmlm.org/

安裝:

cd $PKG_DIR

tar zxf src/ezmlm-0.53.tar.gz

tar zxf src/ezmlm-idx-0.443.tar.gz

mv -f ezmlm-idx-0.443/* ezmlm-0.53/

cd ezmlm-0.53

patch -p0

make

make man

make ch_GB

make setup

* qmailadmin

qmailadmin除了不能添加刪除虛擬域外,幾乎可以完成所有其他的虛擬域管理。

網址:http://qmailadmin.sf.net

安裝:

cd $PKG_DIR

tar zxf src/qmailadmin-1.2.9.tar.gz

tar zxf src/qmailadmin-help-1.0.8.tar.gz

cd qmailadmin-1.2.9

./configure --enable-htmldir=/usr/local/apache/htdocs --enable-cgibindir=/usr/local/apache/cgi-bin --enable-maxusersperpage=20 --enable-maxaliasesperpage=20 --enable-domain-autofill --enable-modify-quota --enable-help --disable-ezmlm-mysql

make

make install-strip

cd /usr/local/share/qmailadmin/lang

mv en en.bak

cp zh-cn en

cd $PKG_DIR

cp -r qmailadmin-help-1.0.8 /usr/local/apache/htdocs/images/qmailadmin/help

測試:

http://mail.domain.com/cgi-bin/qmailadmin

安裝選項參考:

qmailadmin 1.2.9

Current settings

---------------------------------------

cgi-bin dir = /usr/local/apache/cgi-bin

html dir = /usr/local/apache/htdocs

image dir = /usr/local/apache/htdocs/images/qmailadmin

image URL = /images/qmailadmin

template dir = /usr/local/share/qmailadmin

qmail dir = /var/qmail

vpopmail dir = /home/vpopmail

autorespond dir = /usr/local/bin

ezmlm dir = /usr/local/bin/ezmlm

ezmlm idx = yes

mysql for ezmlm = no

help = yes

modify quota = yes

domain autofill = yes

modify spam check = no

* igenus

這是國內一個開源的webmail。

網址:http://www.igenus.org

安裝:

cd /usr/local/apache/htdocs

tar zxf $PKG_DIR/src/igenus*

配置(/usr/local/apache/htdocs/igenus/config/config_inc.php):

// 安裝位置

$CFG_BASEPATH = "/usr/local/apache/htdocs/igenus";

// 數據庫賬號

$CFG_MYSQL_HOST = 'localhost';

$CFG_MYSQL_USER = 'vpopuser';

$CFG_MYSQL_PASS = 'vpoppwd';

$CFG_MYSQL_DB = 'vpopmail';

// 臨時目錄

$CFG_TEMP = $CFG_BASEPATH."/temp";

// autorespond的位置

$CFG_AUTORESPOND_PROM = "/usr/bin/autorespond";

// 網絡目錄

$CFG_NETDISK_PATH = $CFG_BASEPATH."/netdisk";

創建相關目錄:

cd /usr/local/apache/htdocs/igenus

mkdir temp netdisk

chown -R vpopmail:vchkpw ./

修改並導入表:

mysql -uroot --password="mysqlpwd"

alter table vpopmail.vpopmail drop primary key;

alter table vpopmail.vpopmail add column pw_id int(5) unsigned NOT NULL PRIMARY KEY auto_increment;

alter table vpopmail.vpopmail add KEY pw_name (pw_name,pw_domain);

QUIT

EOF

mysql -uroot --password="mysqlpwd" -f vpopmail

修改apache配置文件(/usr/local/apache/conf/httpd.conf):

User vpopmail

Group vchkpw

修改php配置文件(/usr/local/apache/conf/php.ini):

register_globals = On

session.auto_start = 1

session.bug_compat_warn = 0

max_execution_time = 60

memory_limit = 20M

upload_max_filesize = 10M

post_max_size = 10M

log_errors = Off

Sendmail = /var/qmail/bin/qmail-inject

重啓apache:

apachectl restart

測試:

http://mail.domain.com/igenus

* squirrelmail

squirrelmail是一個基于imap的webmail。

網址:http://www.squirrelmail.org

安裝:

cd $PKG_DIR

tar jxf src/squirrelmail-*

tar zxf src/quota_usage-*

cd squirrelmail-*

tar zxf ../src/all_locales-*

cp ../quota_usage/config.php.sample ../quota_usage/config.php

mv ../quota_usage plugins

./configure

1. 1. Domain

1. 4. Domain WebMail $version

1. 7. http://www.Domain.com/

1. 8. Domain Corp.,Ltd

2. 1. domain.com

2. A. 8. courier

2. B. 7. login

3. 3. INBOX.垃圾箱

3. 4. INBOX.發件箱

3. 5. INBOX.草稿箱

8. 11

10. 1. zh_CN

10. 2. gb2312

s

q

cd ../

mv squirrelmail-* /usr/local/apache/htdocs/squirrel

chown -R vpopmail:vchkpw /usr/local/apache/htdocs/squirrel

修改apache配置文件(/usr/local/apache/conf/httpd.conf):

User vpopmail

Group vchkpw

重啓apache:

apachectl restart

測試:

http://mail.domain.com/squirrel

* spamassassin

squirrel是一個垃圾郵件過濾程序。

網址:http://spamassassin.apache.org/

安裝:

cd /root

perl -MCPAN -e shell

o conf prerequisites_policy ask

install Digest::SHA1

install DB_File

install Net::DNS

install Mail::SPF::Query

install IP::Country

install Razor2

install Net::Ident

install IO::Socket::INET6

install IO::Socket::SSL

install Time::HiRes

install DBI

install Archive::Tar

install IO::Zlib

install Mail::SpamAssassin

cd $PKG_DIR

cp toaster-scripts-0.8/local.cf /etc/mail/spamassassin/local.cf

mkdir /etc/mail/spamassassin/.spamassassin

chown vpopmail /etc/mail/spamassassin/.spamassassin

mkdir -p /var/qmail/supervise/spamd/log /var/log/spamd

chown qmaill /var/log/spamd

cp toaster-scripts-0.8/spamd.run /var/qmail/supervise/spamd/run

cp toaster-scripts-0.8/spamd.log.run /var/qmail/supervise/spamd/log/run

chmod 755 /var/qmail/supervise/spamd/run

chmod 755 /var/qmail/supervise/spamd/log/run

ln -s /var/qmail/supervise/spamd /service

* clamav

clamav是一個開源的防毒軟件。

網址:http://www.clamav.net/

安裝:

groupadd clamav

useradd clamav -g clamav -M -d /nonexistent

cd $PKG_DIR

tar zxf src/clamav-0.87.1.tar.gz

cd clamav-0.87.1

patch -p0

patch -p0

patch -p0

./configure

make

make install

在daemontools下運行clamd:

cd $PKG_DIR

mkdir -p /var/qmail/supervise/clamd/log /var/log/clamd

chown clamav /var/log/clamd

cp toaster-scripts-0.8/clamd.run /var/qmail/supervise/clamd/run

cp toaster-scripts-0.8/clamd.log.run /var/qmail/supervise/clamd/log/run

chmod 755 /var/qmail/supervise/clamd/run

chmod 755 /var/qmail/supervise/clamd/log/run

ln -s /var/qmail/supervise/clamd /service

病毒庫升級程序:

cd $PKG_DIR

touch /var/log/freshclam.log

chmod 600 /var/log/freshclam.log

chown clamav /var/log/freshclam.log

cp toaster-scripts-0.8/freshclam /etc/init.d/freshclam

chmod 755 /etc/init.d/freshclam

ln -s ../init.d/freshclam /etc/rc0.d/K30freshclam

ln -s ../init.d/freshclam /etc/rc1.d/K30freshclam

ln -s ../init.d/freshclam /etc/rc2.d/S80freshclam

ln -s ../init.d/freshclam /etc/rc3.d/S80freshclam

ln -s ../init.d/freshclam /etc/rc4.d/S80freshclam

ln -s ../init.d/freshclam /etc/rc5.d/S80freshclam

ln -s ../init.d/freshclam /etc/rc6.d/K30freshclam

/etc/init.d/freshclam start

* simscan

simscan是qmail的垃圾郵件和病毒掃描引擎。

網址:http://www.inter7.com/simscan/

安裝ripmime:

cd $PKG_DIR

tar zxf src/ripmime-1.4.0.5.tar.gz

cd ripmime-1.4.0.5

make

make install

安裝simscan:

cd $PKG_DIR

tar zxf src/simscan-1.1.tar.gz

cd simscan-1.1

./configure --enable-user=clamav --enable-clamav=y --enable-spam=y --enable-spam-passthru=y --enable-per-domain=y --enable-ripmime --enable-attach=y --enable-received=y

make

make install-strip

echo ":clam=yes,spam=yes,spam_passthru=yes,attach=.vbs:.lnk:.scr:.wsh:.hta:.pif" /var/qmail/control/simcontrol

/var/qmail/bin/simscanmk

/var/qmail/bin/simscanmk -g

echo ':allow,QMAILQUEUE="/var/qmail/bin/simscan"' ~vpopmail/etc/tcp.smtp

qmailctl cdb; qmailctl restart

* qmailmrtg7

qmailmrtg7是一個監測qmail流量的工具。

網址:http://www.inter7.com/qmailmrtg7/

安裝mrtg:

cd $PKG_DIR

tar zxf src/mrtg-*

cd mrtg-*

./configure --prefix=/usr/local

make

make install

安裝qmailmrtg7:

cd $PKG_DIR

tar zxf src/qmailmrtg7-4.2.tar.gz

cd qmailmrtg7-4.2

patch -p0

make

make install

sed -i "s/FQDN/mail.$DOMAIN/g;" qmail.mrtg.cfg

sed -i "1s/.*/WorkDir: \/usr\/local\/apache\/htdocs\/qmailmrtg/" qmail.mrtg.cfg

cp qmail.mrtg.cfg /etc

mkdir /usr/local/apache/htdocs/qmailmrtg

indexmaker --section=title /etc/qmail.mrtg.cfg /usr/local/apache/htdocs/qmailmrtg/index.html

mrtg /etc/qmail.mrtg.cfg; mrtg /etc/qmail.mrtg.cfg; mrtg /etc/qmail.mrtg.cfg

crontab -e

*/5 * * * * /usr/local/bin/mrtg /etc/qmail.mrtg.cfg /dev/null

測試:

http://mail.domain.com/qmailmrtg

Qmail Toaster (Linux版) 原文:Bill's Qmail Toaster 整理:FunBSD 版本:0.8 最後更新:2006年1月6日 准備 * 系統需求 * 軟件下載 * apache * php * mysql 安裝 * daemontools * ucspi-tcp * netqmail * vpopmail * toaster * courier-imap * autorespond * ezmlm * qmailadmin * igenus * squirrelmail * spamassassin * clamav * simscan * qmailmrtg7 * 系統需求 刪除其他MAIL系統: rpm -e --nodeps sendmail postfix 確認下列軟件已安裝: rpm -qa gcc g++ gcc-g++ gdbm gdbm-devel openssl openssl-devel stunnel krb5-devel bzip2 bzip2-devel gmp-devel * 軟件下載 定義環境變量: export DOMAIN=domain.com export PKG_DIR=/home/pkg mkdir -p $PKG_DIR/src 下載軟件: cd $PKG_DIR/src wget -r -l1 -np -nd http://www.funbsd.net/down/qmail 生成初始安裝包: cd $PKG_DIR tar xzf src/netqmail-1.05.tar.gz cd netqmail-1.05 ./collate.sh * apache 安裝: groupadd -g 8080 apache useradd -u 8080 -g apache apache cd $PKG_DIR tar jxf src/httpd-* cd httpd-* ./configure --prefix=/usr/local/apache --enable-so --enable-modules=most make make install 配置(/usr/local/apache/conf/httpd.conf): NameVirtualHost *:* DocumentRoot /usr/local/apache/htdocs ServerName mail.domain.com 設置環境變量,並啓動: echo 'export PATH=/usr/local/apache/bin:$PATH' /etc/profile echo "/usr/local/apache/bin/apachectl start" /etc/rc.local export PATH=/usr/local/apache/bin:$PATH apachectl start * php 安裝: cd $PKG_DIR tar jxf src/php-* cd php-* ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --with-mysql=/usr/local/mysql make make install cp php.ini-recommended /usr/local/apache/conf/php.ini 配置apache(/usr/local/apache/conf/httpd.conf): DirectoryIndex index.php index.html index.html.var LoadModule php4_module modules/libphp4.so AddType application/x-httpd-php .php 重啓apache: apachectl restart * mysql 安裝: groupadd -g 3306 mysql useradd -u 3306 -g mysql -M -d /nonexistent mysql cd /usr/local tar zxf $PKG_DIR/src/mysql-standard-* mv mysql-standard-* mysqld cd mysql chown -R root ./ chown -R mysql data chgrp -R mysql ./ scripts/mysql_install_db --user=mysql cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql chmod 755 /etc/rc.d/init.d/mysql chkconfig --add mysql 設置環境變量,並啓動: echo 'export PATH=/usr/local/mysql/bin:$PATH' /etc/profile service mysql start 更改初始密碼: export PATH=/usr/local/mysql/bin:$PATH mysqladmin -u root password 'mysqlpwd' * daemontools daemontools是一個收集可管理的UNIX服務的工具。 網址:http://cr.yp.to/daemontools.html mkdir /package chmod 1755 /package cd /package tar zxf $PKG_DIR/src/daemontools-0.76.tar.gz cd admin/daemontools-0.76 patch -p1 package/install * ucspi-tcp ucspi-tcp包括tcpserver和tcpclient,是一個建立client-server應用程序的命令行工具。 網址:http://cr.yp.to/ucspi-tcp.html cd $PKG_DIR tar zxf src/ucspi-tcp-0.88.tar.gz cd ucspi-tcp-0.88 patch -p1 make make setup check * netqmail netqmail是qmail加上一些推薦的最基本的補丁。 網址:http://qmail.org/netqmail/ mkdir /var/qmail groupadd nofiles useradd -g nofiles -d /var/qmail/alias alias useradd -g nofiles -d /var/qmail qmaild useradd -g nofiles -d /var/qmail qmaill useradd -g nofiles -d /var/qmail qmailp groupadd qmail useradd -g qmail -d /var/qmail qmailq useradd -g qmail -d /var/qmail qmailr useradd -g qmail -d /var/qmail qmails # 注:有些RedHat/Fedora版本需要執行以下命令才能安裝成功 ln -s /usr/kerberos/include/com_err.h /usr/kerberos/include/krb5.h /usr/kerberos/include/profile.h /usr/include/ cd $PKG_DIR/netqmail-1.05/netqmail-1.05 make make setup check echo 3 /var/qmail/control/spfbehavior echo 20 /var/qmail/control/concurrencyincoming chmod 644 /var/qmail/control/concurrencyincoming echo ./Maildir/ /var/qmail/control/defaultdelivery echo postmaster@$DOMAIN /var/qmail/alias/.qmail-root echo postmaster@$DOMAIN /var/qmail/alias/.qmail-postmaster echo postmaster@$DOMAIN /var/qmail/alias/.qmail-mailer-daemon chmod 644 /var/qmail/alias/.qmail* ./config-fast mail.$DOMAIN * vpopmail vpopmail是一個基于qmail的郵件虛擬域軟件。 網址:http://vpopmail.sf.net/ 設置安裝環境: groupadd -g 89 vchkpw useradd -u 89 -g vchkpw vpopmail mkdir /home/vpopmail/etc cd /home/vpopmail/etc echo "$DOMAIN" defaultdomain echo '127.:allow,RELAYCLIENT=""' tcp.smtp tcprules tcp.smtp.cdb tcp.smtp.tmp echo "localhost|0|vpopuser|vpoppwd|vpopmail" vpopmail.mysql chmod 640 vpopmail.mysql chown -R vpopmail:vchkpw ./ mysql -u root --password="mysqlpwd" CREATE DATABASE vpopmail; GRANT select,insert,update,delete,create,drop ON vpopmail.* TO vpopuser@localhost IDENTIFIED BY 'vpoppwd'; FLUSH PRIVILEGES; QUIT EOF 安裝: cd $PKG_DIR tar zxf src/vpopmail-* cd vpopmail-* ./configure --enable-domainquotas --enable-auth-module=mysql --enable-libdir=/usr/local/mysql/lib --enable-incdir=/usr/local/mysql/include --enable-mysql-limits --enable-sql-logging --enable-logging=v --enable-valias make make install-strip 設置郵箱空間警告: echo "郵件被拒絕,用戶的郵箱已滿。" /home/vpopmail/domains/.over-quota.msg cat /home/vpopmail/domains/.quotawarn.msg From: 郵箱管理員 Reply-To: Subject: 郵箱空間警告 您的郵箱空間已經達到90%。如果想繼續使用,請刪除一些信件。 如需幫助,請聯系郵箱管理員。 Email : postmaster@$DOMAIN EOF 添加虛擬域和用戶: echo 'export PATH=/home/vpopmail/bin:$PATH' /etc/profile export PATH=/home/vpopmail/bin:$PATH vadddomain -q 100M $DOMAIN pmpwd vmoddomlimits -q 100M $DOMAIN vadduser user userpwd #!/bin/sh #A simple vadduser script cat user.txt | while read NAME USER PASSWORD do vadduser -c $NAME $USER $PASSWORD done 安裝選項參考: vpopmail 5.4.10 Current settings --------------------------------------- vpopmail directory = /home/vpopmail uid = 89 gid = 89 roaming users = OFF --disable-roaming-users (default) password learning = OFF --disable-learn-passwords (default) md5 passwords = ON --enable-md5-passwords (default) file locking = ON --enable-file-locking (default) vdelivermail fsync = OFF --disable-file-sync (default) make seekable = ON --enable-make-seekable (default) clear passwd = ON --enable-clear-passwd (default) user dir hashing = ON --enable-users-big-dir (default) address extensions = OFF --disable-qmail-ext (default) ip alias = OFF --disable-ip-alias-domains (default) domain quotas = ON --enable-domainquotas auth module = mysql --enable-auth-module=mysql mysql replication = OFF --disable-mysql-replication (default) sql logging = ON --enable-sql-logging mysql limits = ON --enable-mysql-limits MySQL valias = ON --enable-valias auth inc = -I/usr/local/mysql/include auth lib = -L/usr/local/mysql/lib -lmysqlclient -lz -lm system passwords = OFF --disable-passwd (default) pop syslog = log success and errors including passwords --enable-logging=v auth logging = ON --enable-auth-logging (default) all domains in one SQL table = --enable-many-domains (default) * toaster Bill's Qmail Toaster。 網址:http://shupp.org/ 安裝: cd $PKG_DIR tar zxf src/toaster-scripts-0.8.tar.gz cd netqmail-1.05/netqmail-1.05 bunzip2 -c ../../src/qmail-toaster-0.8.patch.bz2 | patch -p0 make clean make make setup check make cert make tmprsadh chown -R vpopmail:vchkpw /var/qmail/spam crontab -e SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=postmaster@domain.com HOME=/root 0 0 * * * /var/qmail/bin/update_tmprsadh /dev/null 2%26amp;1 添加運行腳本: cd $PKG_DIR mkdir -p /var/qmail/supervise/qmail-send/log mkdir -p /var/qmail/supervise/qmail-smtpd/log mkdir -p /var/qmail/supervise/qmail-pop3d/log mkdir -p /var/qmail/supervise/qmail-pop3ds/log cp toaster-scripts-0.8/send.run /var/qmail/supervise/qmail-send/run cp toaster-scripts-0.8/send.log.run /var/qmail/supervise/qmail-send/log/run cp toaster-scripts-0.8/smtpd.run /var/qmail/supervise/qmail-smtpd/run cp toaster-scripts-0.8/smtpd.log.run /var/qmail/supervise/qmail-smtpd/log/run cp toaster-scripts-0.8/pop3d.run /var/qmail/supervise/qmail-pop3d/run cp toaster-scripts-0.8/pop3d.log.run /var/qmail/supervise/qmail-pop3d/log/run cp toaster-scripts-0.8/pop3ds.run /var/qmail/supervise/qmail-pop3ds/run cp toaster-scripts-0.8/pop3ds.log.run /var/qmail/supervise/qmail-pop3ds/log/run chmod 755 /var/qmail/supervise/qmail-send/run chmod 755 /var/qmail/supervise/qmail-send/log/run chmod 755 /var/qmail/supervise/qmail-smtpd/run chmod 755 /var/qmail/supervise/qmail-smtpd/log/run chmod 755 /var/qmail/supervise/qmail-pop3d/run chmod 755 /var/qmail/supervise/qmail-pop3d/log/run chmod 755 /var/qmail/supervise/qmail-pop3ds/run chmod 755 /var/qmail/supervise/qmail-pop3ds/log/run mkdir -p /var/log/qmail/smtpd mkdir -p /var/log/qmail/pop3d mkdir -p /var/log/qmail/pop3ds chown -R qmaill /var/log/qmail cp toaster-scripts-0.8/rc /var/qmail cp toaster-scripts-0.8/qmailctl /var/qmail/bin cp toaster-scripts-0.8/vpopmailctl /var/qmail/bin/vpopmailctl chmod 755 /var/qmail/rc chmod 755 /var/qmail/bin/qmailctl chmod 755 /var/qmail/bin/vpopmailctl ln -s /var/qmail/bin/qmailctl /usr/bin ln -s /var/qmail/bin/vpopmailctl /usr/bin ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail ln -s /var/qmail/bin/sendmail /usr/lib/sendmail 啓動: ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service ln -s /var/qmail/supervise/qmail-pop3d /var/qmail/supervise/qmail-pop3ds /service 相關命令: qmailctl {start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help} vpopmailctl {start|stop|restart|stat|pause|cont|help} 到這裏qmail安裝完成,可用outlook或foxmail進行測試。 * courier-imap Courier-IMAP支持通過IMAP/SIMAP訪問郵件系統。 網址:http://www.courier-mta.org/ 安裝Courier認證庫: cd $PKG_DIR tar jxf src/courier-authlib-0.58.tar.bz2 cd courier-authlib-0.58 ./configure --with-redhat # 注: RedHat/Fedora需要加"--with-redhat"選項 make make install-strip make install-configure cp courier-authlib.sysvinit /etc/init.d/courier-authlib chmod 755 /etc/init.d/courier-authlib chkconfig --add courier-authlib 安裝Courier-IMAP: cd $PKG_DIR tar jxf src/courier-imap-4.0.6.tar.bz2 cd courier-imap-4.0.6 chown -R vpopmail:vchkpw ./ su vpopmail ./configure --with-redhat # 注: RedHat/Fedora需要加"--with-redhat"選項 make exit make install-strip make install-configure cp courier-imap.sysvinit /etc/init.d/courier-imap chmod 755 /etc/init.d/courier-imap chkconfig --add courier-imap 設置: cd /usr/local/etc/authlib sed -i".bak" 's/^authmodulelist=.*/authmodulelist="authvchkpw"/g' authdaemonrc cd /usr/lib/courier-imap/etc sed -i".bak" "s/^IMAPDSTART=.*/IMAPDSTART=YES/g;s/^MAXPERIP=.*/MAXPERIP=500/g" imapd sed -i".bak" "s/^IMAPDSSLSTART=.*/IMAPDSSLSTART=YES/g" imapd-ssl sed -i".bak" "s/^CN=.*/CN=mail.$DOMAIN/g;s/^emailAddress=.*/emailAddress=postmaster@$DOMAIN/g" imapd.cnf 啓動: service courier-authlib start service courier-imap start * autorespond autorespond是一個自動回複工具。 網址:http://qmailadmin.sf.net 安裝: cd $PKG_DIR tar zxf src/autorespond-2.0.4.tar.gz cd autorespond-2.0.4 patch -p1 make make install * ezmlm ezmlm是一個快速,強大的郵件列表程序。 網址:http://www.ezmlm.org/ 安裝: cd $PKG_DIR tar zxf src/ezmlm-0.53.tar.gz tar zxf src/ezmlm-idx-0.443.tar.gz mv -f ezmlm-idx-0.443/* ezmlm-0.53/ cd ezmlm-0.53 patch -p0 make make man make ch_GB make setup * qmailadmin qmailadmin除了不能添加刪除虛擬域外,幾乎可以完成所有其他的虛擬域管理。 網址:http://qmailadmin.sf.net 安裝: cd $PKG_DIR tar zxf src/qmailadmin-1.2.9.tar.gz tar zxf src/qmailadmin-help-1.0.8.tar.gz cd qmailadmin-1.2.9 ./configure --enable-htmldir=/usr/local/apache/htdocs --enable-cgibindir=/usr/local/apache/cgi-bin --enable-maxusersperpage=20 --enable-maxaliasesperpage=20 --enable-domain-autofill --enable-modify-quota --enable-help --disable-ezmlm-mysql make make install-strip cd /usr/local/share/qmailadmin/lang mv en en.bak cp zh-cn en cd $PKG_DIR cp -r qmailadmin-help-1.0.8 /usr/local/apache/htdocs/images/qmailadmin/help 測試: http://mail.domain.com/cgi-bin/qmailadmin 安裝選項參考: qmailadmin 1.2.9 Current settings --------------------------------------- cgi-bin dir = /usr/local/apache/cgi-bin html dir = /usr/local/apache/htdocs image dir = /usr/local/apache/htdocs/images/qmailadmin image URL = /images/qmailadmin template dir = /usr/local/share/qmailadmin qmail dir = /var/qmail vpopmail dir = /home/vpopmail autorespond dir = /usr/local/bin ezmlm dir = /usr/local/bin/ezmlm ezmlm idx = yes mysql for ezmlm = no help = yes modify quota = yes domain autofill = yes modify spam check = no * igenus 這是國內一個開源的webmail。 網址:http://www.igenus.org 安裝: cd /usr/local/apache/htdocs tar zxf $PKG_DIR/src/igenus* 配置(/usr/local/apache/htdocs/igenus/config/config_inc.php): // 安裝位置 $CFG_BASEPATH = "/usr/local/apache/htdocs/igenus"; // 數據庫賬號 $CFG_MYSQL_HOST = 'localhost'; $CFG_MYSQL_USER = 'vpopuser'; $CFG_MYSQL_PASS = 'vpoppwd'; $CFG_MYSQL_DB = 'vpopmail'; // 臨時目錄 $CFG_TEMP = $CFG_BASEPATH."/temp"; // autorespond的位置 $CFG_AUTORESPOND_PROM = "/usr/bin/autorespond"; // 網絡目錄 $CFG_NETDISK_PATH = $CFG_BASEPATH."/netdisk"; 創建相關目錄: cd /usr/local/apache/htdocs/igenus mkdir temp netdisk chown -R vpopmail:vchkpw ./ 修改並導入表: mysql -uroot --password="mysqlpwd" alter table vpopmail.vpopmail drop primary key; alter table vpopmail.vpopmail add column pw_id int(5) unsigned NOT NULL PRIMARY KEY auto_increment; alter table vpopmail.vpopmail add KEY pw_name (pw_name,pw_domain); QUIT EOF mysql -uroot --password="mysqlpwd" -f vpopmail 修改apache配置文件(/usr/local/apache/conf/httpd.conf): User vpopmail Group vchkpw 修改php配置文件(/usr/local/apache/conf/php.ini): register_globals = On session.auto_start = 1 session.bug_compat_warn = 0 max_execution_time = 60 memory_limit = 20M upload_max_filesize = 10M post_max_size = 10M log_errors = Off Sendmail = /var/qmail/bin/qmail-inject 重啓apache: apachectl restart 測試: http://mail.domain.com/igenus * squirrelmail squirrelmail是一個基于imap的webmail。 網址:http://www.squirrelmail.org 安裝: cd $PKG_DIR tar jxf src/squirrelmail-* tar zxf src/quota_usage-* cd squirrelmail-* tar zxf ../src/all_locales-* cp ../quota_usage/config.php.sample ../quota_usage/config.php mv ../quota_usage plugins ./configure 1. 1. Domain 1. 4. Domain WebMail $version 1. 7. http://www.Domain.com/ 1. 8. Domain Corp.,Ltd 2. 1. domain.com 2. A. 8. courier 2. B. 7. login 3. 3. INBOX.垃圾箱 3. 4. INBOX.發件箱 3. 5. INBOX.草稿箱 8. 11 10. 1. zh_CN 10. 2. gb2312 s q cd ../ mv squirrelmail-* /usr/local/apache/htdocs/squirrel chown -R vpopmail:vchkpw /usr/local/apache/htdocs/squirrel 修改apache配置文件(/usr/local/apache/conf/httpd.conf): User vpopmail Group vchkpw 重啓apache: apachectl restart 測試: http://mail.domain.com/squirrel * spamassassin squirrel是一個垃圾郵件過濾程序。 網址:http://spamassassin.apache.org/ 安裝: cd /root perl -MCPAN -e shell o conf prerequisites_policy ask install Digest::SHA1 install DB_File install Net::DNS install Mail::SPF::Query install IP::Country install Razor2 install Net::Ident install IO::Socket::INET6 install IO::Socket::SSL install Time::HiRes install DBI install Archive::Tar install IO::Zlib install Mail::SpamAssassin cd $PKG_DIR cp toaster-scripts-0.8/local.cf /etc/mail/spamassassin/local.cf mkdir /etc/mail/spamassassin/.spamassassin chown vpopmail /etc/mail/spamassassin/.spamassassin mkdir -p /var/qmail/supervise/spamd/log /var/log/spamd chown qmaill /var/log/spamd cp toaster-scripts-0.8/spamd.run /var/qmail/supervise/spamd/run cp toaster-scripts-0.8/spamd.log.run /var/qmail/supervise/spamd/log/run chmod 755 /var/qmail/supervise/spamd/run chmod 755 /var/qmail/supervise/spamd/log/run ln -s /var/qmail/supervise/spamd /service * clamav clamav是一個開源的防毒軟件。 網址:http://www.clamav.net/ 安裝: groupadd clamav useradd clamav -g clamav -M -d /nonexistent cd $PKG_DIR tar zxf src/clamav-0.87.1.tar.gz cd clamav-0.87.1 patch -p0 patch -p0 patch -p0 ./configure make make install 在daemontools下運行clamd: cd $PKG_DIR mkdir -p /var/qmail/supervise/clamd/log /var/log/clamd chown clamav /var/log/clamd cp toaster-scripts-0.8/clamd.run /var/qmail/supervise/clamd/run cp toaster-scripts-0.8/clamd.log.run /var/qmail/supervise/clamd/log/run chmod 755 /var/qmail/supervise/clamd/run chmod 755 /var/qmail/supervise/clamd/log/run ln -s /var/qmail/supervise/clamd /service 病毒庫升級程序: cd $PKG_DIR touch /var/log/freshclam.log chmod 600 /var/log/freshclam.log chown clamav /var/log/freshclam.log cp toaster-scripts-0.8/freshclam /etc/init.d/freshclam chmod 755 /etc/init.d/freshclam ln -s ../init.d/freshclam /etc/rc0.d/K30freshclam ln -s ../init.d/freshclam /etc/rc1.d/K30freshclam ln -s ../init.d/freshclam /etc/rc2.d/S80freshclam ln -s ../init.d/freshclam /etc/rc3.d/S80freshclam ln -s ../init.d/freshclam /etc/rc4.d/S80freshclam ln -s ../init.d/freshclam /etc/rc5.d/S80freshclam ln -s ../init.d/freshclam /etc/rc6.d/K30freshclam /etc/init.d/freshclam start * simscan simscan是qmail的垃圾郵件和病毒掃描引擎。 網址:http://www.inter7.com/simscan/ 安裝ripmime: cd $PKG_DIR tar zxf src/ripmime-1.4.0.5.tar.gz cd ripmime-1.4.0.5 make make install 安裝simscan: cd $PKG_DIR tar zxf src/simscan-1.1.tar.gz cd simscan-1.1 ./configure --enable-user=clamav --enable-clamav=y --enable-spam=y --enable-spam-passthru=y --enable-per-domain=y --enable-ripmime --enable-attach=y --enable-received=y make make install-strip echo ":clam=yes,spam=yes,spam_passthru=yes,attach=.vbs:.lnk:.scr:.wsh:.hta:.pif" /var/qmail/control/simcontrol /var/qmail/bin/simscanmk /var/qmail/bin/simscanmk -g echo ':allow,QMAILQUEUE="/var/qmail/bin/simscan"' ~vpopmail/etc/tcp.smtp qmailctl cdb; qmailctl restart * qmailmrtg7 qmailmrtg7是一個監測qmail流量的工具。 網址:http://www.inter7.com/qmailmrtg7/ 安裝mrtg: cd $PKG_DIR tar zxf src/mrtg-* cd mrtg-* ./configure --prefix=/usr/local make make install 安裝qmailmrtg7: cd $PKG_DIR tar zxf src/qmailmrtg7-4.2.tar.gz cd qmailmrtg7-4.2 patch -p0 make make install sed -i "s/FQDN/mail.$DOMAIN/g;" qmail.mrtg.cfg sed -i "1s/.*/WorkDir: \/usr\/local\/apache\/htdocs\/qmailmrtg/" qmail.mrtg.cfg cp qmail.mrtg.cfg /etc mkdir /usr/local/apache/htdocs/qmailmrtg indexmaker --section=title /etc/qmail.mrtg.cfg /usr/local/apache/htdocs/qmailmrtg/index.html mrtg /etc/qmail.mrtg.cfg; mrtg /etc/qmail.mrtg.cfg; mrtg /etc/qmail.mrtg.cfg crontab -e */5 * * * * /usr/local/bin/mrtg /etc/qmail.mrtg.cfg /dev/null 測試: http://mail.domain.com/qmailmrtg
󰈣󰈤
 
 
 
>>返回首頁<<
 
 
 
 
 熱帖排行
 
王朝網路微信公眾號
微信掃碼關註本站公眾號 wangchaonetcn
 
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有