【Docker实战】解锁企业级邮件服务,在华为云Flexus x实例上部署Mailcow开源方案

举报
wzsのcloud 发表于 2024/10/29 23:05:24 2024/10/29
【摘要】 华为云Flexus X实例携手Mailcow开源邮件方案,为企业打造了一个既高效又安全的邮件服务解决方案。

前言

华为云Flexus X实例携手Mailcow开源邮件方案,为企业打造了一个既高效又安全的邮件服务解决方案。Flexus X实例的柔性算力与高性能,是这一方案的坚实基石。它提供CPU内存的灵活定义,以经济型价格实现旗舰级性能,确保邮件服务的流畅运行,即使在高峰时段也能轻松应对。并在828上云节期间享受专属优惠,加速企业邮件服务的升级与蜕变。

链接直达:华为云Flexus云服务器X实例

image.png

mailcow介绍

Mailcow是一个功能强大的开源邮件服务器解决方案,它集成了多种流行的邮件服务软件,旨在为用户提供一个高效、安全且易于管理的电子邮件服务环境。基于Docker的全功能邮件管理系统,它将Docker的容器化技术与邮件管理的需求完美结合,提供了无缝且强大的电子邮件管理体验。无论是个人用户还是企业管理员,Mailcow都能满足其邮件服务器的需求,提供可靠和安全的电子邮件服务。

开源项目地址:https://github.com/mailcow

官方文档:https://docs.mailcow.email/

image.png

部署流程

下载mailcow安装程序

在华为云实例上安装git

[root@flexusx-251f ~]# yum install -y git

设置用户名

  • admin01为自己的用户名,可以随便填,注意提交记录的时候会显示这个用户名
[root@flexusx-251f ~]# git config --global user.name 'admin01'

设置邮箱

  • 这个邮箱也是可以随便填,一般填员公在公司的邮箱
[root@flexusx-251f ~]# git config --global user.email 'admin01@qq.com'

拉取安装程序

[root@flexusx-251f ~]# git clone https://github.com/mailcow/mailcow-dockerized
Cloning into 'mailcow-dockerized'...
remote: Enumerating objects: 54839, done.
remote: Counting objects: 100% (1396/1396), done.
remote: Compressing objects: 100% (752/752), done.
remote: Total 54839 (delta 821), reused 1090 (delta 636), pack-reused 53443 (from 1)
Receiving objects: 100% (54839/54839), 46.80 MiB | 1.62 MiB/s, done.
Resolving deltas: 100% (36419/36419), done.
[root@flexusx-251f ~]# ls
mailcow-dockerized  

[root@flexusx-251f mailcow-dockerized]# ls
CODE_OF_CONDUCT.md      data                helper-scripts  SECURITY.md
CONTRIBUTING.md         docker-compose.yml  LICENSE         update.sh
create_cold_standby.sh  generate_config.sh  README.md
[root@flexusx-251f mailcow-dockerized]#

安装mailcow

生成配置文件

  • 域名可根据自身需求进行设定
  • 时区默认,回车
  • 分支选择1

脚本最终生成mailcow.conf、docker-compose.yml以及各模块的相关配置,一定要保存好

[root@flexusx-251f mailcow-dockerized]# ./generate_config.sh
Found Docker Compose Plugin (native).
Setting the DOCKER_COMPOSE_VERSION Variable to native
Notice: You'll have to update this Compose Version via your Package Manager manually!
Press enter to confirm the detected value '[value]' where applicable or enter a custom value.
Mail server hostname (FQDN) - this is not your mail domain, but your mail servers hostname: cloudmail.mail.cn
Timezone [Asia/Shanghai]:
Which branch of mailcow do you want to use?

Available Branches:
- master branch (stable updates) | default, recommended [1]
- nightly branch (unstable updates, testing) | not-production ready [2]
Choose the Branch with it's number [1/2] 1
Fetching origin
Already on 'master'
Your branch is up to date with 'origin/master'.
Generating snake-oil certificate...
Generating a RSA private key
.............................................................................................................................................................................................++++
.++++
writing new private key to 'data/assets/ssl-example/key.pem'
-----
Copying snake-oil certificate...
Detecting if your IP is listed on Spamhaus Bad ASN List...
Check completed! Your IP is clean

切换至项目目录,执行命令拉取镜像

[root@flexusx-251f mailcow-dockerized]# docker-compose pull
[+] Pulling 163/54
 ✔ sogo-mailcow Pulled                                                                 617.2s
 ✔ postfix-mailcow Pulled                                                               52.5s
 ✔ watchdog-mailcow Pulled                                                              76.5s
 ✔ rspamd-mailcow Pulled                                                               101.0s
 ✔ ipv6nat-mailcow Pulled                                                               38.1s
 ✔ acme-mailcow Pulled                                                                 290.7s
 ✔ olefy-mailcow Pulled                                                                600.4s
 ✔ ofelia-mailcow Pulled                                                               427.8s
 ✔ clamd-mailcow Pulled                                                                580.5s
 ✔ solr-mailcow Pulled                                                                 529.0s
 ✔ php-fpm-mailcow Pulled                                                              200.6s
 ✔ redis-mailcow Pulled                                                                 15.3s
 ✔ unbound-mailcow Pulled                                                               28.8s
 ✔ nginx-mailcow Pulled                                                                 14.8s
 ✔ dockerapi-mailcow Pulled                                                            314.3s
 ✔ netfilter-mailcow Pulled                                                            631.0s
 ✔ mysql-mailcow Pulled                                                                105.9s
 ✔ dovecot-mailcow Pulled                                                              161.3s
 ✔ memcached-mailcow Pulled  

拉取成功,查看镜像

[root@flexusx-251f mailcow-dockerized]# docker images

通过docker-compose进行部署

[root@flexusx-251f mailcow-dockerized]# docker-compose up -d
[+] Running 20/20
 ✔ Container mailcowdockerized-sogo-mailcow-1                    Started                 0.6s
 ✔ Container 611ef61b2d0f_mailcowdockerized-dockerapi-mailcow-1  Removed                 0.0s
 ✔ Container mailcowdockerized-netfilter-mailcow-1               Started                 0.4s
 ✔ Container mailcowdockerized-dockerapi-mailcow-1               Started                 0.5s
 ✔ Container mailcowdockerized-unbound-mailcow-1                 Healthy                30.7s
 ✔ Container mailcowdockerized-clamd-mailcow-1                   Started                31.3s
 ✔ Container mailcowdockerized-redis-mailcow-1                   Started                 0.7s
 ✔ Container mailcowdockerized-solr-mailcow-1                    Started                 0.6s
 ✔ Container mailcowdockerized-mysql-mailcow-1                   Started                 0.8s
 ✔ Container mailcowdockerized-php-fpm-mailcow-1                 Started                 0.9s
 ✔ Container mailcowdockerized-dovecot-mailcow-1                 Started                 1.1s
 ✔ Container mailcowdockerized-postfix-mailcow-1                 Started                31.0s
 ✔ Container mailcowdockerized-nginx-mailcow-1                   Started                 1.1s
 ✔ Container mailcowdockerized-ofelia-mailcow-1                  Started                 1.3s
 ✔ Container mailcowdockerized-rspamd-mailcow-1                  Started                 1.3s
 ✔ Container mailcowdockerized-acme-mailcow-1                    Started                30.8s
 ✔ Container mailcowdockerized-watchdog-mailcow-1                Started                31.1s
 ✔ Container mailcowdockerized-ipv6nat-mailcow-1                 Started                31.2s
 ✔ Container mailcowdockerized-olefy-mailcow-1                   Started                 0.4s
 ✔ Container mailcowdockerized-memcached-mailcow-1               Started                 0.5s

如果出现下面报错问题(网络冲突),解决办法

  • yaml文件中的地址进行修改
[root@flexusx-251f mailcow-dockerized]# docker-compose up -d
[+] Running 1/0
 ✘ Network mailcowdockerized_mailcow-network  Error                                      0.0s
failed to create network mailcowdockerized_mailcow-network: Error response from daemon: invalid pool request: Pool overlaps with other one on this address space



# 修改文件最后位置network信息
networks:
  mailcow-network:
    driver: bridge
    driver_opts:
      com.docker.network.bridge.name: br-mailcow
    enable_ipv6: true
    ipam:
      driver: default
      config:
        - subnet: 10.10.10.0/24  # 这是一个有效的 IPv4 子网
          gateway: 10.10.10.1    # 通常还需要指定网关
        - subnet: fd4d:6169:6c63:6f77::/64  # 您的 IPv6 子网看起来是有效的
# 之后将文件中所有的${IPV4_NETWORK:-172.22.1}进行替换10.10.10

查看正在运行的容器

[root@flexusx-251f mailcow-dockerized]# docker ps

登录测试

在浏览器地址栏输入:http://主机IP:80

  • yaml文件中默认指定80端口,如果和自己本地有冲突,在创建容器之前进行修改
  • 如果想通过域名访问,需要做dns解析(不做演示)

image.png

测试成功,输入用户名和密码

  • 默认的管理员账号和密码登录(账号:admin,密码:moohoo)
  • 登录之后需要立即修改密码

image.png

登录成功

image.png

基本使用

创建域名

创建一个域名

image.png

输入基本信息,点击只创建域名

image.png

创建邮箱

创建一个邮箱

image.png

输入基本信息,点击创建

image.png

创建成功

image.png

登录邮箱

登录webmail,浏览器地址栏输入:http://主机IP/SOGo/

image.png

输入创建的邮箱和密码,进行登录

image.png

登录成功

image.png

部署完成,可以通过 mailcow UI界面进行域名和邮箱的创建,为企业进行成员分配,实现企业内部的邮件管理

体验和感受

企业对于高效、安全、灵活的邮件服务需求日益增长。华为云FlexusX服务器,以其卓越的算力、灵活的扩展性和稳定可靠的性能,成为众多企业部署邮件服务的首选平台。而今,结合Mailcow开源邮件方案,为企业打造了一个全新的企业级邮件服务解决方案。

该服务器不仅拥有强大的计算能力和高速的网络连接,更支持资源的按需扩展,确保邮件服务在高峰时段也能稳定运行。而Mailcow开源邮件方案,则以其简洁的界面、丰富的功能和强大的安全性,赢得了全球用户的广泛好评。

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。