Postfix+courier-authlib+dovecot+Extmail与Extman实现web服务的邮件服务器
一、环境准备
1. 系统环境
centos7.x Linux mail.apicloud.com 3.10.0-862.3.3.el7.x86_64 #1 SMP Fri Jun 15 04:15:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
2. 软件环境
#删除自带的Postfix软件 yum remove postfix #yum 安装mysql和httpd yum install httpd* mysql-community* --skip-broken #依赖环境 yum install openssl-devel perl-DBD-MySQL tcl tcl-devel libart_lgpl libart_lgpl-devel libtool-ltdl libtool-ltdl-devel expect cyrus-sasl*
二、软件准备
wget https://dovecot.org/releases/2.3/rc/dovecot-2.3.2.rc1.tar.gz wget http://cdn.postfix.johnriley.me/mirrors/postfix-release/official/postfix-3.3.1.tar.gz wget https://netix.dl.sourceforge.net/project/courier/courier-devel/20180610/courier-0.78.2.20180610.tar.bz2 wget https://oss.oetiker.ch/rrdtool/pub/rrdtool-1.7.0.tar.gz wget http://ez.downxy.com/down1/extmail3.0_downcc.zip
三、编译安装postfix
1. 删除系统自带的postfix软件、postfix和postdrop账号:
# userdel -r postfix # userdel -r postdrop 为什么要删掉系统自带的账号后面会予以说明。不删掉的话,后面配置extmail的时候会出错。
2.安装postfix
# groupadd -g1001 postfix # groupadd -g1002 postdrop # useradd -g postfix -u1001 -s /sbin/nologin -M postfix # useradd -g postdrop -u1002 -s /sbin/nologin -M postdrop #uid=1001(postfix) gid=1001(postfix) groups=1001(postfix) # id postdrop uid=1002(postdrop) gid=1002(postdrop) groups=1002(postdrop)
#增加编译参数 make makefiles 'CCARGS=-DHAS_MYSQL -I /usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I /usr/include/sasl -DUSE_TLS' 'AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm -L /usr/lib64/sasl2 -lsasl2 -lssl -lcrypto'
#编译安装 make && make install
#配置相关参数 Warning: if you use this script to install Postfix locally, this script will replace existing sendmail or Postfix programs. Make backups if you want to be able to recover. Before installing files, this script prompts you for some definitions. Most definitions will be remembered, so you have to specify them only once. All definitions should have a reasonable default value. Please specify the prefix for installed file names. Specify this ONLY if you are building ready-to-install packages for distribution to OTHER machines. See PACKAGE_README for instructions. install_root: [/] Please specify a directory for scratch files while installing Postfix. You must have write permission in this directory. tempdir: [/usr/local/src/postfix-3.3.1] Please specify the final destination directory for installed Postfix configuration files. config_directory: [/etc/postfix] Please specify the final destination directory for installed Postfix administrative commands. This directory should be in the command search path of adminstrative users. command_directory: [/usr/sbin] Please specify the final destination directory for installed Postfix daemon programs. This directory should not be in the command search path of any users. daemon_directory: [/usr/libexec/postfix] Please specify the final destination directory for Postfix-writable data files such as caches or random numbers. This directory should not be shared with non-Postfix software. data_directory: [/var/lib/postfix] Please specify the final destination directory for the Postfix HTML files. Specify "no" if you do not want to install these files. html_directory: [no] /var/www/html/postfix Please specify the owner of the Postfix queue. Specify an account with numerical user ID and group ID values that are not used by any other accounts on the system. mail_owner: [postfix] Please specify the final destination pathname for the installed Postfix mailq command. This is the Sendmail-compatible mail queue listing command. mailq_path: [/usr/bin/mailq] Please specify the final destination directory for the Postfix on-line manual pages. You can no longer specify "no" here. manpage_directory: [/usr/local/man] Please specify the final destination pathname for the installed Postfix newaliases command. This is the Sendmail-compatible command to build alias databases for the Postfix local delivery agent. newaliases_path: [/usr/bin/newaliases] Please specify the final destination directory for Postfix queues. queue_directory: [/var/spool/postfix] Please specify the final destination directory for the Postfix README files. Specify "no" if you do not want to install these files. readme_directory: [no] Please specify the final destination pathname for the installed Postfix sendmail command. This is the Sendmail-compatible mail posting interface. sendmail_path: [/usr/sbin/sendmail] Please specify the group for mail submission and for queue management commands. Specify a group name with a numerical group ID that is not shared with other accounts, not even with the Postfix mail_owner account. You can no longer specify "no" here. setgid_group: [postdrop] Please specify the final destination directory for Postfix shared-library files. shlib_directory: [no] Please specify the final destination directory for non-executable files that are shared among multiple Postfix instances, such as postfix-files, dynamicmaps.cf, as well as the multi-instance template files main.cf.proto and master.cf.proto. meta_directory: [/etc/postfix] Updating /etc/postfix/main.cf.proto... Updating /etc/postfix/makedefs.out... Updating /etc/postfix/master.cf.proto... Updating /etc/postfix/postfix-files... Updating /usr/libexec/postfix/anvil... Updating /usr/libexec/postfix/bounce... Updating /usr/libexec/postfix/cleanup... Updating /usr/libexec/postfix/discard... Updating /usr/libexec/postfix/dnsblog... Updating /usr/libexec/postfix/error... Updating /usr/libexec/postfix/flush... Updating /usr/libexec/postfix/local... Updating /usr/libexec/postfix/master... Updating /usr/libexec/postfix/oqmgr... Updating /usr/libexec/postfix/pickup... Updating /usr/libexec/postfix/pipe... Updating /usr/libexec/postfix/post-install... Updating /usr/libexec/postfix/postfix-script... Updating /usr/libexec/postfix/postfix-tls-script... Updating /usr/libexec/postfix/postfix-wrapper... Updating /usr/libexec/postfix/postmulti-script... Updating /usr/libexec/postfix/postscreen... Updating /usr/libexec/postfix/proxymap... Updating /usr/libexec/postfix/qmgr... Updating /usr/libexec/postfix/qmqpd... Updating /usr/libexec/postfix/scache... Updating /usr/libexec/postfix/showq... Updating /usr/libexec/postfix/smtp... Updating /usr/libexec/postfix/smtpd... Updating /usr/libexec/postfix/spawn... Updating /usr/libexec/postfix/tlsproxy... Updating /usr/libexec/postfix/tlsmgr... Updating /usr/libexec/postfix/trivial-rewrite... Updating /usr/libexec/postfix/verify... Updating /usr/libexec/postfix/virtual... Updating /usr/libexec/postfix/nqmgr... Updating /usr/libexec/postfix/lmtp... Updating /usr/sbin/postalias... Updating /usr/sbin/postcat... Updating /usr/sbin/postconf... Updating /usr/sbin/postfix... Updating /usr/sbin/postkick... Updating /usr/sbin/postlock... Updating /usr/sbin/postlog... Updating /usr/sbin/postmap... Updating /usr/sbin/postmulti... Updating /usr/sbin/postsuper... Updating /usr/sbin/postdrop... Updating /usr/sbin/postqueue... Updating /usr/sbin/sendmail... Updating /usr/bin/newaliases... Updating /usr/bin/mailq... Updating /etc/postfix/LICENSE... Updating /etc/postfix/TLS_LICENSE... Updating /etc/postfix/access... Updating /etc/postfix/aliases... Updating /etc/postfix/bounce.cf.default... Updating /etc/postfix/canonical... Updating /etc/postfix/generic... Updating /etc/postfix/header_checks... Updating /etc/postfix/main.cf.default... Updating /etc/postfix/main.cf... Updating /etc/postfix/master.cf... Updating /etc/postfix/relocated... Updating /etc/postfix/transport... Updating /etc/postfix/virtual... Updating /usr/local/man/man1/mailq.1... Updating /usr/local/man/man1/newaliases.1... Updating /usr/local/man/man1/postalias.1... Updating /usr/local/man/man1/postcat.1... Updating /usr/local/man/man1/postconf.1... Updating /usr/local/man/man1/postdrop.1... Updating /usr/local/man/man1/postfix.1... Updating /usr/local/man/man1/postfix-tls.1... Updating /usr/local/man/man1/postkick.1... Updating /usr/local/man/man1/postlock.1... Updating /usr/local/man/man1/postlog.1... Updating /usr/local/man/man1/postmap.1... Updating /usr/local/man/man1/postmulti.1... Updating /usr/local/man/man1/postqueue.1... Updating /usr/local/man/man1/postsuper.1... Updating /usr/local/man/man1/sendmail.1... Updating /usr/local/man/man5/access.5... Updating /usr/local/man/man5/aliases.5... Updating /usr/local/man/man5/body_checks.5... Updating /usr/local/man/man5/bounce.5... Updating /usr/local/man/man5/canonical.5... Updating /usr/local/man/man5/cidr_table.5... Updating /usr/local/man/man5/generic.5... Updating /usr/local/man/man5/header_checks.5... Updating /usr/local/man/man5/ldap_table.5... Updating /usr/local/man/man5/lmdb_table.5... Updating /usr/local/man/man5/master.5... Updating /usr/local/man/man5/memcache_table.5... Updating /usr/local/man/man5/mysql_table.5... Updating /usr/local/man/man5/socketmap_table.5... Updating /usr/local/man/man5/sqlite_table.5... Updating /usr/local/man/man5/nisplus_table.5... Updating /usr/local/man/man5/pcre_table.5... Updating /usr/local/man/man5/pgsql_table.5... Updating /usr/local/man/man5/postconf.5... Updating /usr/local/man/man5/postfix-wrapper.5... Updating /usr/local/man/man5/regexp_table.5... Updating /usr/local/man/man5/relocated.5... Updating /usr/local/man/man5/tcp_table.5... Updating /usr/local/man/man5/transport.5... Updating /usr/local/man/man5/virtual.5... Updating /usr/local/man/man8/bounce.8... Updating /usr/local/man/man8/cleanup.8... Updating /usr/local/man/man8/anvil.8... Updating /usr/local/man/man8/defer.8... Updating /usr/local/man/man8/discard.8... Updating /usr/local/man/man8/dnsblog.8... Updating /usr/local/man/man8/error.8... Updating /usr/local/man/man8/flush.8... Updating /usr/local/man/man8/lmtp.8... Updating /usr/local/man/man8/local.8... Updating /usr/local/man/man8/master.8... Updating /usr/local/man/man8/oqmgr.8... Updating /usr/local/man/man8/pickup.8... Updating /usr/local/man/man8/pipe.8... Updating /usr/local/man/man8/postscreen.8... Updating /usr/local/man/man8/proxymap.8... Updating /usr/local/man/man8/qmgr.8... Updating /usr/local/man/man8/qmqpd.8... Updating /usr/local/man/man8/scache.8... Updating /usr/local/man/man8/showq.8... Updating /usr/local/man/man8/smtp.8... Updating /usr/local/man/man8/smtpd.8... Updating /usr/local/man/man8/spawn.8... Updating /usr/local/man/man8/tlsproxy.8... Updating /usr/local/man/man8/tlsmgr.8... Updating /usr/local/man/man8/trace.8... Updating /usr/local/man/man8/trivial-rewrite.8... Updating /usr/local/man/man8/verify.8... Updating /usr/local/man/man8/virtual.8... Updating /var/www/html/postfix/ADDRESS_CLASS_README.html... Updating /var/www/html/postfix/ADDRESS_REWRITING_README.html... Updating /var/www/html/postfix/ADDRESS_VERIFICATION_README.html... Updating /var/www/html/postfix/BACKSCATTER_README.html... Updating /var/www/html/postfix/BASIC_CONFIGURATION_README.html... Updating /var/www/html/postfix/BUILTIN_FILTER_README.html... Updating /var/www/html/postfix/CDB_README.html... Updating /var/www/html/postfix/COMPATIBILITY_README.html... Updating /var/www/html/postfix/CONNECTION_CACHE_README.html... Updating /var/www/html/postfix/CONTENT_INSPECTION_README.html... Updating /var/www/html/postfix/DATABASE_README.html... Updating /var/www/html/postfix/DB_README.html... Updating /var/www/html/postfix/DEBUG_README.html... Updating /var/www/html/postfix/DSN_README.html... Updating /var/www/html/postfix/ETRN_README.html... Updating /var/www/html/postfix/FILTER_README.html... Updating /var/www/html/postfix/FORWARD_SECRECY_README.html... Updating /var/www/html/postfix/INSTALL.html... Updating /var/www/html/postfix/IPV6_README.html... Updating /var/www/html/postfix/LDAP_README.html... Updating /var/www/html/postfix/LINUX_README.html... Updating /var/www/html/postfix/LMDB_README.html... Updating /var/www/html/postfix/LOCAL_RECIPIENT_README.html... Updating /var/www/html/postfix/MAILDROP_README.html... Updating /var/www/html/postfix/MILTER_README.html... Updating /var/www/html/postfix/MULTI_INSTANCE_README.html... Updating /var/www/html/postfix/MYSQL_README.html... Updating /var/www/html/postfix/SQLITE_README.html... Updating /var/www/html/postfix/NFS_README.html... Updating /var/www/html/postfix/OVERVIEW.html... Updating /var/www/html/postfix/PACKAGE_README.html... Updating /var/www/html/postfix/PCRE_README.html... Updating /var/www/html/postfix/PGSQL_README.html... Updating /var/www/html/postfix/POSTSCREEN_README.html... Updating /var/www/html/postfix/QSHAPE_README.html... Updating /var/www/html/postfix/RESTRICTION_CLASS_README.html... Updating /var/www/html/postfix/SASL_README.html... Updating /var/www/html/postfix/SCHEDULER_README.html... Updating /var/www/html/postfix/SMTPD_ACCESS_README.html... Updating /var/www/html/postfix/SMTPD_POLICY_README.html... Updating /var/www/html/postfix/SMTPD_PROXY_README.html... Updating /var/www/html/postfix/SOHO_README.html... Updating /var/www/html/postfix/STANDARD_CONFIGURATION_README.html... Updating /var/www/html/postfix/STRESS_README.html... Updating /var/www/html/postfix/TLS_LEGACY_README.html... Updating /var/www/html/postfix/TLS_README.html... Updating /var/www/html/postfix/TUNING_README.html... Updating /var/www/html/postfix/UUCP_README.html... Updating /var/www/html/postfix/VERP_README.html... Updating /var/www/html/postfix/VIRTUAL_README.html... Updating /var/www/html/postfix/XCLIENT_README.html... Updating /var/www/html/postfix/XFORWARD_README.html... Updating /var/www/html/postfix/access.5.html... Updating /var/www/html/postfix/aliases.5.html... Updating /var/www/html/postfix/anvil.8.html... Updating /var/www/html/postfix/bounce.8.html... Updating /var/www/html/postfix/canonical.5.html... Updating /var/www/html/postfix/cidr_table.5.html... Updating /var/www/html/postfix/cleanup.8.html... Updating /var/www/html/postfix/defer.8.html... Updating /var/www/html/postfix/discard.8.html... Updating /var/www/html/postfix/dnsblog.8.html... Updating /var/www/html/postfix/error.8.html... Updating /var/www/html/postfix/flush.8.html... Updating /var/www/html/postfix/generic.5.html... Updating /var/www/html/postfix/header_checks.5.html... Updating /var/www/html/postfix/index.html... Updating /var/www/html/postfix/ldap_table.5.html... Updating /var/www/html/postfix/lmtp.8.html... Updating /var/www/html/postfix/local.8.html... Updating /var/www/html/postfix/mailq.1.html... Updating /var/www/html/postfix/master.5.html... Updating /var/www/html/postfix/master.8.html... Updating /var/www/html/postfix/memcache_table.5.html... Updating /var/www/html/postfix/mysql_table.5.html... Updating /var/www/html/postfix/sqlite_table.5.html... Updating /var/www/html/postfix/nisplus_table.5.html... Updating /var/www/html/postfix/newaliases.1.html... Updating /var/www/html/postfix/oqmgr.8.html... Updating /var/www/html/postfix/pcre_table.5.html... Updating /var/www/html/postfix/pgsql_table.5.html... Updating /var/www/html/postfix/pickup.8.html... Updating /var/www/html/postfix/pipe.8.html... Updating /var/www/html/postfix/postalias.1.html... Updating /var/www/html/postfix/postcat.1.html... Updating /var/www/html/postfix/postconf.1.html... Updating /var/www/html/postfix/postconf.5.html... Updating /var/www/html/postfix/postdrop.1.html... Updating /var/www/html/postfix/postfix-logo.jpg... Updating /var/www/html/postfix/postfix-manuals.html... Updating /var/www/html/postfix/postfix-wrapper.5.html... Updating /var/www/html/postfix/postfix.1.html... Updating /var/www/html/postfix/postkick.1.html... Updating /var/www/html/postfix/postlock.1.html... Updating /var/www/html/postfix/postlog.1.html... Updating /var/www/html/postfix/postmap.1.html... Updating /var/www/html/postfix/postmulti.1.html... Updating /var/www/html/postfix/postqueue.1.html... Updating /var/www/html/postfix/postscreen.8.html... Updating /var/www/html/postfix/postsuper.1.html... Updating /var/www/html/postfix/qshape.1.html... Updating /var/www/html/postfix/proxymap.8.html... Updating /var/www/html/postfix/qmgr.8.html... Updating /var/www/html/postfix/qmqp-sink.1.html... Updating /var/www/html/postfix/qmqp-source.1.html... Updating /var/www/html/postfix/qmqpd.8.html... Updating /var/www/html/postfix/regexp_table.5.html... Updating /var/www/html/postfix/relocated.5.html... Updating /var/www/html/postfix/sendmail.1.html... Updating /var/www/html/postfix/showq.8.html... Updating /var/www/html/postfix/smtp-sink.1.html... Updating /var/www/html/postfix/smtp-source.1.html... Updating /var/www/html/postfix/smtp.8.html... Updating /var/www/html/postfix/smtpd.8.html... Updating /var/www/html/postfix/spawn.8.html... Updating /var/www/html/postfix/tlsproxy.8.html... Updating /var/www/html/postfix/tcp_table.5.html... Updating /var/www/html/postfix/trace.8.html... Updating /var/www/html/postfix/transport.5.html... Updating /var/www/html/postfix/trivial-rewrite.8.html... Updating /var/www/html/postfix/verify.8.html... Updating /var/www/html/postfix/virtual.5.html... Updating /var/www/html/postfix/virtual.8.html... Warning: you still need to edit myorigin/mydestination/mynetworks parameter settings in /etc/postfix/main.cf. See also http://www.postfix.org/STANDARD_CONFIGURATION_README.html for information about dialup sites or about sites inside a firewalled network. BTW: Check your /etc/aliases file and be sure to set up aliases that send mail for root and postmaster to a real person, then run /usr/bin/newaliases.
3. 配置postfix
4.安装amavisd-new:
amavisd-new 在这里的作用主要是:
负责调用 ClamAV 对邮件进行病毒扫描
负责调用 SpamAssassin 对邮件内容进行过滤
原文地址:http://blog.51cto.com/nanfeibobo/2131739
时间: 2024-10-10 16:23:20