Postfix的安装与启动

运维 系统运维
在Linux系统下,sendmail是默认的邮件服务,但是同时也无可避免地会有一些缺陷。如何安装postfix呢?首先应该卸载sendmail的进程,继而启动postfix程序。

postfix安装启动过程:

  1、杀掉所有Sendmail进程

  #killall sendmail (停止所有的Sendmaail进程)

  sendmail: no process killed

  # rpm -ivh postfix-2.2.5-3.rhel4.i386.rpm

  2、启动dovecot服务过程:

  # service postfix start

  Starting postfix: [ 确定 ]

  # service dovecot start

  启动 Dovecot Imap: [ 确定 ]

  现在可以使用邮件服务器发送邮件了,但是还不能下载邮件,因为新版redhat Linux中 dovecot代替了imap软件包,但是还没有绑定POP3和POP协议,下面修改配置文件: /etc/dovecot.conf,

  #protocols = imap imap3

  protocols = imap imap3 pop3 pop3s

  auth_passdb =

  更改为:

  auth_passdb = shadow

  然后重新启动dovecot服务:

  # service dovecot restart

  停止 Dovecot Imap: [ 确定 ]

  启动 Dovecot Imap: [ 确定 ]

  3、修改postfix邮件服务器配置文件:

  #myhostname = host.domain.tld

  更改为:

  myhostname = mail.cao.net

  #mydomain = domain.tld

  更改为:

  mydomain = cao.net

  #myorigin = $mydomain

  更改为:

  Myorigin = cao.net

  #inet_interfaces = all

  更改为:

  Inet_interfaces =all

  #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain, ftp.$mydomain

  更改为:

  mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain,

  ftp.$mydomain

  #mynetworks = host

  更改为:

  mynetworks = host

  4、端口测试:

  # telnet mail.cao.net 25 (测试25端口)

  Trying 127.0.0.1...

  Connected to localhost.localdomain (127.0.0.1).

  Escape character is '^]'.

  220 mail.cao.net ESMTP Postfix

  quit

  221 Bye

  Connection closed by foreign host.

  # telnet mail.cao.net 110 (测试110端口)

  Trying 127.0.0.1...

  Connected to localhost.localdomain (127.0.0.1).

  Escape character is '^]'.

  +OK dovecot ready.

  quit

  +OK Logging out

  Connection closed by foreign host.

#p#

  5、安装防范病毒软件

  F-Prot Antivirus软件包安装和配置过程:

  Wegt http://files.f-prot.com/files/linux-x86/fp-linux-ws.rpm

  安装F-Prot Antivirus软件包前,请先启动SpamAssassin服务器:

  Matt Sergeant、Craig Hughes和Justin Mason于发布的SpamAssassin(SA)。目前***版本是3.0.2,它是较为流行的反垃圾邮件软件,据SpamAssassin供应商 Deersoft的统计,目前大约有3万台Unix服务器上使用了SpamAssassin。SpamAssassin利用Perl语言来对邮件内容进行规则匹配,从而达到判断过滤垃圾邮件的目的。它的判断方式是基于评分的方式,也就是说如果这封邮件符合某条规则,则给与一定分值;当累计的分值超过了一定限度时,则判定该邮件为垃圾邮件。对Sendmail、Qmail、Postfix和Exim等各种邮件平台都适用。SpamAssassin的安装过程比较简单。

  # service spamassassin start (启动SpamAssassin服务器)

  Starting spamd: [ 确定 ]

  # rpm -ivh fp-linux-ws.rpm (安装F-Prot Antivirus软件包)

  升级的F-Prot Antivirus病毒库的操作:

  # cd /usr/local/f-prot/tools/

  # ./check-updates.pl (升级命令)

  ***************************************

  * F-Prot Antivirus Updater *

  ***************************************

  Nothing to be done...

  MailScanner软件包安装和配置过程:

  Wegt http://www.sng.ecs.soton.ac.uk/mailscanner/downloads.shtml

  # mv MailScanner-4.50.5-1.rpm.tar.gz /tmp/source/ (移动文件到/tmp/source/目录中)

  # cd /tmp/source/ (进入source目录中)

  # tar -zxvf MailScanner-4.50.5-1.rpm.tar.gz (MailScanner解压过程)

  # cd MailScanner-4.50.5-1 (进入MailScanner软件解压目录)

  # ./install.sh (执行MailScanner软件的安装命令)

  更改incoming、quarantine两个目录相关用户和组的使用权限:

  # chown postfix.postfix /var/spool/MailScanner/incoming

  # chown postfix.postfix /var/spool/MailScanner/quarantine

  修改/etc/MailScanner/目录下的MailScanner.conf文件,修改详细内容以下:

  详细内容:

  Run As User =

  Run As Group =

  更改为:

  Run As User = postfix

  Run As Group = postfix

  Incoming Queue Dir = /var/spool/mqueue.in

  Outgoing Queue Dir = /var/spool/mqueue

  更改为:

  Incoming Queue Dir = /var/spool/postfix/hold

  Outgoing Queue Dir = /var/spool/postfix/incoming

  MTA = sendmail

  更改为:

  MTA = postfix

  Virus Scanners = none

  更改为:

  Virus Scanners = f-prot

  Always Include SpamAssassin Report = no

  更改为:

  Always Include SpamAssassin Report = yes

  Use SpamAssassin = no

  更改为:

  Use SpamAssassin = yes

  Required SpamAssassin Score = 6

  更改为:

  Required SpamAssassin Score = 4

  SpamAssassin User State Dir =

  更改为:

  SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin

  SpamAssassin Install Prefix =

  更改为:

  SpamAssassin Install Prefix = /usr/bin

  SpamAssassin Local Rules Dir =

  更改为:

  SpamAssassin Local Rules Dir = /etc/MailScanner

  修改/etc/postfix/目录下的header_checks文件,新增加以下一行内容到文件中,详细内容如下:

  /^Received:/ HOLD

  修改/etc/postfix/目录下的main.conf文件,详细内容如下:

  #header_checks = regexp:/etc/postfix/header_checks

  更改为:

  header_checks = regexp:/etc/postfix/header_checks

  停止Postfix服务器,因为启动MailScanner服务时会自动启动Postfix服务器:

  启动MailScanner服务器和设置开机时自动启动:

  # service MailScanner start

  Starting MailScanner daemons:

  incoming postfix: [ 确定 ]

  outgoing postfix: [ 确定 ]

  MailScanner: [ 确定 ]

  # chkconfig --level 33 MailScanner on

#p#

  6、病毒检测测试:

  从网站(http://www.eicar.org/anti_virus_test_file.htm)下载一个测试病毒文件:eicar.com。编写一封测试邮件(附件中带上的eicar.com文件)。系统检测到邮件病毒,见图1。

  

 

Postfix/安装/启动

  图1 病毒检测界面

  查看maillog日志,请确认日志中是否存在以下相近的信息:

  详细内容:

  Jan 8 12:11:08 mail MailScanner[9199]: Virus Scanning: F-Prot found virus EICAR_Test_File

  Jan 8 12:11:08 mail MailScanner[9199]: Virus Scanning: F-Prot found 1 infections

  Jan 8 12:11:08 mail MailScanner[9199]: Infected message E73EE13C07C.07685 came from

  Jan 8 12:11:08 mail MailScanner[9199]: Virus Scanning: Found 1 viruses

  Jan 8 12:11:09 mail MailScanner[9199]: Requeue: A9D6413C085.39DDE to 6414713C089

  Jan 8 12:11:09 mail MailScanner[9199]: Uninfected: Delivered 1 messages

  如出现以上的日志信息就代表您的F-Prot Antivirus + MailScanner-4.31.6-1架设已经成功啦,

  7、如果希望邮件服务器每次启动都能自动运行,可以用服务设置功能。以root权限运行命令:

  #redhat-config-services

  

 

Postfix/安装/启动

  图2 邮件服务器自动启动

  打开如图2所示的窗口,在dovecot服务选项加上勾,然后重新启动系统,这样系统会启动邮件服务。

【编辑推荐】

  1. Postfix对邮件的处理流程
  2. Linux下的邮件服务器 postfix
  3. 如何安装Postfix
  4. Postfix邮件安装实现介绍
  5. Postfix入门篇
  6. postfix 安装配置
  7. Postfix的配置

 

 

责任编辑:zhaolei 来源: 网络转载
相关推荐

2011-01-18 15:00:17

Postfix安装

2011-01-18 14:47:22

Postfix

2010-06-02 17:36:31

postfix概述

2010-01-14 12:15:10

CentOS post

2010-06-02 18:17:09

Postfix邮件

2010-06-07 11:22:28

2010-05-25 18:57:42

启动postfix

2011-01-20 10:08:25

postfix安装

2011-02-21 14:12:15

Postfix服务器安装

2010-06-09 18:08:52

Postfix邮件

2011-02-21 09:26:43

Postfixpopimap

2011-02-21 13:08:37

postfix配置

2011-01-19 09:16:48

Postfix配置

2011-01-18 18:52:14

Postfix结构

2011-01-19 09:55:27

postfix

2011-01-19 09:57:48

Postfix控制

2011-01-19 13:39:38

Postfix邮件监控

2011-02-21 11:14:47

Postfix配置

2010-05-25 14:57:17

postfix安装配置

2010-06-17 16:08:51

Grub2 编辑
点赞
收藏

51CTO技术栈公众号