当前位置:首页文章首页 IT学院 IT技术

详解Linux下的postfix安装

作者:  来源:  发布时间:2012-2-16 17:16:05  点击:
  第七:安装postfix

  Ok,之上都已经完全安装了,下面就开始安装postfix

  增加用户名

  [root@server250 ~]# groupadd -g 503 postfix

  [root@server250 ~]# useradd -g postfix -u 503 postfix

  [root@server250 ~]#

  [root@server250 ~]# groupadd -g 504 postdrop

  [root@server250 ~]# useradd -g postdrop -u 504 -s /sbin/nologin -M postdrop

  [root@server250 postfix]# tar zxvf postfix-2.8.7.tar.gz

  root@localhost postfix-2.8.7]# make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/local/sasl2/include/sasl -DUSE_TLS -I/usr/local/ssl/include/openssl ' 'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm -L/usr/local/sasl2/lib -lsasl2 -L/usr/local/ssl/lib -lssl -lcrypto'

  daemon_directory: [/usr/libexec/postfix] /usr/local/postfix/libexec

  data_directory: [/var/lib/postfix] /usr/local/postfix/lib

  html_directory: [no] /var/www/postfix_html

  manpage_directory: [/usr/local/man] /usr/local/postfix/man

  修改配置文件

  /etc/postfix/main.cf

  [root@server250 ~]# /usr/sbin/postfix start

  postfix/postfix-script: starting the Postfix mail system

  [root@server250 postfix-2.8.7]# netstat -anpt | grep 25

  tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 3455/master

  修改防火墙的配置文件,添加25端口

  [root@server250 ~]# vi /etc/sysconfig/iptables

   -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT

  重启防火墙

  接下来是验证postfix是否安装成功

  [root@server250 ~]# telnet localhost 25

  Trying 127.0.0.1...

  Connected to localhost.localdomain (127.0.0.1).

  Escape character is '^]'.

  220 mail.ku888.in ESMTP Postfix

  ehlo mail.ku888.in

  250-mail.ku888.in

  250-PIPELINING

  250-SIZE 10240000

  250-VRFY

  250-ETRN

  250-ENHANCEDSTATUSCODES

  250-8BITMIME

  250 DSN

  mail from:root@ku888.in

  250 2.1.0 Ok

  rcpt to:frank@ku888.in

  250 2.1.5 Ok

  data

  354 End data with .

  subject:test!!

  test!!!!!!!!!!

  .

  250 2.0.0 Ok: queued as 048B45CF00A3

  quit

  221 2.0.0 Bye

  Connection closed by foreign host.

  第八,配置postfix的虚拟用户邮箱

  验证ok后,下面开始部署安装postfix的虚拟用户和邮箱设置

  先确认下你的postfix是否支持 cyrus-sasl的认证

  [root@mail2 ~]# postconf -a

  cyrus

  Dovecot

  Ok,支持的

  下面进行设置

  [root@mail2 ~]# vi /etc/postfix/main.cf

  编辑她的配置文件

  在末尾处添加

  ############################CYRUS-SASL############################

  broken_sasl_auth_clients = yes

  smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_hostname,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unauth_pipelining,reject_unauth_destination

  smtpd_sasl_auth_enable = yes

  smtpd_sasl_local_domain = $myhostname

  smtpd_sasl_security_options = noanonymous

  smtpd_sasl_application_name = smtpd

  smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available!

  ############################END-CYRUS-SASL############################

  在sasl2的库文件中,添加认证

  [root@mail2 sasl2]# vi smtpd.conf

  pwcheck_method: saslauthd

  mech_list: PLAIN LOGIN

  ~

  重新加载postfix的配置文件,

  重新telnet ,验证下是否有加载上SASL认证

  [root@mail2 ~]# telnet localhost 25

  Trying 127.0.0.1...

  Connected to mail2.51coolbar.com (127.0.0.1).

  Escape character is '^]'.

  220 Welcome to our mail2.51coolbar.com ESMTP,Warning: Version not Available!

  ehlo localhost

  250-mail2.51coolbar.com

  250-PIPELINING

  250-SIZE 10240000

  250-VRFY

  250-ETRN

  250-AUTH PLAIN LOGIN 确保这两行的输出,否则都是有问题的

  250-AUTH=PLAIN LOGIN

  250-ENHANCEDSTATUSCODES

  250-8BITMIME

  250 DSN

  Ok,发现是加载上了

  配置虚拟用户和虚拟域

  编辑postfix的主配置文件

  ########################Virtual Mailbox Settings####################

  virtual_mailbox_base = /var/mailbox/

  virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf

  virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf

  virtual_alias_domains =

  virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf

  virtual_uid_maps = static:509

  virtual_gid_maps = static:513

  virtual_transport = virtual

  maildrop_destination_recipient_limit = 1

  maildrop_destination_concurrency_limit = 1

  ##########################QUOTA Settings########################

  message_size_limit = 14336000

  virtual_mailbox_limit = 20971520

  virtual_create_maildirsize = yes

首页 上一页 [1] [2] [3] [4] [5]  下一页 尾页
上一篇:tar包的应用 下一篇:

相关软件

相关文章

文章评论

软件按字母排列: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z