Postfix+dovecot邮件服务器搭建(麒麟系统+UOS foxmail客户端)

这篇博客详细记录了在KylinLinuxV10系统上安装和配置邮件服务器的过程,包括安装dovecot、postfix等软件包,设置邮件账号和域名,以及启用和检查服务状态。此外,还涉及到了防火墙的临时关闭以进行远程连接测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

麒麟邮件客户端安装相关的软件包


[root@mail ~]# cat /etc/os-release
NAME="Kylin Linux Advanced Server"
VERSION="V10 (Sword)"
ID="kylin"
VERSION_ID="V10"
PRETTY_NAME="Kylin Linux Advanced Server V10 (Sword)"
ANSI_COLOR="0;31"

[root@mail ~]# hostnamectl set-hostname mail.test.com
[root@mail ~]# cd /opt/
[root@mail opt]# ls
clucene-core-2.3.3.4-35.ky10.x86_64.rpm  dovecot-2.3.10.1-3.p02.ky10.x86_64.rpm  firefox  patch_workspace  postfix-3.3.1-10.ky10.x86_64.rpm
[root@mail opt]# rpm -ivh dovecot-2.3.10.1-3.p02.ky10.x86_64.rpm clucene-core-2.3.3.4-35.ky10.x86_64.rpm postfix-3.3.1-10.ky10.x86_64.rpm
警告:dovecot-2.3.10.1-3.p02.ky10.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID 7a486d9f: NOKEY
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
        软件包 clucene-core-2.3.3.4-35.ky10.x86_64 已经安装
        软件包 dovecot-1:2.3.10.1-3.p02.ky10.x86_64 已经安装
        软件包 postfix-2:3.3.1-10.ky10.x86_64 已经安装

变量配置

[root@mail opt]# vi /etc/postfix/main.cf
myhostname = mail.test.com
mydomain = test.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, $mydomain
home_mailbox = Maildir/

[root@mail]# groupadd mailusers          //添加邮件账号组
[root@mail]# useradd -g mailusers -s /sbin/nologin haojiahuo
[root@mail]# passwd haojiahuo
[root@mail]# useradd -g mailusers -s /sbin/nologin niuniuniu
[root@mail]# passwd niuniuniu  //添加邮件服务测试账号
[root@mail]# yum install -y telnet      //安装远程登录插件,用于登录25端口测试
[root@mail]# telnet mail.test.com 25   //远程登录25端口,如报错连接不上,重启postfix

[root@mail conf.d]# cat /etc/dovecot/conf.d/10-auth.conf |grep -v ^# |grep -v ^$
ssl = no
disable_plaintext_auth = no
mail_location =maildir:~/Maildir
auth_mechanisms = plain
!include auth-system.conf.ext


[root@mail opt]# cat /etc/dovecot/dovecot.conf |grep -v ^# |grep -v ^$
protocols = imap pop3 lmtp
listen = *
dict {
  #quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
  #expire = sqlite:/etc/dovecot/dovecot-dict-sql.conf.ext
}
!include conf.d/*.conf
!include_try local.conf

[root@mail ~]# cat /etc/dovecot/conf.d/10-ssl.conf |grep -v ^$|grep -v ^#
ssl = no
ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = </etc/pki/dovecot/private/dovecot.pem
ssl_cipher_list = PROFILE=SYSTEM

服务器状态(查看端口情况/禁用防火墙)

注意:实际生产情况禁止禁用防火墙


[root@mail ~]# systemctl restart postfix
[root@mail ~]# systemctl status  postfix
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-11-23 01:26:21 CST; 4s ago
  Process: 6069 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
  Process: 6072 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 6074 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
 Main PID: 6142 (master)
    Tasks: 3
   Memory: 3.0M
   CGroup: /system.slice/postfix.service
           ├─6142 /usr/libexec/postfix/master -w
           ├─6143 pickup -l -t unix -u
           └─6144 qmgr -l -t unix -u

1123 01:26:21 mail.test.com systemd[1]: Starting Postfix Mail Transport Agent...
1123 01:26:21 mail.test.com postfix/master[6142]: daemon started -- version 3.3.1, configuration /etc/postfix
1123 01:26:21 mail.test.com systemd[1]: Started Postfix Mail Transport Agent.
[root@mail ~]#
[root@mail ~]# systemctl restart dovecot
[root@mail ~]# systemctl status dovecot
● dovecot.service - Dovecot IMAP/POP3 email server
   Loaded: loaded (/usr/lib/systemd/system/dovecot.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-11-23 01:26:41 CST; 5s ago
     Docs: man:dovecot(1)
           http://wiki2.dovecot.org/
  Process: 6154 ExecStartPre=/usr/libexec/dovecot/prestartscript (code=exited, status=0/SUCCESS)
 Main PID: 6161 (dovecot)
    Tasks: 4
   Memory: 2.6M
   CGroup: /system.slice/dovecot.service
           ├─6161 /usr/sbin/dovecot -F
           ├─6165 dovecot/anvil
           ├─6166 dovecot/log
           └─6167 dovecot/config

1123 01:26:41 mail.test.com systemd[1]: Starting Dovecot IMAP/POP3 email server...
1123 01:26:41 mail.test.com systemd[1]: Started Dovecot IMAP/POP3 email server.
1123 01:26:41 mail.test.com dovecot[6161]: master: Dovecot v2.3.10.1 (a3d0e1171) starting up for imap, pop3, lmtp


[root@mail ~]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      6161/dovecot
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      6161/dovecot
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      976/rpcbind
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1726/sshd: /usr/sbi
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      6142/master
tcp6       0      0 :::111                  :::*                    LISTEN      976/rpcbind
tcp6       0      0 :::22                   :::*                    LISTEN      1726/sshd: /usr/sbi


[root@mail ~]# systemctl stop firewalld
[root@mail ~]# setenforce 0
setenforce: SELinux is disabled


UOS系统foxmail测试

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

啊酒弟弟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值