您的位置:首页 > 其它

邮件服务系列之编译安装Postfix2.9.15

2016-08-07 13:20 274 查看
Mail Server:
SMTP:简单邮件服务器
ESMTP:扩展的简单邮件服务器
POP3:邮局协议
IMAP4:互联网邮件访问协议
UUCP:Unix主机复制文件的协议
SMTP监听tcp协议的25端口

Open Relay: 开放式中继
SASL:简单认证安全层

WebMail
LDAP:轻量级目录访问协议
MySQL:
虚拟用户:仅用于访问某服务的数字表示:
用户:字符串,凭证

MTA:邮件传输代理,SMTP服务器
sendmail,UUCP
单体机构,SUID,配置文件语法(m4编写)
qmail
postfix:模块化设计,安全,跟sendmmail兼容,效率高
exim:MTA
Exchange (Windows,异步消息协作平台)

SASL:v2
cyrus-sasl
courier-authlib

MDA:邮件投递代理
promail
maildrop

MRA: pop3,imap4
cyrus-imap
dovecot
MUA:邮件用户代理
Outlook Express,Outlook
Foxmail
Thunderbird
Evolution
mutt(文本界面)
WebMail:
Openwebmail
squirrelmail
Extmail(Extman)

Postfix+SASL (courier-authlib) + RySQL
Docecot+MySQL
Extmail+Extman+httpd
[root@www ~]# yum list all |grep sendmail 查看系统是否安装了rpm包的sendmail,如果安装了就卸载掉
[root@www ~]# rpm -e sendmail -nodeps
首先安装MySQL http://www.postfix.org/ 下载postfix源码包

[root@www postfix-2.9.15]# tar -xf postfix-2.9.15.tar.gz
[root@www postfix-2.9.15]# groupadd -g 2525 postfix
[root@www postfix-2.9.15]# useradd -g 2525 -u 2525 -s /sbin/nologin -M postfix
[root@www postfix-2.9.15]# groupadd -g 2526 postdrop
[root@www postfix-2.9.15]# useradd -g 2526 -u 2526 -s /sbin/nologin -M postdrop
[root@www usr]# yum -y install cyrus-sasl-devel.i686
[root@www lib64]# rpm -ql cyrus-sasl-devel 根据sasl的lib和include路径来进行安装

[root@www postfix-2.10.10]# make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include -DUSE_SASL_AUTH -I/usr/include/sasl -DUSE_TLS' 'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm -L/usr/lib/sasl2 -lsasl2 -lssl -lcrypto'
CCARGS 编译的时候链接到什么地方,主要是找哪个系统的头文件
AUXLIBS 到哪里去找mysql库文件
instal_root: [/] /
tempdir: [/root/postfix-2.9.3] /tmp/postfix
config_directory: [/etc/postfix] /etc/postfix
daemon_directory: [/usr/libexec/postfix]
command_directory: [/usr/sbin]
queue_directory: [/var/spool/postfix]
sendmail_path: [/usr/sbin/sendmail]
newaliases_path: [/usr/bin/newaliases]
mailq_path: [/usr/bin/mailq]
mail_owner: [postdrop]postfix
setgid_group: [postdrop]
html_directory: [no] /var/www/html/postfix
manpages: [/usr/local/man]
readme_dirctory: [no]
-------------------
postfix start

[root@localhost ~]# tail /var/log/maillog
Aug 6 09:49:21 localhost postfix/master[8115]: fatal: open lock file /var/lib/postfix/master.lock: cannot open file: Permission denied
Aug 6 09:49:22 localhost postfix/master[8114]: fatal: daemon initialization failure
Aug 6 09:49:23 localhost postfix/postfix-script[8116]: fatal: mail system startup failed
Aug 6 09:56:00 localhost postfix/postfix-script[8206]: starting the Postfix mail system
Aug 6 09:56:00 localhost postfix/master[8208]: daemon started -- version 2.10.10, configuration /etc/postfix
Aug 6 15:53:43 localhost postfix/postfix-script[1658]: starting the Postfix mail system
Aug 6 15:53:43 localhost postfix/master[1660]: daemon started -- version 2.10.10, configuration /etc/postfix
Aug 6 16:01:17 localhost postfix/postfix-script[1691]: starting the Postfix mail system
Aug 6 16:01:17 localhost postfix/master[1693]: daemon started -- version 2.10.10, configuration /etc/postfix
Aug 6 16:01:54 localhost postfix/postfix-script[1803]: fatal: the Postfix mail system is already running

postfix的配置文件
postfix模块化:
master:/etc/postfix/master.cf 主进程,用于控制启动的其他进程

mail: /etc/postfix/main.cf 整个邮件服务器的配置文件
参数 = 值:参数必须写在行的绝对行首,以空白开头的行被认为是上一行的延续
[root@localhost ~]# vim /etc/postfix/master.cf

pickup fifo n - n 60 1 pickup 分拣进程
cleanup unix n - n - 0 cleanup 清理进程
qmgr fifo n - n 300 1 qmgr 队列管理器
此配置文件记录进程信息。而每个进程的配置都在/etc/postfix/main.cf里

命令postconf 用于配置postfix
-d 显示默认配置
-n 修改了的配置
-m 显示支持的所有查找表的类型

-A 显示当前主机支持的SASL的类型
-e 参数=某个值。更改某参数的配置信息,并保存至main.cf文件中
[root@localhost ~]# vim /etc/postfix/main.cf
[root@localhost ~]# telnet localhost 25
helo localhost
ehlo localhost
SMTP状态码:
1xx:纯信息
2xx:正确信息
3xx:上一步操作尚未完成,需要继续补充
4xx:暂时性错误
5xx:永久性错误

SMTP协议命令:
hello (smtp协议)|| ehlo (esmtp协议)
mail from :root@mylinux.com 发件人
rcpt to: admin@mylinux.com 收件人

data 正文
. 表示发送
quit退出

alias邮件别名:

abc@mylinux.com : qwe@mylinux.com
所有发给abc的邮件都直接转给qwe
通过编辑/etc/aliases来配置
/etc/aliases-->hash-->aliases.db

#newaliases
[root@localhost ~]# newaliases
[root@localhost ~]# ls /etc/ |grep aliases
aliases
aliases.db

postfix stop

postfix start
postfix默认本机所在网段的地址中继
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  邮件 服务 系列