系统所有环境都是采用yum安装
安装系统时设置标准的主机名mail.hamigua.com改变系统语言
vi /etc/sysconfig/i18nLANG="en_US"
#LANG="zh_CN.UTF-8"
SUPPORTED="zh_CN.UTF-8:zh_CN:zh:zh_TW.UTF-8:zh_TW:zh:en_US.UTF-8:en_US:en"
SYSFONT="latarcyrheb-sun16"关闭selinux
vi /etc/selinux/config
去除IPV6 vi /etc/modprobe.confalias net-pf-10 off
alias ipv6 off修改网关
vi /etc/sysconfig/network 设IP
vi /etc/sysconfig/network-scripts/ifcfg-eth0 定义yum的非官方库
vi /etc/yum.repos.d/dag.repo[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt关闭不需要的服务
chkconfig mcstrans off
chkconfig restorecond off
chkconfig ip6tables off
chkconfig iptables off
chkconfig netfs off 安装必需软件
yum -y install ntsysv ntp telnet wget rsync vixie-cron logwatch perl-Unix-Syslog perl-Net-Daemon perl-PlRPC perl-DBI perl-DBD-MySQL freetype-demos freetype-devel libart_lgpl-devel libpng libpng-devel perl-Time-HiRes perl-Time-HiRes-Value perl-File-Tail perl-libwww-perl perl-HTML-Parser perl-HTML-Tagset perl-IO-stringy perl-IO-Multiplex perl-MailTools perl-TimeDate perl-Convert-ASN1 perl-Convert-BinHex perl-MIME-tools perl-FCGI perl-GD rrdtool rrdtool-perl apr-devel apr-docs apr-util-devel apr-util-docs giflib libgdiplus mono-core dbus-sharp dbus-sharp-devel dbus-glib-devel dbh dbh-devel pcre pcre-devel httpd httpd-devel httpd-manual mysql mysql-devel mysql-server cyrus-sasl cyrus-sasl-plain bind bind-chroot amavisd-new clamd clamav clamav-db spamassassin bison bzip2-devel expect fam-devel flex freetype-devel gcc gcc-c++ gdbm-devel libc-client-devel libjpeg-devel libmcrypt libmcrypt-devel libpng-devel libxslt-devel make rpm-build mod_ssl php php-gd php-mysql php-mbstring php-mcrypt phpmyadmin perl-Mon perl-Authen-PAM perl-Filter perl-Net_SSLeay.pm perl-Convert-BER perl-URI perl-XML-SAX perl-Crypt-Blowfish perl-Crypt-CBC perl-Date-Calc ncurses-devel net-snmp-devel libtool openssl openssl-devel openssl-perl pam-devel pkgconfig postgresql-devel zlib-devel 启动mysql和apahce
chkconfig httpd on
chkconfig mysqld on 升级包
yum -y update 重启系统
reboot 重新生成rpm包安装postfix
cd /usr/local/src
wget http://mirror.centos.org/centos/ ... fix-2.3.3-2.src.rpm
rpm -ivh postfix-2.3.3-2.src.rpm
cd /usr/src/redhat/SPECS
vi postfix.spec%define LDAP 2
%define MYSQL 1
%define PCRE 1
%define SASL 2
%define TLS 1
%define IPV6 0rpmbuild -bb postfix.spec
rpm -Uvh /usr/src/redhat/RPMS/i386/postfix-2.3.* 新建邮件用户、组
/usr/sbin/groupadd -g 1000 vgroup
/usr/sbin/useradd -g 1000 -u 1000 -M -s /bin/false vuser 安装courier-authlib
cd /usr/local/src
wget http://downloads.sourceforge.net ... hlib-0.61.0.tar.bz2
tar jxvf courier-authlib-0.61.0.tar.bz2
cd courier-authlib-0.61.0./configure
--prefix=/usr/local/courier-authlib
--without-stdheaderdir
--without-authuserdb
--without-authpam
--without-authldap
--without-authpwd
--without-authshadow
--without-authvchkpw
--without-authpgsql
--without-authcustom
--with-authmysql
--with-redhat
make
make install
make install-configure
echo "/usr/local/courier-authlib/lib/courier-authlib" >> /etc/ld.so.confldconfig
ldconfig -v
cp courier-authlib.sysvinit /etc/rc.d/init.d/courier-authlib
chmod 755 /etc/rc.d/init.d/courier-authlib
chkconfig --add courier-authlib
chkconfig courier-authlib on
chmod 755 /usr/local/courier-authlib/var/spool/authdaemon
mv /usr/local/courier-authlib/etc/authlib/authmysqlrc /usr/local/courier-authlib/etc/authlib/authmysqlrc.bak vi /usr/local/courier-authlib/etc/authlib/authmysqlrcMYSQL_SERVER localhost
MYSQL_USERNAME extmail
MYSQL_PASSWORD ext00mail
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_PORT 3306
MYSQL_OPT 0
MYSQL_DATABASE extmail
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD uidnumber
MYSQL_GID_FIELD gidnumber
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD homedir
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD maildir
MYSQL_QUOTA_FIELD quota
MYSQL_SELECT_CLAUSE SELECT username,password,"",uidnumber,gidnumber,
CONCAT('/home/domains/',homedir),
CONCAT('/home/domains/',maildir),
quota,
name,
CONCAT("disableimap=",disableimap,",disablepop3=",
disablepop3,",disablewebmail=",disablewebmail,
",disablesmtpd=",disablesmtpd,",disablesmtp=",
disablesmtp,",disablenetdisk=",disablenetdisk,
",netdiskquota=",netdiskquota)
FROM mailbox
WHERE username = '$(local_part)@$(domain)'
DEFAULT_DOMAIN hamigua.com 设置smtpd
vi /usr/lib/sasl2/smtpd.confpwcheck_method: authdaemond
log_level: 3
mech_list: PLAIN LOGIN
authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket
service courier-authlib start
ln -s /usr/local/courier-authlib/bin/courierauthconfig /usr/bin/courierauthconfig 安装maildorp
cd /usr/local/src
wget http://downloads.sourceforge.net/courier/maildrop-2.0.4.tar.bz2
tar jvxf maildrop-2.0.4.tar.bz2
cd maildrop-2.0.4./configure
--enable-sendmail=/usr/sbin/sendmail
--enable-trusted-users='root vuser'
--enable-syslog=1
--enable-maildirquota
--enable-maildrop-uid=1000
--enable-maildrop-gid=1000
--with-trashquota
--with-dirsync
make
make install
maildrop -v 安装courier-imap
cd /usr/local/src
wget http://downloads.sourceforge.net ... -imap-4.4.1.tar.bz2
tar jvxf courier-imap-4.4.1.tar.bz2
cd courier-imap-4.4.1./configure
--prefix=/usr/local/courier-imap
--with-redhat
--enable-unicode
--disable-root-check
--with-trashquota
--without-ipv6 COURIERAUTHCONFIG='/usr/local/courier-authlib/bin/courierauthconfig'
make
make installcp /usr/local/courier-imap/etc/imapd.dist /usr/local/courier-imap/etc/imapd
cp /usr/local/courier-imap/etc/imapd-ssl.dist /usr/local/courier-imap/etc/imapd-ssl
cp /usr/local/courier-imap/etc/pop3d.dist /usr/local/courier-imap/etc/pop3d
cp /usr/local/courier-imap/etc/pop3d-ssl.dist /usr/local/courier-imap/etc/pop3d-ssl
cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imapd
chmod 755 /etc/rc.d/init.d/courier-imapd
chkconfig --add courier-imapd 配置pop
vi /usr/local/courier-imap/etc/pop3dPOP3DSTART=YES
MAXDAEMONS=512
MAXPERIP=4000将extmail,extman,slock安装包上传 安装extmail
cd /usr/local/src
mkdir /var/www/extsuite
tar -zxvf extmail-1.0.5.tar.gz
cp -r extmail-1.0.5 /var/www/extsuite/extmail
cd /var/www/extsuite/extmail
cp webmail.cf.default webmail.cf
chown -R vuser:vgroup /var/www/extsuite/extmail/cgi/ 配置extmailsed -i "s#SYS_MYSQL_USER = db_user#SYS_MYSQL_USER = extmail#g" /var/www/extsuite/extmail/webmail.cf
sed -i "s#SYS_MYSQL_PASS = db_pass#SYS_MYSQL_PASS = ext00mail#g" /var/www/extsuite/extmail/webmail.cf
sed -i "s#SYS_SHOW_SIGNUP = 1#SYS_SHOW_SIGNUP = 0#g" /var/www/extsuite/extmail/webmail.cf
sed -i "s#SYS_MESSAGE_SIZE_LIMIT = 5242880#SYS_MESSAGE_SIZE_LIMIT = 52428800#g" /var/www/extsuite/extmail/webmail.cf安装extman
cd /usr/local/src
tar -zxvf extman-0.2.5.tar.gz
cp -r extman-0.2.5 /var/www/extsuite/extman/
chown -R vuser:vgroup /var/www/extsuite/extman/cgi/
mkdir /var/www/extsuite/extman/tmp
chown -R vuser:vgroup /var/www/extsuite/extman/tmp 配 置extmansed -i "s#SYS_SESS_DIR = /tmp/extman/#SYS_SESS_DIR = /var/www/extsuite/extman/tmp/#g" /var/www/extsuite/extman/webman.cf
sed -i "s#SYS_MYSQL_PASS = webman#SYS_MYSQL_PASS = web00man#g" /var/www/extsuite/extman/webman.cfvi /var/www/extsuite/extman/docs/init.sql
将extmail.org改为你的域名比如hamigua.com 导入数据库mysql -u root -p
mysql -u root -p
cd /var/www/extsuite/extman/tools
./maildirmake.pl /home/domains/hamigua.com/postmaster/Maildir
chown -R vuser:vgroup /home/domains cp -r /var/www/extsuite/extman/addon/mailgraph_ext/ /usr/local/mailgraph_ext/
echo "/usr/local/mailgraph_ext/mailgraph-init start" >> /etc/rc.d/rc.local
echo "/usr/local/mailgraph_ext/qmonitor-init start" >> /etc/rc.d/rc.local cp /var/www/extsuite/extman/docs/mysql_virtual_* /etc/postfix/sed -i "s#password = extmail#password = ext00mail#g" /etc/postfix/mysql_virtual_alias_maps.cf
sed -i "s#password = extmail#password = ext00mail#g" /etc/postfix/mysql_virtual_domains_maps.cf
sed -i "s#password = extmail#password = ext00mail#g" /etc/postfix/mysql_virtual_limit_maps.cf
sed -i "s#password = extmail#password = ext00mail#g" /etc/postfix/mysql_virtual_mailbox_maps.cf
sed -i "s#password = extmail#password = ext00mail#g" /etc/postfix/mysql_virtual_sender_maps.cf
安装slockd
cd /usr/local/src
tar -zxvf slockd-0.2.tar.gz
cp -r slockd-0.2 /usr/local/slockd
echo "/usr/local/slockd/slockd-init start" >> /etc/rc.d/rc.local 配置apache
vi /etc/httpd/conf/httpd.conf#AddDefaultCharset UTF-8 NameVirtualHost *:80
Include conf/vhost_*.conf vi /etc/httpd/conf/vhost_extmail.conf
# VirtualHost for ExtMail Solution
ServerName mail.fsnws.com
DocumentRoot /var/www/extsuite/extmail/html/
LoadModule fastcgi_module modules/mod_fastcgi.so
FastCgiExternalServer /usr/bin/dispatch.fcgi -host 127.0.0.1:8888
Alias /extmail/cgi/ /usr/bin/dispatch.fcgi/
SetHandler fastcgi-script
#ScriptAlias /extmail/cgi/ /var/www/extsuite/extmail/cgi/
Alias /extmail /var/www/extsuite/extmail/html/
ScriptAlias /extman/cgi/ /var/www/extsuite/extman/cgi/
Alias /extman /var/www/extsuite/extman/html/
Alias /phpmyadmin /var/www/extsuite/phpmyadmin/
Alias /phpldapadmin /var/www/extsuite/phpldapadmin/htdocs/
# Suexec config
SuexecUserGroup vuser vgroup
安装fastcgi模块
cd /usr/local/src
wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
tar xfz mod_fastcgi-2.4.6.tar.gz
cd mod_fastcgi-2.4.6
ln -s ../../usr/lib/httpd/build /etc/httpd/build
cp Makefile.AP2 Makefile
make top_dir=/etc/httpd install
echo "/var/www/extsuite/extmail/dispatch-init start" >> /etc/rc.d/rc.local
/var/www/extsuite/extmail/dispatch-init start 配置phpmyadmin
ln -s /usr/share/phpmyadmin /var/www/extsuite/phpmyadmin
vi /usr/share/phpmyadmin/config.inc.php$cfg['blowfish_secret'] = '3234ffet43'; 配置postfix
vi /etc/postfix/main.cf
vi /etc/postfix/master.cf
vi /etc/amavisd.conf$max_servers = 20;
$mydomain = 'example.com'
['ClamAV-clamd',
&ask_daemon, ["CONTSCAN {}n", "/tmp/clamd.socket"],
qr/bOK$/, qr/bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ], $final_virus_destiny = D_DISCARD;
$final_banned_destiny = D_BOUNCE;
$final_spam_destiny = D_PASS;
$final_bad_header_destiny = D_PASS;注:初始安装账户extmail,extman密码可能有点问题登陆不进去,这个可以用phpmyadmin来设置密码,默认phpmyadmin root密码为空
$1$ITIH4eKD$s9C2wHpLQXOLkzY5U1jYL. = extmail
而后再从extman后台去修改密码就可以了。
usermod -G amavis clamav
vi /etc/postfix/aliasesvirusalert: root
spam.police: root
postfix: root@hamigua.com
newaliasestouch /etc/postfix/recipient_bcc
touch /etc/postfix/sender_bcc
postmap /etc/postfix/transport
postmap /etc/postfix/recipient_bcc
postmap /etc/postfix/sender_bcc 以后升级命令:
yum update --exclude postfix --exclude postfix-pflogsumm www.extmail.org论坛 wjkhubei写得centos5.3+extmail1.0.8+extman+spamassassin http://www.extmail.org/forum/thread-10282-1-4.html 效果图:
extmail
Extman