自定义最小安装
yum -y install kernel-PAE*
vi /etc/sysconfig/i18n
LANG="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.conf
alias 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
yum -y install
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
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
chkconfig httpd on
chkconfig mysqld on
升级包
yum -y update
reboot
#install postfix
wget http://mirror.centos.org/centos/5/os/SRPMS/postfix-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 0
rpmbuild -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
#install courier-authlib
cd
wget http://downloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2?modtime=1215968527&big_mirror=1
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.conf
ldconfig
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/authmysqlrc
MYSQL_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 fsnws.com
vi /usr/lib/sasl2/smtpd.conf
pwcheck_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
cd
wget http://downloads.sourceforge.net/courier/maildrop-2.0.4.tar.bz2?modtime=1177260143&big_mirror=1
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
cd
wget http://downloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2?modtime=1216246536&big_mirror=1
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 install
cp /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
vi /usr/local/courier-imap/etc/pop3d
POP3DSTART=YES
MAXDAEMONS=512
MAXPERIP=4000
cd
将extmail,extman,slock安装包上传
mkdir /var/www/extsuite
tar -zxvf extmail-1[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/
sed -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
cd
tar -zxvf extman-0[1].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
sed -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.cf
vi /var/www/extsuite/extman/docs/init.sql
将extmail.org改为你的域名比如fsnws.com
mysql -u root -p > /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
cd
tar -zxvf slockd-0[1].2.tar.gz
cp -r slockd-0.2 /usr/local/slockd
echo "/usr/local/slockd/slockd-init start" >> /etc/rc.d/rc.local
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
cd
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
ln -s /usr/share/phpmyadmin /var/www/extsuite/phpmyadmin
vi /usr/share/phpmyadmin/config.inc.php
$cfg['blowfish_secret'] = '3234ffet43';
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;
usermod -G amavis clamav
vi /etc/postfix/aliases
virusalert: root
spam.police: root
postfix: root@fsnws.com
newaliases
touch /etc/postfix/recipient_bcc
touch /etc/postfix/sender_bcc
postmap /etc/postfix/transport
postmap /etc/postfix/recipient_bcc
postmap /etc/postfix/sender_bcc
修改密码
mysql root密码:extr0mail
mysql webman密码 web805man
mysql extmail密码 3ext57mail
extmail root密码 respark000
添加白名单
vi /usr/local/slockd/config/sender_whitelist
vi /usr/local/slockd/config/recip_whitelist
以后升级命令:
yum update --exclude postfix --exclude postfix-pflogsumm