超简单的内网邮件服务器搭建(CentOS7 postfix+dovecot)

为什么说是超简单呢,因为在这之前肯定查看教程看大佬们是怎样搭建的,于是我开始各种查阅,大佬们一般上来先讲原理,解释各种名词(我至今还没记清),然后准备前菜域名解析,我弄了好几天的域名解析但最终还是以失败告终。但最后我竟发现不用域名解析我的内网邮件服务器奇迹般的搭成了。
废话不到说直接进入正题
先说一下我试验机器准备:VMware里一台CentOS 7(邮件服务器) ip192.168.80.128,同网段的一台Windows7(客户端测试)
1、配置服务器主机名称,服务器主机名称与发信域名要一致
[root@lie ~]# vim /etc/hostname
mail.lie.com
[root@lie ~]# hostname
mail.lie.com
2、配置Postfix服务程序(CentOS 7自带Postfix 之前版本不清楚,如果需要yum安装一下)直接修改配置文件(6处修改位置)
[root@lie ~]# vim /etc/postfix/main.cf
#设置主机名 在76行左右
myhostname = mail.lie.com
#设置域名 在86行左右
mydomain = lie.com
#定义发出邮件的域 在99行左右
myorigin = $mydomain
#定义网卡监听地址(all代表所有) 在116行左右
inet_interfaces = all
#定义可接收邮件的主机名或域名列表 在164行左右
mydestination = $myhostname , $mydomain
#信任的客户端 在268行左右
mynetworks = 192.168.80.0/24, 127.0.0.0/8
至此postfix设置完成重启服务并配置开机自启
[root@lie~]# systemctl restart postfix
[root@lie~]# systemctl enable postfix
3、配置Dovecot服务程序
#安装dovecot (默认安装就可以)
[root@lie~]# yum install dovecot
#安装完成修改配置文件
[root@lie~]# vim /etc/dovecot/dovecot.conf
#去到24行左右注释
protocols = imap pop3 lmtp
#设置允许登录的网段地址 在50行左右
login_trusted_networks = 192.168.80.0/24
#配置邮件格式与存储路径(去掉24行注释)
[root@lie~]# vim /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u
#重启dovecot服务并开机启动
[root@lie~]# systemctl restart dovecot
[root@lie~]# systemctl enable dovecot
4、创建电子邮件系统的登录账户(本地系统的账户和密码,因此在本地系统创建常规账户即可)
[root@lie~]# useradd test
[root@lie~]# passwdtest
#创建立用于保存邮件的目录(开始没创建此目录windows客户端配置账户死活是配置不上)
[root@lie~]#mkdir -p mail/.imap/INBOX
至此搭建完成!!!
Windows 7客户端安装Foxmail配置test邮箱账户正常收发邮件!过于简单此处只贴个图
在这里插入图片描述

  • 9
    点赞
  • 72
    收藏
    觉得还不错? 一键收藏
  • 15
    评论
CentOS+Postfix+Dovecot+Postfixadmin+Roundcube邮件服务器的搭建步骤如下: 1. 安装 CentOS 操作系统,并更新至最新版。 2. 安装 Postfix 邮件服务器,并进行基本配置。 3. 安装 Dovecot IMAP/POP3 服务器,并进行基本配置。 4. 安装 Postfixadmin 邮箱管理系统,并进行基本配置。 5. 安装 Roundcube Webmail 邮件客户端,并进行基本配置。 具体步骤如下: 1. 安装 CentOS 操作系统,并更新至最新版。 在安装 CentOS 操作系统时,选择最小化安装,并根据实际情况进行分区和网络配置。安装完成后,使用以下命令更新系统: ``` yum update ``` 2. 安装 Postfix 邮件服务器,并进行基本配置。 使用以下命令安装 Postfix: ``` yum install postfix ``` 安装完成后,修改 /etc/postfix/main.cf 文件,使其支持 TLS 和 SASL 认证: ``` smtpd_tls_cert_file = /etc/pki/tls/certs/server.crt smtpd_tls_key_file = /etc/pki/tls/private/server.key smtpd_tls_security_level = may smtp_tls_security_level = may smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination ``` 然后重启 Postfix 服务: ``` systemctl restart postfix ``` 3. 安装 Dovecot IMAP/POP3 服务器,并进行基本配置。 使用以下命令安装 Dovecot: ``` yum install dovecot ``` 安装完成后,修改 /etc/dovecot/dovecot.conf 文件,使其支持 TLS 和 SASL 认证: ``` ssl_cert = </etc/pki/tls/certs/server.crt ssl_key = </etc/pki/tls/private/server.key auth_mechanisms = plain login ``` 然后重启 Dovecot 服务: ``` systemctl restart dovecot ``` 4. 安装 Postfixadmin 邮箱管理系统,并进行基本配置。 使用以下命令安装 Postfixadmin: ``` yum install postfixadmin ``` 安装完成后,修改 /etc/httpd/conf.d/postfixadmin.conf 文件,使其支持 SSL: ``` SSLEngine on SSLCertificateFile /etc/pki/tls/certs/server.crt SSLCertificateKeyFile /etc/pki/tls/private/server.key ``` 然后重启 Apache 服务: ``` systemctl restart httpd ``` 访问 https://your-domain.com/postfixadmin,使用管理员账号登录,创建邮箱账号和域名等相关配置。 5. 安装 Roundcube Webmail 邮件客户端,并进行基本配置。 使用以下命令安装 Roundcube: ``` yum install roundcubemail ``` 安装完成后,修改 /etc/httpd/conf.d/roundcubemail.conf 文件,使其支持 SSL: ``` SSLEngine on SSLCertificateFile /etc/pki/tls/certs/server.crt SSLCertificateKeyFile /etc/pki/tls/private/server.key ``` 然后重启 Apache 服务: ``` systemctl restart httpd ``` 访问 https://your-domain.com/roundcubemail,使用邮箱账号登录,即可使用 Roundcube 邮件客户端。 以上就是 CentOS+Postfix+Dovecot+Postfixadmin+Roundcube邮件服务器的搭建步骤,如有问题可以参考相关文档或者咨询技术人员。
评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值