當前位置:首頁文章首頁 IT學院 IT技術

詳解Linux下的postfix安裝

作者:  來源:  發(fā)布時間: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,發(fā)現(xiàn)是加載上了

  配置虛擬用戶和虛擬域

  編輯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