| 订阅 | 在线投稿
分享
 
 
 

简易安装postfix邮件服务器

来源:互联网网民  宽屏版  评论
2008-05-31 00:04:52

postfix邮件服务器(debian sarge)1、简要说明

简易安装postfix邮件服务器

2.1、mail:~#apt-get install postfix

安装,根据提示选"Internet Site"

Where should mail for root go填postfix

Mail name?填mail.wjjennluen.com

Other destinations to accept mail for?(blank for none)填mail.wjjennluen.com, localhost.wjjennleun.com, ,localhost

Force synchronous updates on mail queue?选否

2.2、检查postfix服务是不是已经运行

mail:~# netstat -ln|grep 25

tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN

tcp6 0 0 :::25 :::* LISTEN

unix 2 [ ACC ] STREAM LISTENING 20256 /tmp/.ICE-unix/11772

2.3、测试postfix

mail:~# telnet 127.0.0.1 25

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

220 mail.wjjennluen.com ESMTP Postfix (Debian/GNU)

ehlo mail

250-mail.wjjennluen.com

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250 8BITMIME

mail from: "This is a test mail!"

250 Ok

rcpt to:

250 Ok

data

354 End data with .

This is a test mail!

.

250 Ok: queued as 4888ACA0060

quit

221 Bye

Connection closed by foreign host.

好象是发出去了噢

2.4、检查刚发的邮件是否收到

mail:~#apt-get install mailx下载mail阅读器

mail:~# su - wxt

wxt@mail~:$ mail

No mail for wxt

wxt@mail:~$exit

mail:~#:

my god,没有邮件啊

mail~:#more /var/mail/wxt

没有

mail~:#more /var/spool/mail/wxt

没有

咱回事呢

mail:~# telnet 127.0.0.1 25

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

220 mail.wjjennluen.com ESMTP Postfix (Debian/GNU)

ehlo mail

250-mail.wjjennluen.com

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250 8BITMIME

mail from: "abc"

250 Ok

rcpt to:

250 Ok

data

354 End data with .

abc

.

250 Ok: queued as 609D0CA00BB

quit

221 Bye

Connection closed by foreign host.

mail:~# more /var/mail/wxt

From wxt@mail.wjjennluen.com Sat Jul 2 18:33:56 2005

Return-Path:

X-Original-To: wxt

Delivered-To: wxt@mail.wjjennluen.com

Received: from mail (localhost.localdomain [127.0.0.1])

by mail.wjjennluen.com (Postfix) with ESMTP id 609D0CA00BB

for ; Sat, 2 Jul 2005 18:33:42 +0800 (CST)

Message-Id:

Date: Sat, 2 Jul 2005 18:33:42 +0800 (CST)

From: wxt@mail.wjjennluen.com

To: undisclosed-recipients:;

abc

mail:~#

收到了,此时postfix工作在127.0.0.1上的,也就是localhost

查看mydestination参数的设定

mail:~# postconf |grep mydestination

mydestination = mail.wjjennluen.com, localhost.wjjennluen.com, , localhost

没有wjjennleun.com,所以用wxt@wjjennluen.com发信,postfix不会接受,所以要添加wjjennluen.com给mydestination

mail:~# postconf |grep mydestination

mydestination = mail.wjjennluen.com wjjennluen.com localhost.wjjennluen.com localhost

现在就可以收到了

mail:~#/var/mail/wxt

mail:~# telnet 127.0.0.1 25

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

220 mail.wjjennluen.com ESMTP Postfix (Debian/GNU)

ehlo mail

250-mail.wjjennluen.com

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250 8BITMIME

mail from: "abc"

250 Ok

rcpt to:

250 Ok

data

354 End data with .

abc

.

250 Ok: queued as 609D0CA00BB

quit

221 Bye

Connection closed by foreign host.

mail:~# more /var/mail/wxt

From wxt@mail.wjjennluen.com Sat Jul 2 18:33:56 2005

Return-Path:

X-Original-To: wxt

Delivered-To: wxt@mail.wjjennluen.com

Received: from mail (localhost.localdomain [127.0.0.1])

by mail.wjjennluen.com (Postfix) with ESMTP id 609D0CA00BB

for ; Sat, 2 Jul 2005 18:33:42 +0800 (CST)

Message-Id:

Date: Sat, 2 Jul 2005 18:33:42 +0800 (CST)

From: wxt@mail.wjjennluen.com

To: undisclosed-recipients:;

abc

mail:~#

2.5、安装pop3,imap

mail:~#apt-get install courier-pop courier-imap

注意/etc/courier/pop3d配置文件

注意/etc/courier/imapd配置文件

用outlook测试pop3和imap成功

2.6、安装apache,php,squirrelmail

mail:~#apt-get apache php4 php4-common squirrelmail

修改/etc/apache/httpd.conf

加入PHP支持

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

新建文件/var/www/test.php

phpinfo();

?

在浏览器地址栏内输入http://192.168.0.15/test.php

可以确定PHP是否可以正常工作

2.7、从mailbox 更改为maildir

修改/etc/postfix/main.cf

增加参数设置

home_mailbox = Maildir/

更改mailbox_command 参数为

mailbox_command = /usr/bin/procmail -a "$EXTENSION" DEFAULT=$HOME/Maildir/

新增

MAILDIR=$HOME/Maildir

mail:~#cd /home/wxt/

mail:~#maildirmake Maildir

mail:~#chmod -R 750 Maildir

mail:~#ln -s /usr/share/squirrelmail /var/www/squirrelmail

修改/usr/share/squirrelmail/config/conf.pl内的变量$auto_create_special = ture;,让squirrelmail自动增加三个子目录

添加webmail虚拟主机(基于名子)

打开/etc/apache/httpd.conf

添加虚拟主机配置参数

NameVirtualHost 192.168.0.15

ServerAdmin root@localhost

DocumentRoot /var/www/squirrelmail

ServerName webmail.wjjennluen.com

ErrorLog /var/log/apache/webmail/error.log

mail:~#makdir /var/log/apache/webmail

mail:~#touch /var/log/apache/webmail/error.log

注意在named配置文件里面加入webmail.wjjennluen.com的记录

在浏览器的地址栏内输入webmail.wjjennluen.com就可以登陆webmail了

2.7、给postfix 加上smtp 认证

mail:~# apt-get install postfix-tls sasl2-bin libsasl2-modules

修改/etc/default/saslauthd文件,设定START = yes

修改/etc/postfix/sasl/smtpd.conf,设定saslauthd来认证smtp

mail:~#mkdir /etc/postfix/sasl

mail:~#echo "pwcheck_method: saslauthd" /etc/postfix/sasl/smtpd.con

添加帐户postfix到sasl组

mail:~#addgroup postfix sasl

修改/etc/postfix/main.cf, 使postfix使用sasl来实现smtp验证功能

#=====sasl======#

smtpd_sasl_auth_enable = yes

broken_sasl_auth_clients = yes

smtpd_sasl_security_options = noanonymous

smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, check_relay_domains, reject_unauth_destination

smtpd_client_restrictions = permit_sasl_authenticated

修改/etc/postfix/master.cf,让postfix不要以chroot启动,参数-v可以用来debug,正式上线为了不使大量的log,一定要拿掉

# ==============================================

# service type private unpriv chroot wakeup maxproc command + args

# (yes) (yes) (yes) (never) (100)

# ==============================================

smtp inet n - n - - smtpd -v

重新启动sasl 验证程序

mail:~# /etc/init.d/saslauthd restart

重新启动postfix

mail:~#/etc/init.d/postfix restart

mail:~# testsaslauthd -u wxt -p wxt

0: OK "Success."

测试sasl验证程序可以正常工作了

 
特别声明:以上内容(如有图片或视频亦包括在内)为网络用户发布,本站仅提供信息存储服务。
 
postfix邮件服务器(debian sarge)  1、简要说明   简易安装postfix邮件服务器   2.1、mail:~#apt-get install postfix   安装,根据提示选"Internet Site"   Where should mail for root go填postfix   Mail name?填mail.wjjennluen.com   Other destinations to accept mail for?(blank for none)填mail.wjjennluen.com, localhost.wjjennleun.com, ,localhost   Force synchronous updates on mail queue?选否   2.2、检查postfix服务是不是已经运行   mail:~# netstat -ln|grep 25   tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN   tcp6 0 0 :::25 :::* LISTEN   unix 2 [ ACC ] STREAM LISTENING 20256 /tmp/.ICE-unix/11772   2.3、测试postfix   mail:~# telnet 127.0.0.1 25   Trying 127.0.0.1...   Connected to 127.0.0.1.   Escape character is '^]'.   220 mail.wjjennluen.com ESMTP Postfix (Debian/GNU)   ehlo mail   250-mail.wjjennluen.com   250-PIPELINING   250-SIZE 10240000   250-VRFY   250-ETRN   250 8BITMIME   mail from: "This is a test mail!"   250 Ok   rcpt to:   250 Ok   data   354 End data with .   This is a test mail!   .   250 Ok: queued as 4888ACA0060   quit   221 Bye   Connection closed by foreign host.   好象是发出去了噢   2.4、检查刚发的邮件是否收到   mail:~#apt-get install mailx   下载mail阅读器   mail:~# su - wxt   wxt@mail~:$ mail   No mail for wxt   wxt@mail:~$exit   mail:~#:   my god,没有邮件啊   mail~:#more /var/mail/wxt   没有   mail~:#more /var/spool/mail/wxt   没有   咱回事呢   mail:~# telnet 127.0.0.1 25   Trying 127.0.0.1...   Connected to 127.0.0.1.   Escape character is '^]'.   220 mail.wjjennluen.com ESMTP Postfix (Debian/GNU)   ehlo mail   250-mail.wjjennluen.com   250-PIPELINING   250-SIZE 10240000   250-VRFY   250-ETRN   250 8BITMIME   mail from: "abc"   250 Ok   rcpt to:   250 Ok   data   354 End data with .   abc   .   250 Ok: queued as 609D0CA00BB   quit   221 Bye   Connection closed by foreign host.   mail:~# more /var/mail/wxt   From wxt@mail.wjjennluen.com Sat Jul 2 18:33:56 2005   Return-Path:   X-Original-To: wxt   Delivered-To: wxt@mail.wjjennluen.com   Received: from mail (localhost.localdomain [127.0.0.1])   by mail.wjjennluen.com (Postfix) with ESMTP id 609D0CA00BB   for ; Sat, 2 Jul 2005 18:33:42 +0800 (CST)   Message-Id:   Date: Sat, 2 Jul 2005 18:33:42 +0800 (CST)   From: wxt@mail.wjjennluen.com   To: undisclosed-recipients:;   abc   mail:~#   收到了,此时postfix工作在127.0.0.1上的,也就是localhost   查看mydestination参数的设定    mail:~# postconf |grep mydestination   mydestination = mail.wjjennluen.com, localhost.wjjennluen.com, , localhost   没有wjjennleun.com,所以用wxt@wjjennluen.com发信,postfix不会接受,所以要添加wjjennluen.com给mydestination   mail:~# postconf |grep mydestination   mydestination = mail.wjjennluen.com wjjennluen.com localhost.wjjennluen.com localhost   现在就可以收到了   mail:~#/var/mail/wxt   mail:~# telnet 127.0.0.1 25   Trying 127.0.0.1...   Connected to 127.0.0.1.   Escape character is '^]'.   220 mail.wjjennluen.com ESMTP Postfix (Debian/GNU)   ehlo mail   250-mail.wjjennluen.com   250-PIPELINING   250-SIZE 10240000   250-VRFY   250-ETRN   250 8BITMIME   mail from: "abc"   250 Ok   rcpt to:   250 Ok   data   354 End data with .   abc   .   250 Ok: queued as 609D0CA00BB   quit   221 Bye   Connection closed by foreign host.   mail:~# more /var/mail/wxt   From wxt@mail.wjjennluen.com Sat Jul 2 18:33:56 2005   Return-Path:   X-Original-To: wxt   Delivered-To: wxt@mail.wjjennluen.com   Received: from mail (localhost.localdomain [127.0.0.1])   by mail.wjjennluen.com (Postfix) with ESMTP id 609D0CA00BB   for ; Sat, 2 Jul 2005 18:33:42 +0800 (CST)   Message-Id:   Date: Sat, 2 Jul 2005 18:33:42 +0800 (CST)   From: wxt@mail.wjjennluen.com   To: undisclosed-recipients:;    abc    mail:~#      2.5、安装pop3,imap   mail:~#apt-get install courier-pop courier-imap   注意/etc/courier/pop3d配置文件   注意/etc/courier/imapd配置文件   用outlook测试pop3和imap成功   2.6、安装apache,php,squirrelmail   mail:~#apt-get apache php4 php4-common squirrelmail   修改/etc/apache/httpd.conf   加入PHP支持   AddType application/x-httpd-php .php   AddType application/x-httpd-php-source .phps   新建文件/var/www/test.php      phpinfo();   ?   在浏览器地址栏内输入http://192.168.0.15/test.php   可以确定PHP是否可以正常工作   2.7、从mailbox 更改为maildir   修改/etc/postfix/main.cf   增加参数设置   home_mailbox = Maildir/   更改mailbox_command 参数为   mailbox_command = /usr/bin/procmail -a "$EXTENSION" DEFAULT=$HOME/Maildir/   新增   MAILDIR=$HOME/Maildir   mail:~#cd /home/wxt/   mail:~#maildirmake Maildir   mail:~#chmod -R 750 Maildir   mail:~#ln -s /usr/share/squirrelmail /var/www/squirrelmail   修改/usr/share/squirrelmail/config/conf.pl内的变量$auto_create_special = ture;,让squirrelmail自动增加三个子目录   添加webmail虚拟主机(基于名子)   打开/etc/apache/httpd.conf   添加虚拟主机配置参数   NameVirtualHost 192.168.0.15      ServerAdmin root@localhost   DocumentRoot /var/www/squirrelmail   ServerName webmail.wjjennluen.com   ErrorLog /var/log/apache/webmail/error.log      mail:~#makdir /var/log/apache/webmail   mail:~#touch /var/log/apache/webmail/error.log   注意在named配置文件里面加入webmail.wjjennluen.com的记录   在浏览器的地址栏内输入webmail.wjjennluen.com就可以登陆webmail了   2.7、给postfix 加上smtp 认证   mail:~# apt-get install postfix-tls sasl2-bin libsasl2-modules   修改/etc/default/saslauthd文件,设定START = yes   修改/etc/postfix/sasl/smtpd.conf,设定saslauthd来认证smtp   mail:~#mkdir /etc/postfix/sasl   mail:~#echo "pwcheck_method: saslauthd" /etc/postfix/sasl/smtpd.con   添加帐户postfix到sasl组   mail:~#addgroup postfix sasl   修改/etc/postfix/main.cf, 使postfix使用sasl来实现smtp验证功能   #=====sasl======#   smtpd_sasl_auth_enable = yes   broken_sasl_auth_clients = yes   smtpd_sasl_security_options = noanonymous   smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, check_relay_domains, reject_unauth_destination   smtpd_client_restrictions = permit_sasl_authenticated   修改/etc/postfix/master.cf,让postfix不要以chroot启动,参数-v可以用来debug,正式上线为了不使大量的log,一定要拿掉   # ==============================================   # service type private unpriv chroot wakeup maxproc command + args   # (yes) (yes) (yes) (never) (100)   # ==============================================   smtp inet n - n - - smtpd -v   重新启动sasl 验证程序   mail:~# /etc/init.d/saslauthd restart   重新启动postfix   mail:~#/etc/init.d/postfix restart   mail:~# testsaslauthd -u wxt -p wxt   0: OK "Success."   测试sasl验证程序可以正常工作了
󰈣󰈤
 
 
 
>>返回首页<<
 
 热帖排行
 
 
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
©2005- 王朝网络 版权所有