修改/etc/init.d/httpd
# vi /etc/init.d/httpd(在第两行之后添加如下内容)
#!/bin/sh
#
# Startup script for the Apache Web Server
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache/log/httpd.pid
# config: /usr/local/apache/conf/httpd.conf
# vi /usr/local/apache/conf/httpd.conf
把
User nobody
Group #-1
改为
User vmail
Group vmail
# wget http://high5.net/postfixadmin/do ... tfixadmin-2.1.0.tgz
# tar -zxvf postfixadmin-2.1.0.tgz
# mv postfixadmin-2.1.0 /var/www/postfixadmin
更改权限,假定运行apache的用户和组为vmail
# chown -R vmail:vmail /var/www/postfixadmin
# cd /var/www/postfixadmin
# chmod 640 *.php *.css
# cd /var/www/postfixadmin/admin/
# chmod 640 *.php .ht*
# cd /var/www/postfixadmin/images/
# chmod 640 *.gif *.png
# cd /var/www/postfixadmin/languages/
# chmod 640 *.lang
# cd /var/www/postfixadmin/templates/
# chmod 640 *.tpl
# cd /var/www/postfixadmin/users/
# chmod 640 *.php
建立mysql表
# cd /var/www/postfixadmin
# mysql -u root [-p] < DATABASE_MYSQL.TXT
# cp config.inc.php.sample config.inc.php
# vi config.inc.php
本例中的配置如下:
// Language config
// Language files are located in './languages'.
$CONF['default_language'] = 'cn';
// Database Config
// 'database_type' is for future reference.
$CONF['database_type'] = 'mysql';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfixadmin';
$CONF['database_password'] = 'postfixadmin';
$CONF['database_name'] = 'postfix';
//$CONF['encrypt'] = 'md5crypt';
$CONF['encrypt'] = 'cleartext';
// Mailboxes
// If you want to store the mailboxes per domain set this to 'YES'.
// Example: /usr/local/virtual/domain.tld/username@domain.tld
$CONF['domain_path'] = 'YES';
// If you don't want to have the domain in your mailbox set this to 'NO'.
// Example: /usr/local/virtual/domain.tld/username
$CONF['domain_in_mailbox'] = 'NO';
// Quota
// When you want to enforce quota for your mailbox users set this to 'YES'.
$CONF['quota'] = 'YES';
// You can either use '1024000' or '1048576'
$CONF['quota_multiplier'] = '1024000';
运行maildrop -v应该有如下提示信息:
maildrop 1.8.0 Copyright 1998-2004 Double Precision, Inc.
GDBM extensions enabled.
Courier Authentication Library extension enabled.
Maildir quota extension enabled.
This program is distributed under the terms of the GNU General Public
License. See COPYING for additional information.
新建/etc/maildroprc文件
# vi /etc/maildroprc
logfile "/var/mailbox/maildrop.log"
to "$HOME$DEFAULT"
# chmod a+r /etc/maildroprc
配置Postfix
# vi /etc/postfix/main.cf
virtual_transport = maildrop
maildrop_destination_recipient_limit = 1
# vi /etc/postfix/master.cf
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/local/maildrop/bin/maildrop -w 90 -d ${recipient}
由于maildrop没有建立maildir的功能,因此由一小断脚本实现
# vi /etc/sudoers
vmail ALL = NOPASSWD: /usr/sbin/maildirmake.sh
新建/usr/sbin/maildirmake.sh文件
# vi /usr/sbin/maildirmake.sh
#!/bin/bash
set -e
if [ ! -f /var/mailbox/$1 ]
then
mkdir /var/mailbox/$1
fi
chown -R vmail:vmail /var/mailbox/$1
cd "/var/mailbox/$1"
/usr/local/imap/bin/maildirmake $2
chown -R 1001:12345 /var/mailbox/$1/$2
chmod -R g=s /var/mailbox/$1/$2
# chmod 755 /usr/sbin/maildirmake.sh
更改postfixadmin/admin目录下的create-mailbox.php文件
在此文件的200行后加一行:
# vi /var/www/postfixadmin/admin/create-mailbox.php
system("sudo /usr/sbin/maildirmake.sh $fDomain ".$_POST['fUsername']);
配置squirrelmail
# cd /var/www/squirrelmail
# ./configure
进入10. Languages
把1. Default Language : 的en_US改成zh_CN。
进入8. Plugins,添加这三个插件
打开浏览器输入http://192.168.0.5/squirrelmail/,用test@test.com登陆,你将会在屏幕的左上角看到邮箱的使用情况,你还会看到一条警告信息:
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /var/www/squirrelmail/plugins/change_mysqlpass/functions.php on line 129
这是由于数据库结构不一致造成的,你只要把functions.php中的129行注释调即可(在行首加//)。
现在你还可以用选项中的change passwd修改你的密码了,不过这个模块是英文的,如果你想改成中文的,可以自己修改,squirrelmail网站上有介绍。或者请参考: http://datastrategy.org/number5/archives/000241.html
1、把change_mysqlpass.po与locale/zh_CN/LC_MESSAGES/squirrelmail.po合并
最简单的方法就是:
# cat change_mysqlpass.po >;>; /var/www/squirrelmail/locale/zh_CN/LC_MESSAGES/squirrelmail.po
2、执行:
# cd /var/www/squirrelmail/locale/zh_CN/LC_MESSAGES/
# msgfmt -o squirrelmail.mo squirrelmail.po
安装DBD-mysql
# wget http://search.cpan.org/CPAN/auth ... mysql-2.9006.tar.gz
# tar zxvf DBD-mysql-2.9006.tar.gz
# cd DBD-mysql-2.9006
# export LANG='C'
# ln -s /usr/local/mysql/bin/mysql_config /usr/bin/mysql_config
# perl Makefile.PL \
--libs="-L/usr/local/mysql/lib/mysql -lmysqlclient -lz" \
--cflags=-I/usr/local/mysql/include/mysql \
--testhost=127.0.0.1
# make
# make test # Some minor error messages can be ignored here
# make install
加入openwebmail的权限,编辑httpd.con,加入如下内容,假设/var/www/cgi-bin是apache的cgi-bin目录
# vi /usr/local/apache/conf/httpd.conf
ScriptAlias /openwebmail "/var/www/cgi-bin/openwebmail/openwebmail.pl"
存盘后重新启动apache
# service httpd restart
编辑mysql认证文件
# vi /var/www/cgi-bin/openwebmail/auth/auth_mysql.pl
my $SQLHost = 'localhost';
my $sqlusr = 'postfix';
my $sqlpwd = 'postfix';
my $auth_db = 'postfix';
my $auth_table = 'mailbox';
my $field_username = 'username';
my $field_password = 'password';
my $field_realname = 'name';
my $field_uid = '1001';
my $field_gid = '1001';
my $field_home = 'maildir';
my $pass_type = 'cleartxt';
编辑openwebmail主配置文件
# vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
domainnames auto
auth_module auth_mysql.pl
auth_withdomain yes
mailspooldir /var/mailbox
create_syshomedir new
use_syshomedir new
ow_cgidir /var/www/cgi-bin/openwebmail
ow_usersdir /var/mailbox
ow_cgiurl /cgi-bin/openwebmail
ow_htmldir /var/www/data/openwebmail
ow_htmlurl /data/openwebmail
logfile /var/log/openwebmail.log
11.安装clamav 0.84
# wget http://jaist.dl.sourceforge.net/ ... /clamav-0.84.tar.gz
# tar zxvf clamav-0.84.tar.gz
# cd clamav-0.84
# groupadd clamav
# useradd -g clamav -s/bin/false -d/dev/null clamav
# ./configure --prefix=/usr/local/clamav --with-dbdir=/usr/local/share/clamav
# make
# make check
# make install
编辑/usr/local/clamav/etc/clamd.conf
# vi /usr/local/clamav/etc/clamd.conf
#Verbose logging with syslog
LogSyslog
LogVerbose
LogFacility LOG_MAIL
LogFile /var/log/clamav/clamd.log
#Change pid file location
PidFile /var/run/clamav/clamd.pid
DatabaseDirectory /usr/local/share/clamav
#Set the clamav socket
LocalSocket /var/run/clamav/clamd
#Close the connection when this limit is exceeded
StreamMaxLength 10M
#Don't run clamd as root
User amavis
#Newer versions require you to uncomment this
ScanMail
ScanArchive
编辑/usr/local/clamav/etc/freshclam.conf
# vi /usr/local/clamav/etc/freshclam.conf
DatabaseDirectory /usr/local/share/clamav
UpdateLogFile /var/log/clamav/freshclam.log
LogSyslog
LogVerbose
DatabaseOwner amavis
#Check for updates every two hours. That is the official recommendation
Checks 12
DatabaseMirror db.CN.clamav.net
DatabaseMirror database.clamav.net
NotifyClamd
15.启动脚本
postfix的启动脚本:
# cat /etc/rc.d/init.d/postfix
#!/bin/bash
#
# mailsys This shell script takes care of starting and stopping Postfix
# author : xingyu.wang <wxy@cngnu.org>; 2004/1/28
#
# chkconfig: 2345 80 30
# description: Postfix is a Mail Transport Agent, which is the program
# that moves mail from one machine to another.
#
# processname: mailsys
# pidfile: /var/run/postfix.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/postfix
success $"$prog stop"
else
failure $"$prog stop failure"
fi
echo
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $RETVA
# chmod 755 /etc/rc.d/init.d/postfix
# chkconfig --level 0123456 postfix on
clamav的启动脚本(有问题)
# cat /etc/rc.d/init.d/clamd
#!/bin/bash
#
# clamav: This script controls the clamd
#