一、先卸载sendmain
[root@ser ~]#  yum remove sendmail

二、安装postfix ,dovecot,cyrus-sasl
[root@ser ~]#  yum -y install postfix
[root@ser ~]#  yum -y install dovecot
[root@ser ~]#  yum -y install cyrus-sasl

三、修改postfix的配置文件
[root@ser ~]# vim /etc/postfix/main.cf
myhostname = mail.eimam.com
mydomain = eimam.com
myorigin = eimam.com
inet_interfaces =all
mynetworks = 192.168.1.0/240
relay_domains = yjw.com, $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,       mail.$mydomain, www.$mydomain, ftp.$mydomain
重启 postfix 服务
[root@ser ~]# service postfix restart
Shutting down postfix:                                     [  OK  ]
Starting postfix:                                          [  OK  ]
[root@ser ~]# chkconfig  postfix on
[root@ser ~]# chkconfig  dovecot on
修改dovecot的配置文件
vim /etc/dovecot.conf
protocols = imap imaps  pop3 pop3s
listen = *
在iptables 里开放25,110,143端口
[root@ser ~]# vim /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 110 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 143 -j ACCEPT
重启iptables
[root@ser ~]# service iptables restart
Flushing firewall rules:                               [  OK  ]
Setting chains to policy ACCEPT: filter                [  OK  ]
Unloading iptables modules:                            [  OK
Applying iptables firewall rules:                     [  OK  ]
Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]ntrack_ftp
[root@ser ~]# chkconfig  saslauthd on
修改 /etc/sysconfig/saslauthd
[root@ser ~]# vim /etc/sysconfig/saslauthd
# Directory in which to place saslauthd's listening socket, pid file, and so
# on.  This directory must already exist.
SOCKETDIR=/var/run/saslauthd
# Mechanism to use when checking passwords.  Run "saslauthd -v" to get a list
# of which mechanism your installation was compiled with the ablity to use.
MECH=shadow
# Additional flags to pass to saslauthd on the command line.  See saslauthd(8)
# for the list of accepted flags.
FLAGS=
修改 /usr/lib/sasl2/smtpd.conf
[root@ser ~]# vim /usr/lib64/sasl2/smtpd.conf
pwcheck_method: saslauthd
测试 saslauthd
[root@ser ~]# service saslauthd  restart
[root@ser ~]# testsaslautd  -u yjw -p '020304'
0: OK "Success."
在postfix 的配置文件中,添加以下内容,使其支持SMTP认证
[root@ser ~]#  vim /etc/postfix/main.cf
message_size_limit = 1073741824   # 邮件的大小为10M
default_process_limit = 50
default_destination_concurrency_limit = 20
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =  $myhostname
smtpd_sasl_application_name = smtpd
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated,reject_unauth_destination
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_security_options = noanonymous
测试 25端口
[root@ser ~]#  telnet mail.yjw.com 25 
Trying 192.168.1.2...
Connected to mail.yjw.com (192.168.1.2).
Escape character is '^]'.
220 mail.yjw.com ESMTP Postfix
EHLO  163.com
250-mail.yjw.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
[root@ser ~]#

四、安装openwebmail
[root@ser ~]# vim /etc/yum.repos.d/openwebmail.repo 
[openwebmail]
## Thomas Chung
## 2008.05.29
name=Openwebmail for Fedora or Enterprise Linux
baseurl=http://openwebmail.org/openwebmail/download/redhat/rpm/release/
enabled=1
gpgcheck=1
gpgkey=http://openwebmail.org/openwebmail/download/redhat/rpm/release/RPM-GPG-KEY-openwebmail
#metadata_expire=0
若这样安装不成功,先安装 perl-Text-Iconv-1.4-1.2.el4.rf.i386.rpm
[root@ser ~]#  yum -y  install openwebmail
[root@ser ~]# cd /var/www/cgi-bin/openwebmail/
[root@ser openwebmail]# ./openwebmail-tool.pl  --init  #出现Y/N时 ,按N.
修改openwebmail 的一些配置文件
[root@ser etc]# vim dbm.conf
dbm_ext                 .db
dbmopen_ext             .db
dbmopen_haslock         no
[root@ser etc]]# cd defaults/
[root@ser defaults]#  vim dbm.conf
dbm_ext                 .db
dbmopen_ext             .db
dbmopen_haslock         yes
smtpserver  192.168.1.2
[root@ser defaults]#  vim openwebmail.conf
domainnames             yjw.com
smtpserver              192.168.1.2
authpop3_server         192.168.1.2
再次初始化openwebmail
[root@ser defaults]# cd  ../../openwebmail-tool.pl  --init 
出现Y/N 时,按Y。
把Postfix+Dovecot+Openwebmail 三者个格式统一下就行了
1.postfix 配置 main.cf
mail_spool_directory = /var/spool/mail
2.Dovecot 配置 Dovecot.conf
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%u
3.Openwebmail.conf
mailspooldir /var/spool/mail

五、安装httpd
[root@ser ~]# yum - y install httpd
[root@ser ~]# chkconfig httpd on
[root@ser ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@ser ~]# vim /etc/httpd/conf/httpd.conf
ServerAdmin
root@yjw.com
ServerName  mail.yjw.com:80
AddHandler cgi-script .cgi .pl

六、登陆openwebmail
在IE 中输入  mail.yjw.com/cgi-bin/openwebmail/openwebmail.pl,  这个地址是不是很长,那么我们来点短点的
在  httpd的 配置文件中添加 下面 内容:
ScriptAlias  /mail    /var/www/cgi-bin/openwebmail/openwebmail.pl
这样在IE 中直接输入
mail.yjw.com/mail

七、安装反垃圾邮件软件,MailScanner
到MailScanner .org 上下载MailScanner-4.75.11-1.rpm.tar.gz
[root@ser ~]#  tar zxvf  MailScanner-4.75.11-1.rpm.tar.gz
[root@ser ~]#  cd  MailScanner-4.75.11
[root@ser MailScanner-4.75.11-1]# ./install.sh    # 安装
安装 spamassassin
先检查您的系统内是否已经安装SpamAssassin软件包。在文本终端中输入:
[root@ser ~]#          rpm -qa | grep spamassassin
spamassassin-3.1.9-1.el5
下载Mail-SpamAssassin-3.2.5.tar.gz
[root@ser ~]#tar  -zxvf Mail-SpamAssassin-3.2.5.tar.gz
[root@ser ~]# cd Mail-SpamAssassin-3.2.5
[root@ser ~]# perl Makefile.PL
[root@ser ~]# make
[root@ser ~]#  make install
打开/etc/MailScanner/目录中的MailScanner.conf文件,主要说明修改的关键部分:
%org-name%  = yjw.com
%org-long-name% = yjw
web-site% = mail.yjw.com
Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = postfix
Incoming Work Group = postfix
Quarantine User = postfix 
Quarantine Group = postfix
Always Include SpamAssassin Report = yes
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin
SpamAssassin Install Prefix = /usr/bin
Log Speed = yes
Log Spam = yes
Log Silent Viruses = yes
Phishing Modify Subject = yes
更改incoming,quarantine 两个2个目录
[root@ser ~]# service spamassassin restart
[root@ser ~]# service spamassassin on
[root@ser ~]# service MailScanner  restart
[root@ser ~]# service MailScanner  on
[root@ser ~]# chown -R postfix:postfix /var/spool/MailScanner/*
[root@ser ~]# cd /var/spool/MailScanner/
[root@ser MailScanner]# ll
drwxr-xr-x 4 postfix postfix 4096 Apr 30 16:56 incoming
drwxr-xr-x 3 postfix postfix 4096 Apr 29 19:10 quarantine
drwx------ 2 postfix postfix 4096 Apr 30 15:58 spamassassin
在/etc/postfix/header_checks 中增加一句话:
[root@ser ~]# vi  /etc/postfix/header_checks
/^Received:/    HOLD 
设置中文邮件过滤规则
[root@ser ~]# wget -N -P
http://www.ccert.edn.cn/spam/sa/Chiese_rules.cf
  /usr/share/spamassassin
使用计划任务来更新规则
[root@ser ~]#  crontab  -e
0 0 1 * * wget - N  -P   /usr/share/spamassassin
http://www.ccert.edu.cn/spam/sa/Chiness_rules.cf
;  /etc/init.d/spamassassin restart

八、登陆openwebmail, 测试 收信,发信是否正常
[root@ser ~]# useradd  tom
[root@ser ~]# passwd  tom
tom
tom
[root@ser ~]# useradd yjw
[root@ser ~]# passwd  yjw

CentOS 系统中安装postfix+dovecot+openwebmail <转>的更多相关文章

  1. 如何在CentOS系统中安装配置SNMP服务

    CentOS(Community Enterprise Operating System,中文意思是:社区企业操作系统)是Linux发行版之一,现在有一大部分服务器在使用此操作系统:SNMP(简单网络 ...

  2. 暑假第二周总结(在centos系统中安装eclipse出错,改为安装ubantu)

    本周试着在centos6.4系统上安装eclipse,在林子雨老师的教程所给的链接无法下载,后来找了许多的教程,即便是从官网下载之后,即便是安装好之后eclipse都无法正常启动,后来翻阅借阅的图书后 ...

  3. CentOS 6.x 系统中安装原生 Hadoop 2

    2020年整理博客发现原文地址已经失效,推荐学习地址厦门大学数据库实验室 本教程适合于在 CentOS 6.x 系统中安装原生 Hadoop 2,适用于Hadoop 2.7.1, Hadoop 2.6 ...

  4. 在CentOS 7中安装nginx服务器

    简要地介绍一下,如何在CentOS 7中安装nginx服务器  下载对应当前系统版本的nginx包(package) # wget  http://nginx.org/packages/centos/ ...

  5. 在CentOS 7中安装与配置Tomcat-8方法

    安装前提 在CentOS 7中安装与配置JDK8 安装tomcat  apache-tomcat-8.0.14.tar.gz文件上传到/usr/local中执行以下操作: [root@localhos ...

  6. Linux Centos 系统上安装BT客户端 Transmission

    Linux Centos 系统上安装BT客户端 Transmission   Transmission是一种BitTorrent客户端,特点是一个跨平台的后端和其上的简洁的用户界面,以MIT许可证和G ...

  7. 在 Linux 系统中安装Load Generator ,并在windows 调用方法

    在 Linux 系统中安装Load Generator ,并在windows 调用 由于公司需要测试系统的最大用户承受能力,所以需要学习使用loadrunner.在安装的时候碰到了不少问题,所以写下此 ...

  8. CentOS系统下安装python3+Django

    转载:CentOS系统下安装python3+Django 1.首先用yum安装下vim,因为CentOS 7可能根本没自带完整vim,经常出现输入乱码:yum -y install vim 2.安装开 ...

  9. 如何在CentOS 7中安装最新Git(源码安装)

    如何在CentOS 7中安装最新Git 2017年05月20日 11:49:53 阅读数:1624 Git是在今天的软件开发行业一个非常有用的版本控制工具.我一直使用Git.于是为Linux公社的读者 ...

随机推荐

  1. java 文件的基本操作

    1 /** * java 文件操作 * 2016/5/10 **/ package cn.Java_7; import java.io.*; import java.util.Scanner; imp ...

  2. Minigui3.0 自定义遥控输入引擎

    本人最近在从事minigui的开发工作,使用的gui版本为最新的3.0.12,平台环境为海思的HI3515. 在历经千辛万苦,终于将gui成功的移植到了开发板上,这里不多赘述,没有移植成功的朋友可以点 ...

  3. mysql编码设置 [http://blog.knowsky.com/254652.htm]

    MYSQL 2009-09-11 15:37 阅读73 评论1 字号: 大大 中中 小小mysql> SHOW VARIABLES LIKE 'character_set_%';+------- ...

  4. 基于hadoop的图书推荐

    根据在炼数成金上的学习,将部分代码总结一下在需要的时候可以多加温习.首先根据原理作简要分析.一般推荐系统使用的协同过滤推荐模型:分别是基于ItemCF的推荐模型或者是基于UserCF的推荐模型:首先分 ...

  5. URL scheme添加以及查找方式

    2.1.1  添加URL Types URL Scheme是通过系统找到并跳转对应app的一类设置,通过向项目中的info.plist文件中加入URL types可使用第三方平台所注册的appkey信 ...

  6. 标准IO库

    IO标准库类型和头文件

  7. QTP连接MySQL

    1.首先安装mysql数据驱动,qtp在windows系统下操作连接mysql,所以下载mysql-connector-odbc-   5.1.8-win32.msi 下载地址:http://mysq ...

  8. static静态初始化块

    Java 中可以通过初始化块进行数据赋值.如: 在类的声明中,可以包含多个初始化块,当创建类的实例时,就会依次执行这些代码块.如果使用 static 修饰初始化块,就称为静态初始化块. 需要特别注意: ...

  9. Django:之CMDB资源系统

    渐谈CMDB需要内容,ITIL.CMDB介绍.Django自定义用户认证.Restful规范.资产管理功能开发. ITIL介绍 TIL即IT基础架构库(Information Technology I ...

  10. pro文件常用内容

    qmake生成的pro文件中常用变量 SUBDIRS 指定子目录 TARGET 指定生成的应用程序名(默认为项目名) DEPENDPATH 指定程序编译时依赖的相关路径 INCLUDEPATH 指定头 ...