wiflish
          Loving Life! Loving Coding!
          posts - 98,comments - 98,trackbacks - 0

          參考文檔:
          http://blog.5ilinux.com/archives/2006/05/postfix_cyrussa.html
          http://www.extmail.org/forum/archive/2/0510/563.html

          wget ftp://postfix.cn99.com/postfix/official/postfix-2.2.10.tar.gz

          tar zvxf postfix-2.2.10.tar.gz

          下載VDA補丁,使postfix支持磁盤限額
          wget http://web.onda.com.br/nadal/postfix/VDA/postfix-2.2.10-vda.patch.gz

          gzip -d? postfix-2.2.10-vda.patch.gz

          chkconfig --level 2345 sendmail off

          安裝postfix之前添加相關的用戶&用戶組
          groupadd postfix -g 1000
          groupadd postdrop
          useradd postfix -u 1000 -g postfix -G postdrop
          groupadd vmail -g 1002
          useradd vmail -u 1002 -g 1002
          mkdir /opt/virtual
          chown vmail:vmail /opt/virtual
          chmod -R 771 /opt/virtual

          cd postfix-2.2.10
          打補丁
          patch -p1 < ../postfix-2.2.10-vda.patch

          make tidy

          make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/ -DUSE_SASL_AUTH -I/usr/local/include/sasl' \
          'AUXLIBS=-L/usr/local/mysql/lib/ -lmysqlclient -lm -lz -L/usr/local/lib -lsasl2'

          make
          make install

          mv /etc/aliases /etc/aliases.old
          ln -s /etc/postfix/aliases /etc/aliases
          echo 'root: admin@example.com'>>/etc/postfix/aliases
          /usr/bin/newaliases

          touch /etc/postfix/mysql/virtual_alias_maps.cf
          touch /etc/postfix/mysql/virtual_domains_maps.cf
          touch /etc/postfix/mysql/virtual_mailbox_maps.cf
          touch /etc/postfix/mysql/virtual_limit_maps.cf

          cd /etc/postfix
          postconf -n > main2.cf
          mv main.cf main.cf.old
          mv main2.cf main.cf

          vi /etc/postfix/main.cf
          myhostname = mail.example.com???????? # mail.example.com是安裝Postfix軟件的主機名
          mydomain = example.com??????????????? # example.com是安裝Postfix軟件的主機名中的域名部分
          myorigin = $mydomain
          mydestination =
          alias_maps = hash:/etc/aliases
          home_mailbox = Maildir/?????????????? # 使用Maildir作為郵件的存儲格式


          #=====================MySQL=====================
          virtual_alias_maps = mysql:/etc/postfix/mysql/virtual_alias_maps.cf
          virtual_mailbox_base = /opt/virtual
          virtual_mailbox_domains = mysql:/etc/postfix/mysql/virtual_domains_maps.cf
          virtual_mailbox_limit = 102400000
          virtual_mailbox_maps = mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf
          virtual_minimum_uid = 1002
          virtual_uid_maps = static:1002
          virtual_gid_maps = static:1002
          virtual_transport = virtual
          #"virtual_gid_maps"和"virtual_uid_maps"是postfix用戶的gid和uid, "virtual_minimum_uid"應當≤"virtual_uid_maps",

          "virtual_mailbox_limit"是每個郵箱的大小。

          #=====================Quota=====================
          virtual_create_maildirsize = yes
          virtual_mailbox_extended = yes
          virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql/virtual_limit_maps.cf
          virtual_mailbox_limit_override = yes
          virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later.
          virtual_overquota_bounce = yes
          #virtual_trash_count=yes
          #virtual_trash_name=.Trash

          #====================SASL======================
          smtpd_recipient_restrictions =
          ?permit_mynetworks,
          ?permit_sasl_authenticated,
          ?reject_non_fqdn_hostname,
          ?reject_non_fqdn_sender,
          ?reject_non_fqdn_recipient,
          ?reject_unauth_destination,
          ?reject_unauth_pipelining,
          ?reject_invalid_hostname
          ?#reject_rbl_client opm.blitzed.org,
          ?#reject_rbl_client list.dsbl.org,
          ?#reject_rbl_client bl.spamcop.net,
          ?#reject_rbl_client sbl-xbl.spamhaus.org
          smtpd_sasl_auth_enable = yes
          smtpd_sasl_local_domain = $myhostname
          smtpd_sasl_security_options = noanonymous
          broken_sasl_auth_clients = yes

          #=============================================
          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
          sample_directory = /etc/postfix
          sendmail_path = /usr/sbin/sendmail
          setgid_group = postdrop
          unknown_local_recipient_reject_code = 550


          編輯cf配置文件

          vi /etc/postfix/mysql_virtual_alias_maps.cf

          user = postfix
          password = postfix
          hosts = localhost
          dbname = postfix
          table = alias
          select_field = goto
          where_field = address
          additional_conditions = AND active = '1'

          =================================

          vi /etc/postfix/mysql_virtual_domains_maps.cf

          user = postfix
          password = postfix
          hosts = localhost
          dbname = postfix
          table = domain
          select_field = description
          where_field = domain
          additional_conditions = AND active = '1'

          =================================

          vi /etc/postfix/mysql_virtual_mailbox_maps.cf

          user = postfix
          password = postfix
          hosts = localhost
          dbname = postfix
          table = mailbox
          select_field = maildir
          where_field = username
          additional_conditions = AND active = '1'

          =================================

          vi /etc/postfix/mysql_virtual_limit_maps.cf

          user = postfix
          password = postfix
          hosts = localhost
          dbname = postfix
          table = mailbox
          select_field = quota
          where_field = username
          additional_conditions = AND active = '1'


          啟動和停止postfix服務
          /usr/sbin/postfix start
          /usr/sbin/postfix stop

          設置Postfix開機自動運行,在/etc/rc.local中增加“/usr/sbin/postfix start&”。
          注:①系統已經打開了Postfix的TLS支持,如果你需要這項功能可以參考Postfix發行包中的TLS_README文檔進行配置。
          ? ? ②你可以使用一個叫pflogsumm.pl的perl腳本對postfix的日志進行分析,詳細的情況見:http://jimsun.linxnet.com/postfix_contrib.html。

          posted on 2006-12-01 14:17 想飛的魚 閱讀(522) 評論(0)  編輯  收藏 所屬分類: linux
          主站蜘蛛池模板: 玉树县| 商河县| 县级市| 尚志市| 贡嘎县| 鄢陵县| 芜湖县| 延津县| 曲沃县| 嘉义县| 平度市| 徐水县| 呈贡县| 吉林市| 施甸县| 卓资县| 江口县| 辽中县| 南丹县| 甘泉县| 运城市| 上栗县| 黄大仙区| 确山县| 永昌县| 珲春市| 佛冈县| 宣汉县| 尖扎县| 阿尔山市| 台中县| 安龙县| 西充县| 重庆市| 东兴市| 柘荣县| 商河县| 海淀区| 理塘县| 寻乌县| 乌鲁木齐市|