树叶云linux教程:15.2.2 配置Dovecot服务程序

Dovecot是一款能够为Linux系统提供IMAP和POP3电子邮件服务的开源服务程序,安全性极高,配置简单,执行速度快,而且占用的服务器硬件资源也较少,因此是一款值得推荐的收件服务程序。

第1步:安装Dovecot服务程序软件包。大家可自行配置Yum软件仓库、挂载光盘镜像到指定目录,然后输入要安装的dovecot软件包名称即可:

    [root@linuxprobe ~]# yum install dovecot
    Loaded plugins: langpacks, product-id, subscription-manager
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    rhel | 4.1 kB 00:00 
    Resolving Dependencies
    --> Running transaction check
    ---> Package dovecot.x86_64 1:2.2.10-4.el7 will be installed
    --> Processing Dependency: libclucene-core.so.1()(64bit) for package: 1:dovecot-2.2.10-4.el7.x86_64
    --> Processing Dependency: libclucene-shared.so.1()(64bit) for package: 1:dovecot-2.2.10-4.el7.x86_64
    --> Running transaction check
    ---> Package clucene-core.x86_64 0:2.3.3.4-11.el7 will be installed
    --> Finished Dependency Resolution
    Dependencies Resolved
    ================================================================================
     Package Arch Version Repository Size
    ================================================================================
    Installing:
     dovecot x86_64 1:2.2.10-4.el7 rhel 3.2 M
    Installing for dependencies:
     clucene-core x86_64 2.3.3.4-11.el7 rhel 528 k
    Transaction Summary
    ================================================================================
    Install 1 Package (+1 Dependent package)
    Total download size: 3.7 M
    Installed size: 12 M
    Is this ok [y/d/N]: y
    Downloading packages:
    --------------------------------------------------------------------------------
    Total 44 MB/s | 3.7 MB 00:00 
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
     Installing : clucene-core-2.3.3.4-11.el7.x86_64 1/2 
     Installing : 1:dovecot-2.2.10-4.el7.x86_64 2/2 
     Verifying : 1:dovecot-2.2.10-4.el7.x86_64 1/2 
     Verifying : clucene-core-2.3.3.4-11.el7.x86_64 2/2 
    Installed:
     dovecot.x86_64 1:2.2.10-4.el7 
    Dependency Installed:
     clucene-core.x86_64 0:2.3.3.4-11.el7 
    Complete!

第2步:配置部署Dovecot服务程序。在Dovecot服务程序的主配置文件中进行如下修改。首先是第24行,把Dovecot服务程序支持的电子邮件协议修改为imap、pop3和lmtp。然后在这一行下面添加一行参数,允许用户使用明文进行密码验证。之所以这样操作,是因为Dovecot服务程序为了保证电子邮件系统的安全而默认强制用户使用加密方式进行登录,而由于当前还没有加密系统,因此需要添加该参数来允许用户的明文登录。

    [root@linuxprobe ~]# vim /etc/dovecot/dovecot.conf
    ………………省略部分输出信息………………
    23 # Protocols we want to be serving.
    24 protocols = imap pop3 lmtp
    25 disable_plaintext_auth = no
    ………………省略部分输出信息………………

在主配置文件中的第48行,设置允许登录的网段地址,也就是说我们可以在这里限制只有来自于某个网段的用户才能使用电子邮件系统。如果想允许所有人都能使用,则不用修改本参数:

    44 # Space separated list of trusted network ranges. Connections from these
    45 # IPs are allowed to override their IP addresses and ports (for logging and
    46 # for authentication checks). disable_plaintext_auth is also ignored for
    47 # these networks. Typically you'd specify your IMAP proxy servers here.
    48 login_trusted_networks = 192.168.10.0/24

第3步:配置邮件格式与存储路径。在Dovecot服务程序单独的子配置文件中,定义一个路径,用于指定要将收到的邮件存放到服务器本地的哪个位置。这个路径默认已经定义好了,我们只需要将该配置文件中第24行前面的井号(#)删除即可。

    [root@linuxprobe ~]# vim /etc/dovecot/conf.d/10-mail.conf
    1 ##
    2 ## Mailbox locations and namespaces
    3 ##
    4 # Location for users' mailboxes. The default is empty, which means that Dovecot
    5 # tries to find the mailboxes automatically. This won't work if the user
    6 # doesn't yet have any mail, so you should explicitly tell Dovecot the full
    7 # location.
    8 #
    9 # If you're using mbox, giving a path to the INBOX file (eg. /var/mail/%u)
    10 # isn't enough. You'll also need to tell Dovecot where the other mailboxes are
    11 # kept. This is called the "root mail directory", and it must be the first
    12 # path given in the mail_location setting.
    13 #
    14 # There are a few special variables you can use, eg.:
    15 #
    16 # %u - username
    17 # %n - user part in user@domain, same as %u if there's no domain
    18 # %d - domain part in user@domain, empty if there's no domain
    19 # %h - home directory
    20 #
    21 # See doc/wiki/Variables.txt for full list. Some examples:
    22 #
    23 # mail_location = maildir:~/Maildir
    24 mail_location = mbox:~/mail:INBOX=/var/mail/%u
    25 # mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
    ………………省略部分输出信息………………

然后切换到配置Postfix服务程序时创建的boss账户,并在家目录中建立用于保存邮件的目录。记得要重启Dovecot服务并将其添加到开机启动项中。至此,对Dovecot服务程序的配置部署步骤全部结束。

    [root@linuxprobe ~]# su - boss
    Last login: Sat Aug 15 16:15:58 CST 2017 on pts/1
    [boss@mail ~]$ mkdir -p mail/.imap/INBOX
    [boss@mail ~]$ exit
    [root@linuxprobe ~]# systemctl restart dovecot 
    [root@linuxprobe ~]# systemctl enable dovecot 
    ln -s '/usr/lib/systemd/system/dovecot.service' '/etc/systemd/system/multi-user.target.wants/dovecot.service'

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/178490.html<

(0)
运维的头像运维
上一篇2025-03-26 03:07
下一篇 2025-03-26 03:08

相关推荐

  • 个人主题怎么制作?

    制作个人主题是一个将个人风格、兴趣或专业领域转化为视觉化或结构化内容的过程,无论是用于个人博客、作品集、社交媒体账号还是品牌形象,核心都是围绕“个人特色”展开,以下从定位、内容规划、视觉设计、技术实现四个维度,详细拆解制作个人主题的完整流程,明确主题定位:找到个人特色的核心主题定位是所有工作的起点,需要先回答……

    2025-11-20
    0
  • 社群营销管理关键是什么?

    社群营销的核心在于通过建立有温度、有价值、有归属感的社群,实现用户留存、转化和品牌传播,其管理需贯穿“目标定位-内容运营-用户互动-数据驱动-风险控制”全流程,以下从五个维度展开详细说明:明确社群定位与目标社群管理的首要任务是精准定位,需明确社群的核心价值(如行业交流、产品使用指导、兴趣分享等)、目标用户画像……

    2025-11-20
    0
  • 香港公司网站备案需要什么材料?

    香港公司进行网站备案是一个涉及多部门协调、流程相对严谨的过程,尤其需兼顾中国内地与香港两地的监管要求,由于香港公司注册地与中国内地不同,其网站若主要服务内地用户或使用内地服务器,需根据服务器位置、网站内容性质等,选择对应的备案路径(如工信部ICP备案或公安备案),以下从备案主体资格、流程步骤、材料准备、注意事项……

    2025-11-20
    0
  • 如何企业上云推广

    企业上云已成为数字化转型的核心战略,但推广过程中需结合行业特性、企业痛点与市场需求,构建系统性、多维度的推广体系,以下从市场定位、策略设计、执行落地及效果优化四个维度,详细拆解企业上云推广的实践路径,精准定位:明确目标企业与核心价值企业上云并非“一刀切”的方案,需先锁定目标客户群体,提炼差异化价值主张,客户分层……

    2025-11-20
    0
  • PS设计搜索框的实用技巧有哪些?

    在PS中设计一个美观且功能性的搜索框需要结合创意构思、视觉设计和用户体验考量,以下从设计思路、制作步骤、细节优化及交互预览等方面详细说明,帮助打造符合需求的搜索框,设计前的规划明确使用场景:根据网站或APP的整体风格确定搜索框的调性,例如极简风适合细线条和纯色,科技感适合渐变和发光效果,电商类则可能需要突出搜索……

    2025-11-20
    0

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注