3 月 192013
 

安装Postfix

安装依赖包

[root@mail ~]# yum install db4-devel perl

创建用户和组

[root@mail ~]# useradd -M -s /sbin/nologin postfix
 [root@mail ~]# groupadd postdrop

编译安装

[root@mail postfix-2.8.14]# make -f Makefile.init makefiles \
 > 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/mysql \
 > -DUSE_SASL_AUTH \
 > -DDEF_SERVER_SASL_TYPE=\"/usr/local/dovecot/include/dovecot\"' \
 > 'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm'
 [root@mail postfix-2.8.14]# make
 [root@mail postfix-2.8.14]# make install

安装向导

install_root: [/]
 tempdir: [/root/postfix-2.8.14]
 config_directory: [/etc/postfix]
 command_directory: [/usr/sbin]
 daemon_directory: [/usr/libexec/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]
 setgid_group: [postdrop]

配置postfix

建立虚拟邮件用户目录

[root@pfx postfix-2.8.14]# mkdir /var/vmail 
[root@pfx postfix-2.8.14]# chown mail.mail /var/vmail/

修改master.cf

[root@mail ~]# vi /etc/postfix/master.cf

配置dovecot LDA相关

dovecot   unix  -       n       n       -       -       pipe 
  flags=DRhu user=mail:mail argv=/usr/local/dovecot/libexec/dovecot/deliver -f ${sender} -d ${recipient}

修改main.cf

[root@mail ~]# vi /etc/postfix/main.cf
myhostname = mail.linuxcache.net 
mydomain = linuxcache.net 
myorigin = $mydomain 
inet_interfaces = all 
mydestination = $myhostname, localhost.$mydomain, localhost 
home_mailbox = Maildir/ 
smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)

增加dovecto相关

virtual_transport = dovecot 
dovecot_destination_recipient_limit = 1
smtpd_sasl_auth_enable = yes 
smtpd_sasl_type = dovecot 
smtpd_sasl_path = /var/spool/postfix/private/auth 
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination

增加mysql相关

virtual_mailbox_domains = mysql:/etc/postfix/mysql/mysql_virtual_domains_maps.cf 
virtual_mailbox_maps = mysql:/etc/postfix/mysql/mysql_virtual_mailbox_maps.cf 
virtual_alias_maps = mysql:/etc/postfix/mysql/mysql_virtual_alias_maps.cf 
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql/mysql_virtual_mailbox_limit_maps.cf

建立数据库连接文件

mysql_virtual_domains_maps.cf
 user = postfix 
password = mypapass 
hosts = localhost 
dbname = postfix 
query = SELECT domain FROM domain WHERE domain='%s' AND active = '1'
mysql_virtual_mailbox_maps.cf 
user = postfix 
password = mypapass 
hosts = localhost 
dbname = postfix 
query = select maildir from mailbox where username='%s'
mysql_virtual_alias_maps.cf 
user = postfix 
password = mypapass 
hosts = localhost 
dbname = postfix 
query = SELECT goto FROM alias WHERE address='%s' AND active = '1'
mysql_virtual_mailbox_limit_maps.cf 
user = postfix 
password = mypapass 
hosts = localhost 
dbname = postfix 
query = select quota from mailbox where username='%s'

检测配置文件

[root@mail postfix]# postfix check

 

相关下载:
(1) Postfix 2.8.14

内容引用:
(1) Gentoo Wiki

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据