12年 linux 系统运维工程师,网络架构设计、优化,故障处理。
分类: LINUX
2011-11-15 16:24:12
5. 安装vpopmail
[root@mail root]# groupadd vchkpw -g 89
[root@mail root]# useradd vpopmail -u 89 -g vchkpw
[root@mail root]# cd /app/src
[root@mail src]# tar -zxf vpopmail-5.4.10.tar.gz
[root@mail src]# cd vpopmail-5.4.10
[root@mail vpopmail-5.4.10]#
[root@mail vpopmail-5.4.10]# mkdir -p /home/vpopmail/etc
[root@mail vpopmail-5.4.10]# echo "happy.com" > /home/vpopmail/etc/defaultdomain
[root@mail vpopmail-5.4.10]# echo '127.0.0.1:allow,RELAYCLIENT=""' > /home/vpopmail/etc/tcp.smtp
[root@mail vpopmail-5.4.10]# cd /home/vpopmail/etc
[root@mail etc]# tcprules tcp.smtp.cdb tcp.smtp.tmp < tcp.smtp
[root@mail etc]# echo "localhost|0|vpopmail|zlwt|vpopmail" > /home/vpopmail/etc/vpopmail.mysql
[root@mail etc]# chmod 640 /home/vpopmail/etc/vpopmail.mysql
[root@mail etc]# chown -R vpopmail.vchkpw /home/vpopmail/etc
[root@mail etc]# mysql -u root -pzlwt
mysql> CREATE DATABASE vpopmail;
Query OK, 1 row affected (0.04 sec)
mysql> GRANT select,insert,update,delete,create,drop ON vpopmail.* TO vpopmail@localhost IDENTIFIED BY 'zlwt';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> QUIT
[root@mail etc]# cd /app/src/vpopmail-5.4.10
[root@mail vpopmail-5.4.10]# ./configure --enable-incdir=/usr/include/mysql \
> --enable-libdir=/usr/lib/mysql --disable-roaming-users --enable-logging=p \
> --disable-passwd --enable-clear-passwd --disable-domain-quotas \
> --enable-auth-module=mysql --enable-auth-logging --enable-sql-logging \
> --disable-valias --disable-mysql-limits --enable-learn-passwords
vpopmail 5.4.10
Current settings
---------------------------------------
vpopmail directory = /home/vpopmail
uid = 89
gid = 89
roaming users = OFF --disable-roaming-users (default)
password learning = ON --enable-learn-passwords
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 = OFF --disable-domainquotas (default)
auth module = mysql --enable-auth-module=mysql
mysql replication = OFF --disable-mysql-replication (default)
sql logging = ON --enable-sql-logging
mysql limits = OFF --disable-mysql-limits (default)
MySQL valias = OFF --disable-valias (default)
auth inc = -I/usr/include/mysql
auth lib = -L/usr/lib/mysql -lmysqlclient -lz -lm
system passwords = OFF --disable-passwd (default)
pop syslog = show failed attempts with clear text password
--enable-logging=p
auth logging = ON --enable-auth-logging (default)
all domains in one SQL table = --enable-many-domains (default)
[root@mail vpopmail-5.4.10]# make
[root@mail vpopmail-5.4.10]# make install-strip
[root@mail vpopmail-5.4.10]# echo 'export PATH=$PATH:/home/vpopmail/bin' >> /etc/profile
[root@mail vpopmail-5.4.10]# source /etc/profile
[root@mail vpopmail-5.4.10]# vadddomain happy.com zlwt
[root@mail vpopmail-5.4.10]# vadduser -q 10485760s chenwenming@happy.com 1234
[root@mail vpopmail-5.4.10]#
[root@mail vpopmail-5.4.10]# vmoduser -c chenwenming
[root@mail vpopmail-5.4.10]# vi /home/vpopmail/domains/.quotawarn.msg
[root@mail vpopmail-5.4.10]# echo "~{SJ<~1;>\>x~},~{SC;'5DSJOd?U
Reply-To: postmaster@domain.com
To: 邮箱用户
Subject: 邮箱空间警告
Mime-Version: 1.0
Content-Type: text/html; charset=gb2312
Content-Transfer-Encoding: base64
您的邮箱空间已经达到90%.如果想继续使用,请删除一些信件.
如果需要帮助,请联系邮箱管理员:
Email : postmaster@domain.com
[root@mail vpopmail-5.4.10]# echo "~{SJ<~1;>\>x~},~{SC;'5DSJOd?U
[root@mail vpopmail-5.4.10]# cp /app/src/toaster-scripts-0.8/vpopmailctl /var/qmail/bin
[root@mail vpopmail-5.4.10]# ln -s /var/qmail/bin/vpopmailctl /usr/bin
[root@mail vpopmail-5.4.10]# chmod 755 /var/qmail/bin/vpopmailctl
[root@mail vpopmail-5.4.10]# cd /app/src/netqmail-1.05/netqmail-1.05
[root@mail netqmail-1.05]# bunzip2 -c /app/src/qmail-toaster-0.7.2.patch.bz2 | patch -p0
[root@mail netqmail-1.05]# make clean
rm -f `cat TARGETS`
[root@mail netqmail-1.05]# make
[root@mail netqmail-1.05]#
[root@mail netqmail-1.05]# qmailctl stop
Stopping qmail...
qmail-send
qmail-smtpd
[root@mail netqmail-1.05]# make setup check
[root@mail netqmail-1.05]# chown -R vpopmail:vchkpw /var/qmail/spam
[root@mail netqmail-1.05]# make cert
Country Name (2 letter code) [GB]:CN
[root@mail root]# cd /app/src/netqmail-1.05/netqmail-1.05
[root@mail netqmail-1.05]# make tmprsadh
[root@mail netqmail-1.05]# chown -R vpopmail:qmail /var/qmail/control/clientcert.pem /var/qmail/control/servercert.pem
# 用"crontab -e"在crontab里增加下面这条,每天晚上更新temp keys
01 01 * * * /var/qmail/bin/update_tmprsadh > /dev/null 2>&1
[root@mail netqmail-1.05]# qmailctl start
Starting qmail
[root@mail netqmail-1.05]#
[root@mail netqmail-1.05]# ln -s /var/qmail/supervise/qmail-pop3d /service
[root@mail netqmail-1.05]# ln -s /var/qmail/supervise/qmail-pop3ds /service
[root@mail netqmail-1.05]#
[root@mail netqmail-1.05]# vpopmailctl start
Starting qmail-pop3d
Starting qmail-pop3ds
[root@mail netqmail-1.05]#
[root@mail root]# cd /app/src
[root@mail src]# tar -xjf courier-authlib-0.55.tar.bz2
[root@mail src]# cd courier-authlib-0.55
[root@mail courier-authlib-0.55]# ./configure --prefix=/usr/local --exec-prefix=/usr/local \
> --with-authvchkpw --without-authldap --without-authmysql --disable-root-check \
> --with-ssl --with-authchange pwdir=/usr/local/libexec/authlib --with-redhat
[root@mail courier-authlib-0.55]# make
[root@mail courier-authlib-0.55]# make install
[root@mail courier-authlib-0.55]# make install-configure
[root@mail courier-authlib-0.55]# vi /usr/local/etc/authlib/authdaemonrc
authmodulelist="authvchkpw"
[root@mail courier-authlib-0.55]# cp courier-authlib.sysvinit /etc/init.d/courier-authlib
[root@mail courier-authlib-0.55]# chmod 755 /etc/init.d/courier-authlib
[root@mail courier-authlib-0.55]# ln -s ../init.d/courier-authlib /etc/rc3.d/S80courier-authlib
[root@mail courier-authlib-0.55]# ln -s ../init.d/courier-authlib /etc/rc5.d/S80courier-authlib
[root@mail courier-authlib-0.55]# /etc/init.d/courier-authlib start
Starting Courier authentication services: authdaemond
[root@mail courier-authlib-0.55]#
[root@mail courier-authlib-0.55]# authtest 1234
Authentication succeeded.
Authenticated: (uid 89, gid 89)
Home Directory: /home/vpopmail/domains/u-happy.com/zhou
Maildir: (none)
Quota: (none)
Encrypted Password: $1$TcWL6BBO$QQGPpi7W3KaPJP6isq26T.
Cleartext Password: 1234
Options: disablewebmail=0,disablepop3=0,disableimap=0
[root@mail courier-authlib-0.55]#
[root@mail courier-authlib-0.55]# cd /app/src
[root@mail src]# tar -xjf courier-imap-4.0.2.tar.bz2
[root@mail src]# cd courier-imap-4.0.2
[root@mail courier-imap-4.0.2]# chown -R vpopmail:vchkpw ../courier-imap-4.0.2
[root@mail courier-imap-4.0.2]# su vpopmail
[vpopmail@mail courier-imap-4.0.2]$ ./configure --with-redhat
[vpopmail@mail courier-imap-4.0.2]$ make
[vpopmail@mail courier-imap-4.0.2]$ exit
exit
[root@mail courier-imap-4.0.2]# make install-strip
[root@mail courier-imap-4.0.2]# make install-configure
[root@mail courier-imap-4.0.2]# cp courier-imap.sysvinit /etc/init.d/courier-imap
[root@mail courier-imap-4.0.2]# chmod 755 /etc/rc.d/init.d/courier-imap
[root@mail courier-imap-4.0.2]# chkconfig --add courier-imap
[root@mail courier-imap-4.0.2]# chkconfig --list courier-imap
courier-imap 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@mail courier-imap-4.0.2]#
[root@mail courier-imap-4.0.2]# vi /usr/lib/courier-imap/etc/imapd
IMAPDSTART=YES
[root@mail courier-imap-4.0.2]# vi /usr/lib/courier-imap/etc/imapd-ssl
IMAPDSSLSTART=YES
[root@mail courier-imap-4.0.2]# vi /usr/lib/courier-imap/etc/imapd.cnf
CN=happy.com
[root@mail courier-imap-4.0.2]# vi /usr/lib/courier-imap/etc/pop3d.cnf
CN=happy.com
[root@mail courier-imap-4.0.2]# /etc/rc.d/init.d/courier-imap start