企业邮件系统-Postfix安装使用
Postfix是目前流行的一套邮件传输代理软件(MTA),其作者Wietst Venema最初开发这套软件时就对总体设计、扩展能力、可用性及系统安全等方面进行了充分的考虑。由于Postfix在稳定、效率、安全和可用性上的优势,使得很多大型的邮件服务提供商都从原有的MTA软件向Postfix过度,而新仅诞生的邮件产品也大多采用了Postfix。网易、Tom和新浪都将原有的Qmail更换为Postfix,可见Postfix在大规模邮件系统中有比较普遍的应用,当然,Postfix也完全适用设计中小型的邮件系统,因为Postfix在保证了效率、安全、扩展等方面优势的同时,还具有配置简单的特点。[比较老的数据了]
碎语:
又开始捣腾我比较喜欢的邮件系统了,本文为后面的邮件系统做铺垫,后面在来关联文章树,本文LNMP环境基于LNMP一键安装,请自行通过博客搜索功能搜索该关键词
基于CentOS6.5,环境minimal,卸载postfix
[root@ipython ~]# service postfix stop
Shutting down postfix: [ OK ]
[root@ipython ~]# rpm -e --nodeps postfix
安装Postfix
[root@ipython ~]# yum install db4-devel
[root@ipython ~]# tar zxf postfix-2.12-20140801.tar.gz
[root@ipython ~]# cd postfix-2.12-20140801
####直接编译Makefiles#### ###AUX = 扩展功能[就这理解着吧] -lz = 压缩工具 -lm = 编码支持 ####
####lssl = openssl加密支持 lcrypto = crypto库 ####
###如果你参考了本文,请不要看别的文章,并且最好使用我打包好的免安装LNMP或一键安装LNMP做完一次完整的测试后,再尝试跟着你自己的感觉走哦###
###当然,如果你仍采用了自己的思路并参考了本文,那么请修改下面的依赖文件的路径,欢迎提问###
[root@ipython postfix-2.12-20140801]# make makefiles CCARGS='-DHAS_MYSQL -I/software/mysql/include/mysql -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\" -DUSE_TLS -I/software/openssl/include' AUXLIBS='-L/software/mysql/lib/mysql/ -lmysqlclient -lz -lm -L/software/openssl/lib/ -lssl -lcrypto'
[root@ipython postfix-2.12-20140801]# make
###给权限哦###
[root@ipython postfix-2.12-20140801]# chmod a+x postfix-install
[root@ipython postfix-2.12-20140801]# ./postfix-install -non-interactive install_root=/ tempdir=/tmp config_directory=/etc/postfix command_directory=/usr/sbin/ daemon_directory=/software/postfix data_directory=/var/lib/postfix html_directory=no mail_owner=postfix mailq_path=/usr/bin/mailq manpage_directory=/usr/local/man newaliases_path=/usr/bin/newaliases queue_directory=/var/spool/postfix readme_directory=no sendmail_path=/usr/sbin/sendmail setgia_group=postdrop
Postfix自动启动
###postfix 启动脚本可以参考 blfs-bootscripts 包,依赖redhat-lsb,由于太大,这里放弃###
---手动建立---
---------------------/etc/init.d/postfix---------------------------
#!/bin/bash
#
# postfix Postfix Mail Transfer Agent
#
# chkconfig: 2345 80 30
# description: Postfix is a Mail Transport Agent, which is the program \
# that moves mail from one machine to another.
# processname: master
# pidfile: /var/spool/postfix/pid/master.pid
# config: /etc/postfix/main.cf
# config: /etc/postfix/master.cf
#
# Based on startup script from Simon J Mudd <sjmudd@pobox.com>
# 25/02/99: Mostly s/sendmail/postfix/g by John A. Martin <jam@jamux.com>
# 23/11/00: Changes & suggestions by Ajay Ramaswamy <ajayr@bigfoot.com>
# 20/01/01: Changes to fall in line with RedHat 7.0 style
# 23/02/01: Fix a few untidy problems with help from Daniel Roesen.
### BEGIN INIT INFO
# Provides: postfix MTA
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop postfix
# Description: Postfix is a Mail Transport Agent, which is the program that
# moves mail from one machine to another.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
RETVAL=0
prog="postfix"
lockfile=/var/lock/subsys/$prog
pidfile=/var/spool/postfix/pid/master.pid
ALIASESDB_STAMP=/var/lib/misc/postfix.aliasesdb-stamp
# Script to update chroot environment
CHROOT_UPDATE=/etc/postfix/chroot-update
status -p $pidfile -l $(basename $lockfile) -b /usr/libexec/postfix/master master >/dev/null 2>&1
running=$?
conf_check() {
[ -x /usr/sbin/postfix ] || exit 5
[ -d /etc/postfix ] || exit 6
[ -d /var/spool/postfix ] || exit 5
}
make_aliasesdb() {
if [ "$(/usr/sbin/postconf -h alias_database)" == "hash:/etc/aliases" ]
then
# /etc/aliases.db may be used by other MTA, make sure nothing