主頁 > 作業系統 > iredmail郵件系統離線搭建手冊-從零到無

iredmail郵件系統離線搭建手冊-從零到無

2020-10-20 20:28:56 作業系統

--時間:2020年10月20日

--作者:飛翔的小胖豬

概述

前言

iRedMail 是一個基于 Linux/BSD 系統的零成本、功能完備、成熟的郵件服務器解決方案,iRedMail 是一個開源、免費的專案,以 GPL(v2)協議發布,

檔案初衷

在我實際生產環境中需要搭建一套郵件服務器,百度了一下聽說iredmail不錯,一步一步來唄,大致流程如下:

1.先在自己環境下做測驗,如果能成功再搞到生產環境中,

2.打開其官方網站根據自己實際的設備環境(作業系統)找到合適的安裝步驟,(盡量要英文手冊)

3.根據你所看到的步驟提示一步一步的走,然后就安裝好了,這有一個前提你的安裝環境必須與互聯網相通,

4.通過觀察iredmail的安裝實時提示資訊發現他會去互聯網中下載很多東西,可我的內網環境不能連通互聯網呀,看了一下官網上又沒有提供離線安裝包下載,好吧看來要消耗一波腦細胞了,

5.通過一整天的各種嘗試終于然我找到一套可行的離線安裝方式,

環境準備

系統及軟體:

資料準備:

安裝包下載:

該安裝包是由本人從iredmail官網上下載的檔案然后制作的離線安裝軟體包,現放在百度網盤中,該篇檔案也是使用該包來完成安裝的,

鏈接:https://pan.baidu.com/s/1yaOS8CciAjFjeN5IHIW3-w
提取碼:wowb

ps:可能只適用與centos 7.6+iredmail-1.3.1的環境,其他作業系統及軟體版本也沒測過,

包檔案說明:

 軟體包主要分為4塊,

.官網軟體包:iRedMail-1.3.1.tar.gz  + misc

.安裝所需的epel源中的rpm檔案:yum_down_soft.tar.gz

.cvd病毒庫:cvd

.python2及3的各種必要模塊:python

步驟

安裝配置作業系統

安裝作業系統

作業系統安裝這一步就不介紹了,請自行百度謝謝!!!切記我用的是Centos 7.6的系統,安裝軟體選擇最簡潔的最小化安裝即可,

 

配置系統

進入到作業系統過后需要關閉selinux及firewalld,同時要設定機器主機名、掛載本地repo鏡像,

(網路配置這些基礎配置自行百度)

.設定主機名

1.#使用名設定主機名為我們事先規劃好的名字
[root@test1 ~]# hostnamectl set-hostname test1.mail.com [root@test1 ~]# hostname
test1.mail.com


2.修改/etc/hosts檔案把主機名添加到文本中,需要添加到最前面
[root@test1 ~]# vim /etc/hosts

127.0.0.1   test1.mail.com localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

.關閉selinux

1.命令臨時設定selinux為只記錄
[root@test1 ~]# setenforce 0 [root@test1 ~]# getenforce Disabled

2.修改/etc/selinux/config檔案中的SELINUX=enforcing為SELINUX=disabled
[root@test1 ~]# vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

.關閉firewalld

#停止firewalld服務同時設定其開機不自動啟動,設定不能被其他應用呼叫,
[root@test1 ~]# systemctl stop firewalld [root@test1 ~]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. [root@test1 ~]# systemctl mask firewalld

.掛載本地光碟鏡像

#掛載本地光碟到/mnt目錄中
[root@test1 ~]# mount /dev/sr0 /mnt
mount: /dev/sr0 is write-protected, mounting read-only
#洗掉/etc/yum.repos.d/下系統自帶的repo檔案
[root@test1 ~]# cd /etc/yum.repos.d/
[root@test1 yum.repos.d]# rm -rf CentOS-*
#新建編輯一個名為local_yum.repo的yum源檔案
[root@test1 ~]# vim /etc/yum.repos.d/local_yum.repo
[yum_local]
name=yum_local
enabled=1
gpgcheck=0
baseurl=file:///mnt/
[root@test1 yum.repos.d]# yum clean all
[root@test1 yum.repos.d]# yum makecache
[root@test1 yum.repos.d]# yum repolist

準備安裝環境

解壓檔案

通過本人分享的百度鏈接下載得到安裝軟體包,然后解壓到根目錄下,

1.解壓總的安裝包
[root@test1 ~]# ll /iredmail.tar.gz -rw-r--r-- 1 root root 487738299 Oct 20 11:47 /iredmail.tar.gz [root@test1 ~]# [root@test1 ~]# [root@test1 ~]# tar -zxvf /iredmail.tar.gz -C / #解壓壓縮包到根目錄下
[root@test1 ~]# cd /soft
[root@test1 soft]# ll
total 194128
drwxr-xr-x 2 root root        59 Oct 20 11:42 cvd
-rw-r--r-- 1 root root    232203 Oct 16 08:47 iRedMail-1.3.1.tar.gz
drwxr-xr-x 2 root root       226 Oct 20 11:44 misc
drwxr-xr-x 4 root root        56 Oct 20 11:43 python
-rw-r--r-- 1 root root 198550344 Oct 19 16:50 yum_down_soft.tar.gz

2.解壓rpm軟體包,
[root@test1 soft]# tar -zxvf yum_down_soft.tar.gz

3.解壓iredmail檔案
[root@test1 soft]# tar -zxvf iRedMail-1.3.1.tar.gz
[root@test1 soft]# ll
total 194152
drwxr-xr-x  2 root root        59 Oct 20 11:42 cvd
drwxr-xr-x 10 root root       193 Sep 22 05:34 iRedMail-1.3.1
-rw-r--r--  1 root root    232203 Oct 16 08:47 iRedMail-1.3.1.tar.gz
drwxr-xr-x  2 root root       226 Oct 20 11:44 misc
drwxr-xr-x  4 root root        56 Oct 20 11:43 python
drwxr-xr-x  3 root root     20480 Oct 18 23:32 yum_down_soft
-rw-r--r--  1 root root 198550344 Oct 19 16:50 yum_down_soft.tar.gz

修改部分腳本

在iredmail安裝腳本中會自動生成一個sogo的repo檔案每次,在外網環境下他會通過自動生成的repo檔案去找到需要的包并進行下載,在內網中則會因為無法連接外網而安裝報錯,

我們需要修改其自動生成repo的陳述句改為我們本地的路徑,

在/soft/iRedMail-1.3.1/functions/packages.sh檔案中注釋掉baseurl=${SOGO_PKG_MIRROR}/SOGo/nightly/${SOGO_VERSION}/rhel/${DISTRO_VERSION}/\$basearch行(大概在檔案的408行左右),然后添加一行新資料指定生成的repo路徑為本地路徑,
[root@test1 soft]# vim /soft/iRedMail-1.3.1/functions/packages.sh
cat > ${YUM_REPOS_DIR}/sogo.repo <<EOF
[SOGo]
name=Inverse SOGo Repository
enabled=1
gpgcheck=0

# SOGo v3 stable release.
# WARNING: A proper support contract from Inverse is required:
# https://sogo.nu/support/index.html#support-plans
#baseurl=${SOGO_PKG_MIRROR}/SOGo/release/${SOGO_VERSION}/rhel/${DISTRO_VERSION}/\$basearch

# SOGo v3 nightly builds
#baseurl=${SOGO_PKG_MIRROR}/SOGo/nightly/${SOGO_VERSION}/rhel/${DISTRO_VERSION}/\$basearch #被注釋掉的行
baseurl=file:///soft/yum_down_soft #新添加的行,根據前文所知我的rpm包放在/soft/yum_down_soft目錄下
EOF

拷貝軟體到指定位置

拷貝安裝程序中的軟體到指定的位置,如果沒有相關檔案夾請自行創建,
拷貝/soft/misc目錄到/soft/iRedMail-1.3.1/pkgs/
[root@test1 soft]# cp  -rp  /soft/misc /soft/iRedMail-1.3.1/pkgs/
[root@test1 soft]# ll /soft/iRedMail-1.3.1/pkgs/misc/ #確認復制成功
total 42972
-rw-r--r-- 1 root root   395656 Oct 20 11:44 iRedAdmin-1.0.tar.bz2
-rw-r--r-- 1 root root   102870 Oct 20 11:44 iRedAPD-4.3.tar.gz
-rw-r--r-- 1 root root  1849829 Oct 20 11:44 libsodium-1.0.18-stable.tar.gz
-rw-r--r-- 1 root root    40622 Oct 20 11:44 mlmmjadmin-3.0.tar.gz
-rwxr-xr-x 1 root root 34464172 Oct 20 11:44 netdata-v1.23.1.gz.run
-rw-r--r-- 1 root root  7031947 Oct 20 11:44 roundcubemail-1.4.7-complete.tar.gz
-rw-r--r-- 1 root root   105522 Oct 20 11:44 webpy-0.51.tar.gz

 

正式安裝iredmail

一切準備就緒那就可以安裝了,安裝的步驟和官網的一模一樣但有幾部又有不同,建議打開兩個終端,一個用來安裝iredmail一個cd到/etc/yum.repos.d目錄下準備修改repo檔案,

[root@test1 ~]# cd /soft/iRedMail-1.3.1/
[root@test1 iRedMail-1.3.1]# bash iRedMail.sh
然后就是大帕拉的各種提示,此時應該會報錯如下:
   5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=iRedMail.skip_if_unavailable=true

failure: repodata/repomd.xml from iRedMail: [Errno 256] No more mirrors to try.
https://dl.iredmail.org/yum/rpms/7/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: dl.iredmail.org; Unknown error"
[ INFO ] Checking configuration file: /soft/iRedMail-1.3.1/config ...[ INFO ] NOT FOUND. Launching installation wizard.
/soft/iRedMail-1.3.1/dialog/config_via_dialog.sh: line 44: dialog: command not found

修改/etc/yum.repos.d/iRedMail.repo為如下內容后再執行安裝,
[root@test1 ~]# vim /etc/yum.repos.d/iRedMail.repo
[iRedMail]
name=iRedMail
#baseurl=https://dl.iredmail.org/yum/rpms/$releasever/
baseurl=file:///soft/yum_down_soft
enabled=1
gpgcheck=0
#exclude=postfix*
priority=99
module_hotfixes=1
[root@test1 ~]# cd /soft/iRedMail-1.3.1/
[root@test1 iRedMail-1.3.1]# bash iRedMail.sh

直接滑鼠點擊<Yes>進入下一步,

 定義你的郵件存盤路徑,自定義的,如果存盤比較有空那么可以掛一張新盤來作為郵件存盤,

選擇安裝郵件服務器運行web服務,

 郵件中的用戶管理使用mysql資料庫,

 設定mysql的密碼,自定義的,

 創建一個域名,

 設定郵件管理員的密碼,

 不管全選,具體選項功能看其后的英文注釋很清楚,

 再次確認你的設定,確認無誤后輸入Y敲回車繼續安裝,

 

輸入了Y后,敲回車,系統會進行軟體包的安裝,

當安裝停在/etc/firewalld/zones/iredmail.xm,with SSHD ports:22. [Y|n] 行時先不要動,新開一個終端進行如下操作,

此處的命令請新開一個終端執行,
[root@test1 ~]# pip install --no-index --find-links  /soft/python/2  -r /soft/python/pip2.txt     #安裝python2的模塊
[root@test1 ~]# pip3 install --no-index --find-links  /soft/python/3  -r /soft/python/pip3.txt    #安裝python3的模塊


復制包內的cvd病毒庫檔案置/var/lib/clamav/下并修改所有者,
[root@test1 lib]# cp /soft/cvd/* /var/lib/clamav/ [root@test1 lib]# chown clamupdate:clamupdate /var/lib/clamav/* [root@test1 lib]# ll /var/lib/clamav/

以上的記憶體執行好了再回到之前的終端“Y”,

 

最后你可以類似如下的資訊,請從********************************************************************* URLs of installed web applications:處開始復制下來,或拍照,不然以后忘了,

然后根據提示重啟服務器完成安裝,

.................................
Reading CVD header (daily.cvd): Giving up on https://database.clamav.net... ******************************************************************** * URLs of installed web applications: * * - Roundcube webmail: https://test1.mail.com/mail/ * - SOGo groupware: https://test1.mail.com/SOGo/ * - netdata (monitor): https://test1.mail.com/netdata/ * * - Web admin panel (iRedAdmin): https://test1.mail.com/iredadmin/ * * You can login to above links with below credential: * * - Username: [email protected] * - Password: 123456 * * ******************************************************************** * Congratulations, mail server setup completed successfully. Please * read below file for more information: * * - /soft/iRedMail-1.3.1/iRedMail.tips * * And it's sent to your mail account [email protected]. * ********************* WARNING ************************************** * * Please reboot your system to enable all mail services. * ********************************************************************

 

測驗

* - Roundcube webmail: https://test1.mail.com/mail/               #郵件收發web界面,所有人可登錄
* - SOGo groupware: https://test1.mail.com/SOGo/                #郵件收發web界面,所有人可登錄
* - netdata (monitor): https://test1.mail.com/netdata/              #很酷炫的一個資源監控界面,使用域管理員登錄,
* - Web admin panel (iRedAdmin): https://test1.mail.com/iredadmin/     #郵件管理web界面,使用域管理員登錄,用作管理郵件系統,創建域、用戶什么的,,,,

請逐一建議檢查以上這4個界面是否可用,有問題可以私信我,

 

總結

在內網環境無法連接互聯網時,想要在內網中部署一套需要需要各種外部包和資料的軟體及應用不是一件特別輕松的事,

針對這種情況一般有兩種方法,

  .找到軟體的所有依賴包和所需的資料下載打包起來在安裝的程序中手動把需要的資料庫拷貝到指定的位置,

  .搭建套Docker環境,在互聯網的環境中使用容器事先軟體安裝部署,然后打包容器為image,在內網環境中安裝docker環境,然后load一下之前打包好的鏡像,最后docker run一下就搞定了,

容器真香哈哈,

翻譯過來的中文操作檔案全是坑,

 

轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/182707.html

標籤:其他

上一篇:Vue環境安裝

下一篇:Vue環境安裝

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • CA和證書

    1、在 CentOS7 中使用 gpg 創建 RSA 非對稱密鑰對 gpg --gen-key #Centos上生成公鑰/密鑰對(存放在家目錄.gnupg/) 2、將 CentOS7 匯出的公鑰,拷貝到 CentOS8 中,在 CentOS8 中使用 CentOS7 的公鑰加密一個檔案 gpg -a ......

    uj5u.com 2020-09-10 00:09:53 more
  • Kubernetes K8S之資源控制器Job和CronJob詳解

    Kubernetes的資源控制器Job和CronJob詳解與示例 ......

    uj5u.com 2020-09-10 00:10:45 more
  • VMware下安裝CentOS

    VMware下安裝CentOS 一、軟硬體準備 1 Centos鏡像準備 1.1 CentOS鏡像下載地址 下載地址 1.2 CentOS鏡像下載程序 點擊下載地址進入如下圖的網站,選擇需要下載的版本,這里選擇的是Centos8,點擊如圖所示。 決定選擇Centos8后,選擇想要的鏡像源進行下載,此 ......

    uj5u.com 2020-09-10 00:12:10 more
  • 如何使用Grep命令查找多個字串

    如何使用Grep 命令查找多個字串 大家好,我是良許! 今天向大家介紹一個非常有用的技巧,那就是使用 grep 命令查找多個字串。 簡單介紹一下,grep 命令可以理解為是一個功能強大的命令列工具,可以用它在一個或多個輸入檔案中搜索與正則運算式相匹配的文本,然后再將每個匹配的文本用標準輸出的格式 ......

    uj5u.com 2020-09-10 00:12:28 more
  • git配置http代理

    git配置http代理 經常遇到克隆 github 慢的問題,這里記錄一下幾種配置 git 代理的方法,解決 clone github 過慢。 目錄 git配置代理 git單獨配置github代理 git配置全域代理 配置終端環境變數 git配置代理 主要使用 git config 命令 git單獨 ......

    uj5u.com 2020-09-10 00:12:33 more
  • Linux npm install 裝包時提示Error EACCES permission denied解

    npm install 裝包時提示Error EACCES permission denied解決辦法 ......

    uj5u.com 2020-09-10 00:12:53 more
  • Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包

    Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包。 18 (flaskApi) [root@67 flaskDemo]# yum -y install nginx 19 已加載插件:fastestmirror, langpacks 20 Loading ......

    uj5u.com 2020-09-10 00:13:13 more
  • Linux查看服務器暴力破解ssh IP

    在公網的服務器上經常遇到別人爆破你服務器的22埠,用來挖礦或者干其他嘿嘿嘿的事情~ 這種情況下正確的做法是: 修改默認ssh的22埠 使用設定密鑰登錄或者白名單ip登錄 建議服務器密碼為復雜密碼 創建普通用戶登錄服務器(root權限過大) 建立堡壘機,實作統一管理服務器 統計爆破IP [root ......

    uj5u.com 2020-09-10 00:13:17 more
  • CentOS 7系統常見快捷鍵操作方式

    Linux系統中一些常見的快捷方式,可有效提高操作效率,在某些時刻也能避免操作失誤帶來的問題。 ......

    uj5u.com 2020-09-10 00:13:31 more
  • CentOS 7作業系統目錄結構介紹

    作業系統存在著大量的資料檔案資訊,相應檔案資訊會存在于系統相應目錄中,為了更好的管理資料資訊,會將系統進行一些目錄規劃,不同目錄存放不同的資源。 ......

    uj5u.com 2020-09-10 00:13:35 more
最新发布
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:43:21 more
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:42:36 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:26:53 more
  • 設定Windows主機的瀏覽器為wls2的默認瀏覽器

    這里以Chrome為例。 1. 準備作業 wsl是可以使用Windows主機上安裝的exe程式,出于安全考慮,默認情況下改功能是無法使用。要使用的話,終端需要以管理員權限啟動。 我這里以Windows Terminal為例,介紹如何默認使用管理員權限打開終端,具體操作如下圖所示: 2. 操作 wsl ......

    uj5u.com 2023-04-19 09:25:49 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:19:04 more
  • Linux學習筆記

    IP地址和主機名 IP地址 ifconfig可以用來查詢本機的IP地址,如果不能使用,可以通過install net-tools安裝。 Centos系統下ens33表示主網卡;inet后表示IP地址;lo表示本地回環網卡; 127.0.0.1表示代指本機;0.0.0.0可以用于代指本機,同時在放行設 ......

    uj5u.com 2023-04-18 06:52:01 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:50 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:01 more
  • 你是不是暴露了?

    作者:袁首京 原創文章,轉載時請保留此宣告,并給出原文連接。 如果您是計算機相關從業人員,那么應該經歷不止一次網路安全專項檢查了,你肯定是收到過資訊系統技術檢測報告,要求你加強風險監測,確保你提供的系統服務堅實可靠了。 沒檢測到問題還好,檢測到問題的話,有些處理起來還是挺麻煩的,尤其是線上正在運行的 ......

    uj5u.com 2023-04-05 16:52:56 more
  • 細節拉滿,80 張圖帶你一步一步推演 slab 記憶體池的設計與實作

    1. 前文回顧 在之前的幾篇記憶體管理系列文章中,筆者帶大家從宏觀角度完整地梳理了一遍 Linux 記憶體分配的整個鏈路,本文的主題依然是記憶體分配,這一次我們會從微觀的角度來探秘一下 Linux 內核中用于零散小記憶體塊分配的記憶體池 —— slab 分配器。 在本小節中,筆者還是按照以往的風格先帶大家簡單 ......

    uj5u.com 2023-04-05 16:44:11 more