邮件服务器安装--Postfix + Dovecot + Squirrelmail--CentOS 6.4

时间:2023-02-08 22:58:26

英文原文链接 : http://www.unixmen.com/install-postfix-mail-server-with-dovecot-and-squirrelmail-on-centos-6-4/

Postfix 是一款免费开源的 MTA. 兼顾易于管理, 响应快速, 安全有效的优点. 它也是 RHEL(CentOS) 默认的 MTA.

前期准备

1. 卸载原始 MTA sendmail:

[root@server ~]# yum remove sendmail

2. 配置 DNS 服务器并添加邮件服务器 MX 记录. 并让 ISP 支持你的静态 IP 与域名. (局域网搭建跳过此步骤)

3.1 在 /etc/hosts 加入完整的 hostname:

[root@server ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.200 server.cnblogs.com server

3.2 在 /etc/sysconfig/network 更改 hostname:

[root@server ~]# vi /etc/sysconfig/network
HOSTNAME=server.cnblogs.com

3.3 重启 Linux 使 hostname 生效.

[root@server ~]# reboot

4. 关闭 SELinux 来降低配置 postfix 的难度. ( 不关闭网页登不上 )

[root@server ~]# setenforce 

5. 安装 EPEL Repository: (根据自己的机器选择)

[root@server ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
[root@server ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

6. 给 Apache(后续进行安装) 开放 80 端口:

[root@server ~]# vi /etc/sysconfig/iptables
-A INPUT -p udp -m state --state NEW --dport -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport -j ACCEPT

安装 Postfix

[root@server ~]# yum install postfix -y

配置 Postfix

打开 /etc/postfix/main.cf 更改如下配置:

## Line no 75 - Uncomment and set your mail server FQDN ##
myhostname = server.cnblogs.com ## Line 83 - Uncomment and Set domain name ##
mydomain = cnblogs.com ## Line 99 - Uncomment ##
myorigin = $mydomain ## Line 116 - Set ipv4 ##
inet_interfaces = all ## Line 119 - Change to all ##
inet_protocols = all ## Line 164 - Comment ## #mydestination = $myhostname, localhost.$mydomain, localhost, ## Line 165 - Uncomment ##
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain ## Line 264 - Uncomment and add IP range ##
mynetworks = 192.168.1.0/24, 127.0.0.0/8 ## Line 419 - Uncomment ##
home_mailbox = Maildir/

保存并退出, 重启 Postfix 服务:

[root@server ~]# /etc/init.d/postfix start
[root@server ~]# /etc/init.d/postfix status
master (pid ) is running...
[root@server ~]# chkconfig postfix on

测试 Postfix

通过 telnet 进行测试, 没有 telnet 可通过 yum 安装, 一下出现红色字体表示输入.

新建测试用户 zl:

[root@server ~]# useradd zl
[root@server ~]# passwd zl
[root@server ~]# telnet localhost smtp
Trying ::...
Connected to localhost.
Escape character is '^]'.
server.cnblogs.com ESMTP Postfix
ehlo localhost
-server.cnblogs.com
-PIPELINING
-SIZE
-VRFY
-ETRN
-ENHANCEDSTATUSCODES
-8BITMIME
DSN
mail from:<zl>
2.1. Ok
rcpt to:<zl>
2.1. Ok
data
End data with <CR><LF>.<CR><LF>
welcome to cnblogs mail system
.
2.0. Ok: queued as 3E68E284C
quit
2.0. Bye
Connection closed by foreign host.

进入 zl mail 目录检查邮件:

[root@server ~]# ls /home/zl/Maildir/new/
.Vfd00I41ec0M251771.server.cnblogs.com
[root@server ~]# cat /home/zl/Maildir/new/.Vfd00I41ec0M251771.server.cnblogs.com
Return-Path: <zl@cnblogs.com>
X-Original-To: zl
Delivered-To: zl@cnblogs.com
Received: from localhost (localhost [IPv6:::])
by server.cnblogs.com (Postfix) with ESMTP id 3E68E284C
for <zl>; Wed, May :: + (IST)
Message-Id: <.3E68E284C@server.cnblogs.com>
Date: Wed, May :: + (IST)
From: zl@cnblogs.com
To: undisclosed-recipients:; welcome to cnblogs mail system

安装 Dovecot

Dovecote 是一款开源 IMAP/POP3 邮件服务器 for Unix/Linux systems.

[root@server ~]# yum install dovecot

配置 Dovecot

打开 /etc/dovecot/dovecot.conf 更改如下配置:

## Line 20 - umcomment ##
protocols = imap pop3 lmtp

打开 /etc/dovecot/conf.d/10-mail.conf:

## Line 24 - uncomment ##
mail_location = maildir:~/Maildir

打开 /etc/dovecot/conf.d/10-auth.conf:

## line 9 - uncomment##
disable_plaintext_auth = yes ## Line 99- Add a letter "login" ##
auth_mechanisms = plain login

打开 /etc/dovecot/conf.d/10-master.conf:

## Line 83, 84 - Uncomment and add "postfix"
#mode = 0600
user = postfix
group = postfix

开启 Dovecot 服务:

[root@server ~]# service dovecot start
Starting Dovecot Imap: [ OK ]
[root@server ~]# chkconfig dovecot on

测试 Dovecot

[root@server ~]# telnet localhost pop3
Trying ::...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user zl
+OK
pass 111111 ## Here 111111 is password of user "zl" ##
+OK Logged in.
list
+OK messages: .
retr 1
+OK octets
Return-Path: <zl@cnblogs.com>
X-Original-To: zl
Delivered-To: zl@cnblogs.com
Received: from localhost (localhost [IPv6:::])
by server.cnblogs.com (Postfix) with ESMTP id 3E68E284C
for <zl>; Wed, May :: + (IST)
Message-Id: <.3E68E284C@server.cnblogs.com>
Date: Wed, May :: + (IST)
From: zl@cnblogs.com
To: undisclosed-recipients:; welcome to cnblogs mail system
.
quit
+OK Logging out.
Connection closed by foreign host.

Dovecot 测试成功.

安装 Squirrelmail WebMail

安装 Squirrelmail:

[root@server ~]# yum install squirrelmail

配置 Squirrelmail

切换到 /usr/share/squirrelmail/config/ 并运行 conf.pl:

[root@server ~]# cd /usr/share/squirrelmail/config/
[root@server config]# ./conf.pl

( 可选 ) 进入 1.  Organization Preferences 设置定制的网页图标等等.

( 必须 ) 进入 2.  Server Settings -> 1.  Domain 设置自己的 domain.

( 必须 ) 进入 2.  Server Settings -> 3.  Sendmail or SMTP 设置成 SMTP.

回到主界面按 S & Q 保存并退出.

Apache 关联 Squirrelmail

在 apache 配置文件中新建一个 squirrelmail vhost:

[root@server config]# vi /etc/httpd/conf/httpd.conf
## Add the lines at the end of this file ##
Alias /squirrelmail /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
Options Indexes FollowSymLinks
RewriteEngine On
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
</Directory>

重启 Apache 服务:

[root@server config]# service httpd restart

到此环境搭建完成!

PS: Webmail 登录时只要输用户名即可, 不用输 @cnblogs.com . 使用的用户必须经过密码初始化, 即 passwd user.

http://ip-address/webmail or http://domain-name/webmail 访问 Webmail

邮件服务器安装--Postfix + Dovecot + Squirrelmail--CentOS 6.4的更多相关文章

  1. 搭建邮件服务器 Postfix &plus; Dovecot (CentOS)

    最近分配到一台ECS服务器,需要搭建一台邮件服务器. 查了一波资料选择了Postfix (smtp)和 Dovecot(pop3). 推荐教程:http://www.cnblogs.com/zlbei ...

  2. Linux搭建邮件服务器Postfix&plus;Dovecot&plus;MySQL&plus;PHP

    用于搭建的服务器信息 阿里云 Centos 6.5 32位 安装过程1.安装Postfix 版本(2:2.6.6-8.el6) yum -y install postfix 安装完成还需要替换系统自带 ...

  3. postfix&plus;dovecot配置多域名邮件服务器

    mail邮局系统的MX(邮件交换)记录配置,以便收发邮件.(MX记录,是邮件交换记录,它指向一个邮件服务器,用于电子邮件系统发邮件时根据收信人的地址后缀来定位邮件服务器,如果没有做域名解析,邮局不能正 ...

  4. CentOS 系统中安装postfix&plus;dovecot&plus;openwebmail &lt&semi;转&gt&semi;

    一.先卸载sendmain[root@ser ~]#  yum remove sendmail 二.安装postfix ,dovecot,cyrus-sasl[root@ser ~]#  yum -y ...

  5. centos6&period;8 搭建postfix&sol;dovecot邮件服务器

    postfix/dovecot邮件服务器 安装配置参考链接  http://www.cnblogs.com/jkklearn/p/7280045.html (domain 为自己域名 xxx.com) ...

  6. &lbrack;RHEL&rsqb; RHEL7&period;0 下 Postfix &plus; Dovecot 实现邮件发送

    RHEL7.0 下 Postfix + Dovecot 实现邮件发送 一.前言 大家都对邮件服务(mail service)很感兴趣嘛.我在自己 博客站 预言了自己会实战一次,访问量一天到十几(毕竟平 ...

  7. Postfix&plus;Dovecot&plus;MySQL搭建邮件服务器

    网上有很多使用Postfix搭建邮件服务器的文章,但目前貌似没有看到较为完整的一篇.本例将尝试在Ubuntu系统中使用Postfix+Dovecot+MySQL搭建邮件服务器. 说到邮件服务器,网上有 ...

  8. CentOS6 安装Sendmail &plus; Dovecot &plus; Squirrelmail

    本文记录在本地虚拟机CentOS6上搭建Sendmail + Dovecot + Squirrelmail 的Webmail环境的过程,仅仅是本地局域网的环境测试,不配置DNS, 也没有安全认证,Sq ...

  9. 邮件服务器Postfix的管理 重启php-fpm

    Postfix邮件系统安装与配置:Postfix,Cyrus-IMAP,Cyrus-sasl,Dovecot和SPFhttp://www.freehao123.com/postfix-cyrus/Ce ...

随机推荐

  1. C&sol;C&plus;&plus; 中的include

    当需要使用已有的方法或库时, 可以将它们的头文件#include进来. #include会在preprocess过程中被替换成它包含的代码. 头文件中包含了需要使用的函数/变量的声明. 当然声明与定义 ...

  2. x01&period;os&period;14&colon; 时间都去哪儿了

    时间都去哪儿了 老帕的“花儿为什么这样红”,三分钟引起六次欢呼,却败给了张碧晨.试想一下,如果是人气更高的陈冰,即使唱得和张碧晨一模一样,可能仍然不敌老帕,为什么张碧晨就能取胜呢?有这么个笑话:一人弹 ...

  3. 【hdu2896】病毒侵袭

    题目描述 当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻....在这样的时刻,人们却异常兴奋--我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊~~但网路上总有那么些 ...

  4. &lbrack;五&rsqb;JFreeChart实践四之直线图

    重点: 1.时间序列集合作为dataset,一个时间序列为一条折线 2.时间序列可以是月:年,小时:天 3.准备好时间序列要放入时间序列集合中 4.将时间序列集合作为dataset传入ChartFac ...

  5. 【转】Xcode7&period;1环境下上架iOS App到AppStore 流程 -- 不错!!

    原文网址:http://www.jianshu.com/p/a8bd16be122f 1.官网地址 Apple Developer 地址:https://developer.apple.com/mem ...

  6. node&period;js 解析xml BOM问题(xmlreader sax&period;js)

    Email:longsu2010 at yeah dot net 之前写了两篇文章关于node.js解析xml,说的是xmlreader,文章如下 node.js解析xml(xmlreader) no ...

  7. 使用react-router setRouteLeaveHook的钩子函数

    今天在使用react-router setRouteLeaveHook的钩子函数,不知道怎么实验就是成功.最后功夫不负有心人,终于让我找到使用setRouteLeaveHook的方法了 1.我在网络上 ...

  8. USB to UART

    USB to UART: 芯片选用CH340: 电源部分连接两个电容分别是0.1微法和10微法: 晶振连接12MHz; D+ D-  连接单片机的D+ D-

  9. vue请求拦截

    写了很多的vue项目,经常碰到需要做请求拦截的情况,从发请求前的token判断到对返回信息的响应,我自己在不同的阶段是用不同的方式处理的. 入门阶段 记得当时做的第一个项目,是需要在请求头部加入登录是 ...

  10. MySQL 索引 INDEX

    索引用于快速找出在某列中有特定值的行. 不使用索引,MySQL必须从第一条记录开始读完整个表,直到找到相关的行,表越大,查询数据所花费的时间就越多,如果表中查询的列有一个索引,MySQL能够快速到达一 ...