zimbra+mailman郵件系統部署

zimbra+mailman郵件系統部署大致分爲六大部分:

第一部分:安裝DNS服務器  第二部分:安裝zimbra   第三部分:安裝httpd等依賴包   第四部分:安裝mailman  第五部分:爲了和zimbra組合,修改httpd服務的相關設定  第六部分:創建mailman的默認站點列表

特別說明:爲了實現mailman的web管理方式,本文采用單獨的httpd服務,而不使用zimbra內置的web服務。

在安裝過程中也是遇到了各種各樣的問題,走了很多彎路,最後纔有了此文,下面開始安裝部署吧。


系統環境:

系統版本:
[root@xy ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
內核:
[root@xy ~]# uname -r
3.10.0-862.el7.x86_64
系統位數:
[root@xy ~]# uname -m
x86_64

安裝前準備:

1.關閉selinux和防火牆

關閉selinux:
[root@Zimbra ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux
[root@xiaoyu ~]# setenforce 0

關閉防火牆:
[root@xiaoyu ~]# firewall-cmd --state  #-->查看防火牆的狀態:
not running
[root@xiaoyu ~]# systemctl stop firewalld   #-->停止防火牆服務
[root@xiaoyu ~]# systemctl disable firewalld   #-->關閉防火牆服務開機自啓動

2.配置主機名

[root@localhost ~]# hostnamectl --static set-hostname xiaoyu
[root@xiaoyu ~]# hostname
xiaoyu

3.更新系統:

[root@xiaoyu ~]# yum -y update

4.關閉安裝的MTA服務:

[root@xiaoyu ~]#systemctl stop postfix
[root@xiaoyu ~]#systemctl disable postfix
[root@xiaoyu ~]#ystemctl stop sendmail
[root@xiaoyu ~]#systemctl disable sendmail


第一部分:安裝DNS服務器

1.安裝dns服務所需的軟件包:

[root@xiaoyu ~]# yum -y install bind bind-utils bind-chroot
[root@xiaoyu ~]# cp /etc/named.conf /etc/named.conf.bak    #-->修改前對配置文件進行備份

2.修改主配置文件:

[root@xiaoyu ~]# cp /etc/named.conf /etc/named.conf.bak
[root@xiaoyu ~]# vim /etc/named.conf
options {
        listen-on port 53 { any; };   #==>更改爲any
        allow-query     { any; };    #==>更改爲any
};

同時增加如下配置:
zone "husyt.com" IN {
        type master;
        file "husyt.com.zone";
        allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.1.arpa";
        allow-update { none; };
};

3.配置區域配置文件:

[root@xiaoyu ~]# vim /var/named/husyt.com.zone
$TTL 1D
@       IN SOA  @ rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      ns.husyt.com.
        MX 10     mail.husyt.com.
ns        A       192.168.1.10
mail        A       192.168.1.10

[root@xiaoyu ~]# vim /var/named/192.168.1.arpa

$TTL 1D
@       IN SOA  @ rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS         ns.husyt.com.
10       PTR       ns.husyt.com.
10       PTR       mail.husyt.com.

4.啓動dns服務:

[root@xiaoyu ~]# systemctl start named.service

5.使用本地的dns:

[root@xiaoyu ~]# echo "nameserver 127.0.0.1" >> /etc/resolv.conf   #-->如有設置其他的dns,請先註釋


第二部分:安裝zimbra

1.安裝zimbra需要FQDN,所以我現在使用的是mail.husyt.com,主機名爲:xiaoyu。

[root@xiaoyu ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1       localhost localhost.localdomain localhost6 localhost6.localdomain6
zimbra_ip   mail.husyt.com  xiaoyu    #-->此處zimbra_ip安裝具體情況進行填寫

2.安裝zimbra所需的依賴包

[root@xiaoyu ~]# yum -y install wget perl-devel perl perl-core ntpl nmap sudo libidn gmp libaio libstdc++ unzip sysstat sqlite nc

3.下載zimbra安裝包,解壓並安裝

創建存放軟件的目錄:

[root@xiaoyu ~]# mkdir /application
[root@xiaoyu ~]# cd /application/
[root@xiaoyu application]#  wget https://files.zimbra.com/downloads/8.6.0_GA/zcs-8.6.0_GA_1153.RHEL7_64.20141215151110.tgz  
[root@xiaoyu application]# ll
total 760748
-rw-r--r--. 1 root root 779005849 Dec 16  2014 zcs-8.6.0_GA_1153.RHEL7_64.20141215151110.tgz
[root@xiaoyu application]# tar xf zcs-8.6.0_GA_1153.RHEL7_64.20141215151110.tgz 
[root@xiaoyu application]# mv zcs-8.6.0_GA_1153.RHEL7_64.20141215151110 zimbra
[root@xiaoyu application]# cd zimbra/
[root@xiaoyu zimbra]# ./install.sh --platform-override

Operations logged to /tmp/install.log.22794
Checking for existing installation...
    zimbra-ldap...NOT FOUND
    zimbra-logger...NOT FOUND
    zimbra-mta...NOT FOUND
    zimbra-dnscache...NOT FOUND
    zimbra-snmp...NOT FOUND
    zimbra-store...NOT FOUND
    zimbra-apache...NOT FOUND
    zimbra-spell...NOT FOUND
    zimbra-convertd...NOT FOUND
    zimbra-memcached...NOT FOUND
    zimbra-proxy...NOT FOUND
    zimbra-archiving...NOT FOUND
    zimbra-core...NOT FOUND


PLEASE READ THIS AGREEMENT CAREFULLY BEFORE USING THE SOFTWARE.
ZIMBRA, INC. ("ZIMBRA") WILL ONLY LICENSE THIS SOFTWARE TO YOU IF YOU
FIRST ACCEPT THE TERMS OF THIS AGREEMENT. BY DOWNLOADING OR INSTALLING
THE SOFTWARE, OR USING THE PRODUCT, YOU ARE CONSENTING TO BE BOUND BY
THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS
AGREEMENT, THEN DO NOT DOWNLOAD, INSTALL OR USE THE PRODUCT.

License Terms for the Zimbra Collaboration Suite:
  http://www.zimbra.com/license/zimbra-public-eula-2-5.html



Do you agree with the terms of the software license agreement? [N] y



Checking for prerequisites...
     FOUND: NPTL
     FOUND: nmap-ncat-6.40-13
     FOUND: sudo-1.8.19p2-14
     FOUND: libidn-1.28-4
     FOUND: gmp-6.0.0-15
     FOUND: libaio-0.3.109-13
     FOUND: libstdc++-4.8.5-28
     FOUND: unzip-6.0-19
     FOUND: perl-core-5.16.3-292

Checking for suggested prerequisites...
     FOUND: perl-5.16.3
     FOUND: sysstat
     FOUND: sqlite
Prerequisite check complete.

Checking for installable packages

Found zimbra-core
Found zimbra-ldap
Found zimbra-logger
Found zimbra-mta
Found zimbra-dnscache
Found zimbra-snmp
Found zimbra-store
Found zimbra-apache
Found zimbra-spell
Found zimbra-memcached
Found zimbra-proxy


Select the packages to install

Install zimbra-ldap [Y] 

Install zimbra-logger [Y] 

Install zimbra-mta [Y] 

Install zimbra-dnscache [Y] n

Install zimbra-snmp [Y] 

Install zimbra-store [Y] 

Install zimbra-apache [Y] 

Install zimbra-spell [Y] 

Install zimbra-memcached [Y] 

Install zimbra-proxy [Y] 
Checking required space for zimbra-core
Checking space for zimbra-store
Checking required packages for zimbra-store
zimbra-store package check complete.

Installing:
    zimbra-core
    zimbra-ldap
    zimbra-logger
    zimbra-mta
    zimbra-snmp
    zimbra-store
    zimbra-apache
    zimbra-spell
    zimbra-memcached
    zimbra-proxy

The system will be modified.  Continue? [N] y

Removing /opt/zimbra
Removing zimbra crontab entry...done.
Cleaning up zimbra init scripts...done.
Cleaning up /etc/ld.so.conf...done.
Cleaning up /etc/security/limits.conf...done.

Finished removing Zimbra Collaboration Server.

Installing packages

    zimbra-core......zimbra-core-8.6.0_GA_1153.RHEL7_64-20141215151110.x86_64.rpm...done
    zimbra-ldap......zimbra-ldap-8.6.0_GA_1153.RHEL7_64-20141215151110.x86_64.rpm...done
    zimbra-logger......zimbra-logger-8.6.0_GA_1153.RHEL7_64-20141215151110.x86_64.rpm...done
    zimbra-mta......zimbra-mta-8.6.0_GA_1153.RHEL7_64-20141215151110.x86_64.rpm...done
    zimbra-snmp......zimbra-snmp-8.6.0_GA_1153.RHEL7_64-20141215151110.x86_64.rpm...done
    zimbra-store......zimbra-store-8.6.0_GA_1153.RHEL7_64-20141215151110.x86_64.rpm...done
    zimbra-apache......zimbra-apache-8.6.0_GA_1153.RHEL7_64-20141215151110.x86_64.rpm...done
    zimbra-spell......zimbra-spell-8.6.0_GA_1153.RHEL7_64-20141215151110.x86_64.rpm...done
    zimbra-memcached......zimbra-memcached-8.6.0_GA_1153.RHEL7_64-20141215151110.x86_64.rpm...done
    zimbra-proxy......zimbra-proxy-8.6.0_GA_1153.RHEL7_64-20141215151110.x86_64.rpm...done
Operations logged to /tmp/zmsetup09142018-155427.log
Installing LDAP configuration database...done.
Setting defaults...sh: /sbin/ifconfig: No such file or directory


DNS ERROR resolving MX for mail.husyt.com
It is suggested that the domain name have an MX record configured in DNS
Change domain name? [Yes] 
Create domain: [mail.husyt.com] husyt.com
MX: mail.husyt.com (192.168.1.10)

Interface: 127.0.0.1
Interface: ::1
Interface: 192.168.1.10
done.
Checking for port conflicts
sh: netstat: command not found

Main menu

   1) Common Configuration:                                                  
   2) zimbra-ldap:                             Enabled                       
   3) zimbra-logger:                           Enabled                       
   4) zimbra-mta:                              Enabled                       
   5) zimbra-snmp:                             Enabled                       
   6) zimbra-store:                            Enabled                       
        +Create Admin User:                    yes                           
        +Admin user to create:                 [email protected]               
******* +Admin Password                        UNSET                         
        +Anti-virus quarantine user:           [email protected]
        +Enable automated spam training:       yes                           
        +Spam training user:                   [email protected]       
        +Non-spam(Ham) training user:          [email protected]       
        +SMTP host:                            mail.husyt.com                
        +Web server HTTP port:                 8080                          
        +Web server HTTPS port:                8443                          
        +Web server mode:                      https                         
        +IMAP server port:                     7143                          
        +IMAP server SSL port:                 7993                          
        +POP server port:                      7110                          
        +POP server SSL port:                  7995                          
        +Use spell check server:               yes                           
        +Spell server URL:                     http://mail.husyt.com:7780/aspell.php
        +Enable version update checks:         TRUE                          
        +Enable version update notifications:  TRUE                          
        +Version update notification email:    [email protected]               
        +Version update source email:          [email protected]               
        +Install mailstore (service webapp):   yes                           
        +Install UI (zimbra,zimbraAdmin webapps): yes                           

   7) zimbra-spell:                            Enabled                       
   8) zimbra-proxy:                            Enabled                       
   9) Default Class of Service Configuration:                                
   s) Save config to file                                                    
   x) Expand menu                                                            
   q) Quit                                    

Address unconfigured (**) items  (? - help) 6


Store configuration

   1) Status:                                  Enabled                       
   2) Create Admin User:                       yes                           
   3) Admin user to create:                    [email protected]               
** 4) Admin Password                           UNSET                         
   5) Anti-virus quarantine user:              [email protected]
   6) Enable automated spam training:          yes                           
   7) Spam training user:                      [email protected]       
   8) Non-spam(Ham) training user:             [email protected]       
   9) SMTP host:                               mail.husyt.com                
  10) Web server HTTP port:                    8080                          
  11) Web server HTTPS port:                   8443                          
  12) Web server mode:                         https                         
  13) IMAP server port:                        7143                          
  14) IMAP server SSL port:                    7993                          
  15) POP server port:                         7110                          
  16) POP server SSL port:                     7995                          
  17) Use spell check server:                  yes                           
  18) Spell server URL:                        http://mail.husyt.com:7780/aspell.php
  19) Enable version update checks:            TRUE                          
  20) Enable version update notifications:     TRUE                          
  21) Version update notification email:       [email protected]               
  22) Version update source email:             [email protected]               
  23) Install mailstore (service webapp):      yes                           
  24) Install UI (zimbra,zimbraAdmin webapps): yes                           

Select, or 'r' for previous menu [r] 4

Password for [email protected] (min 6 characters): [2N8CdR1ZD] 123456

Store configuration

   1) Status:                                  Enabled                       
   2) Create Admin User:                       yes                           
   3) Admin user to create:                    [email protected]               
   4) Admin Password                           set                           
   5) Anti-virus quarantine user:              [email protected]
   6) Enable automated spam training:          yes                           
   7) Spam training user:                      [email protected]       
   8) Non-spam(Ham) training user:             [email protected]       
   9) SMTP host:                               mail.husyt.com                
  10) Web server HTTP port:                    8080                          
  11) Web server HTTPS port:                   8443                          
  12) Web server mode:                         https                         
  13) IMAP server port:                        7143                          
  14) IMAP server SSL port:                    7993                          
  15) POP server port:                         7110                          
  16) POP server SSL port:                     7995                          
  17) Use spell check server:                  yes                           
  18) Spell server URL:                        http://mail.husyt.com:7780/aspell.php
  19) Enable version update checks:            TRUE                          
  20) Enable version update notifications:     TRUE                          
  21) Version update notification email:       [email protected]               
  22) Version update source email:             [email protected]               
  23) Install mailstore (service webapp):      yes                           
  24) Install UI (zimbra,zimbraAdmin webapps): yes                           

Select, or 'r' for previous menu [r] r

Main menu

   1) Common Configuration:                                                  
   2) zimbra-ldap:                             Enabled                       
   3) zimbra-logger:                           Enabled                       
   4) zimbra-mta:                              Enabled                       
   5) zimbra-snmp:                             Enabled                       
   6) zimbra-store:                            Enabled                       
   7) zimbra-spell:                            Enabled                       
   8) zimbra-proxy:                            Enabled                       
   9) Default Class of Service Configuration:                                
   s) Save config to file                                                    
   x) Expand menu                                                            
   q) Quit                                    

*** CONFIGURATION COMPLETE - press 'a' to apply
Select from menu, or press 'a' to apply config (? - help) a
Save configuration data to a file? [Yes] 
Save config in file: [/opt/zimbra/config.32000] 
Saving config in /opt/zimbra/config.32000...done.
The system will be modified - continue? [No] yes
Operations logged to /tmp/zmsetup09142018-155427.log
Setting local config values...done.
Initializing core config...Setting up CA...done.
Deploying CA to /opt/zimbra/conf/ca ...done.
Creating SSL zimbra-store certificate...done.
Creating new zimbra-ldap SSL certificate...done.
Creating new zimbra-mta SSL certificate...done.
Creating new zimbra-proxy SSL certificate...done.
Installing mailboxd SSL certificates...done.
Installing MTA SSL certificates...done.
Installing LDAP SSL certificate...done.
Installing Proxy SSL certificate...done.
Initializing ldap...done.
Setting replication password...done.
Setting Postfix password...done.
Setting amavis password...done.
Setting nginx password...done.
Setting BES searcher  password...done.
Creating server entry for mail.husyt.com...done.
Setting Zimbra IP Mode...done.
Saving CA in ldap ...done.
Saving SSL Certificate in ldap ...done.
Setting spell check URL...done.
Setting service ports on mail.husyt.com...done.
Setting zimbraFeatureTasksEnabled=TRUE...done.
Setting zimbraFeatureBriefcasesEnabled=TRUE...done.
Setting TimeZone Preference...done.
Initializing mta config...done.
Setting services on mail.husyt.com...done.
Adding mail.husyt.com to zimbraMailHostPool in default COS...done.
Creating domain husyt.com...done.
Setting default domain name...done.
Creating domain husyt.com...already exists.
Creating admin account [email protected].
Creating root alias...done.
Creating postmaster alias...done.
Creating user [email protected].
Creating user [email protected].
Creating user [email protected].
Setting spam training and Anti-virus quarantine accounts...done.
Initializing store sql database...done.
Setting zimbraSmtpHostname for mail.husyt.com...done.
Configuring SNMP...done.
Setting up syslog.conf...done.
Starting servers...done.
Installing common zimlets...
com_zimbra_adminversioncheck...done.
com_zimbra_attachcontacts...done.
com_zimbra_attachmail...done.
com_zimbra_bulkprovision...done.
com_zimbra_cert_manager...done.
com_zimbra_clientuploader...done.
com_zimbra_date...done.
com_zimbra_email...done.
com_zimbra_mailarchive...done.
com_zimbra_phone...done.
com_zimbra_proxy_config...done.
com_zimbra_srchhighlighter...done.
com_zimbra_tooltip...done.
com_zimbra_url...done.
com_zimbra_viewmail...done.
com_zimbra_webex...done.
com_zimbra_ymemoticons...done.
Finished installing common zimlets.
Restarting mailboxd...done.
Creating galsync account for default domain...done.

You have the option of notifying Zimbra of your installation.
This helps us to track the uptake of the Zimbra Collaboration Server.
The only information that will be transmitted is:
The VERSION of zcs installed (8.6.0_GA_1153_RHEL7_64)
The ADMIN EMAIL ADDRESS created ([email protected])

Notify Zimbra of your installation? [Yes] no
Notification skipped
Setting up zimbra crontab...done.


Moving /tmp/zmsetup09142018-155427.log to /opt/zimbra/log


Configuration complete - press return to exit 


[root@xiaoyu zimbra]#

7.確認zimbra服務是否運行正常:

[root@xiaoyu ~]# su - zimbra
Last login: Fri Sep 14 16:55:50 CST 2018 on pts/1
[zimbra@xiaoyu ~]$ zmcontrol status
Host mail.husyt.com
amavis                  Running
antispam                Running
antivirus               Running
ldap                    Running
logger                  Running
mailbox                 Running
memcached               Running
mta                     Running
opendkim                Running
proxy                   Running
service webapp          Running
snmp                    Running
spell                   Running
stats                   Running
zimbra webapp           Running
zimbraAdmin webapp      Running
zimlet webapp           Running
zmconfigd               Running
[zimbra@xiaoyu ~]$

8.驗證zimbraweb管理界面及郵箱使用是否正常

管理界面:

https://zimbra_ip:7071/,輸入安裝時的用戶名和密碼登錄即可。

image.png

登陸後,界面如下:

image.png

web版郵箱:https://zimbra_ip/,輸入用戶名和密碼進行登錄:

image.png

登錄後如下:

image.png

爲了進行測試,新建郵件賬戶:[email protected]

現在使用[email protected]發送郵件給[email protected]和外域qq郵箱,驗證是否正常。

image.png

經確認,郵箱已收到郵件,如下:

[email protected]

image.png

[email protected]

image.png

xxx@qq:

提示:如果收件箱沒有,也可能在垃圾箱

image.png


經測試,zimbra郵箱可以正常使用。

至此,zimbra搭建完成。


第三部分:安裝httpd服務

1.安裝httpd所需的依賴包:

[root@xiaoyu ~]# yum -y install autoconf libtool  expat-devel  gcc gcc-c++

2.安裝apr:

[root@xiaoyu ~]# cd /application/
[root@xiaoyu application]# wget  
[root@xiaoyu application]# tar xf apr-1.6.3.tar.gz 
[root@xiaoyu application]# cd apr-1.6.3
[root@xiaoyu apr-1.6.3]# ./buildconf 
[root@xiaoyu apr-1.6.3]# ./configure
[root@xiaoyu apr-1.6.3]# make
[root@xiaoyu apr-1.6.3]# make install


問題1:
[root@xiaoyu apr-1.6.3]# ./buildconf
buildconf: checking installation...
buildconf: python version 2.7.5 (ok)
buildconf: autoconf version 2.69 (ok)
buildconf: libtool version 2.4.2 (ok)
buildconf: copying libtool helper files using /usr/bin/libtoolize
buildconf: creating include/arch/unix/apr_private.h.in ...
perl: warning: Setting locale failed.    #-->報錯
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
buildconf: creating configure ...
buildconf: generating 'make' outputs ...
buildconf: rebuilding rpm spec file

解決方法:LANG=C

問題2:
config.status: executing libtool commands
rm: cannot remove 'libtoolT': No such file or directory
config.status: executing default commands

解決方法:
安裝Apr出現的問題  rm: cannot remove `libtoolT': No such file or directory 
.configure配置參數:

(1)編輯 configure文件,查找 $RM "$cfgfile"這個地方,用#註釋掉
(2)在configure裏面 RM='$RM'   這裏的$RM後面一定有一個空格。 如果後面沒有空格,直接連接減號,就依
然會報錯,把RM='$RM'改爲RM='$RM  -f'。

3.安裝apr-util:

[root@xiaoyu ~]# cd /application/
[root@xiaoyu application]# wget http://mirrors.shu.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
[root@xiaoyu application]# tar xf apr-util-1.6.1.tar.gz 
[root@xiaoyu application]# cd apr-util-1.6.1
[root@xiaoyu apr-util-1.6.1]# ./configure --with-apr=/usr/local/apr
[root@xiaoyu apr-util-1.6.1]# make
[root@xiaoyu apr-util-1.6.1]# make install

4.安裝pcre:

[root@xiaoyu ~]# cd /application/
[root@xiaoyu application]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.gz
[root@xiaoyu application]# tar xf pcre-8.42.tar.gz 
[root@xiaoyu application]# cd pcre-8.42
[root@xiaoyu pcre-8.42]# ./configure
[root@xiaoyu pcre-8.42]# make
[root@xiaoyu pcre-8.42]# make  install

5.安裝httpd:

[root@xiaoyu ~]# cd /application/
[root@xiaoyu application]# wget  
[root@xiaoyu application]# tar xf httpd-2.4.34.tar.gz 
[root@xiaoyu application]# cp -r /application/apr-1.6.3 /application/httpd-2.4.34/srclib/apr
[root@xiaoyu application]# cp -r /application/apr-util-1.6.1 /application/httpd-2.4.34/srclib/apr-util
[root@xiaoyu application]# cd httpd-2.4.34
[root@xiaoyu httpd-2.4.34]# ./configure --prefix=/usr/local/apache2 --with-included-apr
[root@xiaoyu httpd-2.4.34]# make 
[root@xiaoyu httpd-2.4.34]# make install

第四部分:安裝mailman

1.安裝mailman所需的依賴包:

[root@xiaoyu ~]# yum install python python-devel gcc gcc-c++

2.新建mailman所需的用戶和組及相關權限設定:

[root@xiaoyu ~]# groupadd mailman
[root@xiaoyu ~]# useradd -c "GNU Mailman" -g mailman -M -s /sbin/nologin mailman
[root@xiaoyu ~]# cd /usr/local
[root@xiaoyu local]# mkdir mailman
[root@xiaoyu local]# chgrp mailman mailman
[root@xiaoyu local]# chmod a+rx,g+ws mailman

3.下載mailman安裝包並安裝:

[root@xiaoyu ~]# cd /application/
[root@xiaoyu application]# wget http://downloads.sourceforge.net/project/mailman/Mailman%202.1%20%28stable%29/2.1.12/mailman-2.1.12.tgz
[root@xiaoyu application]# tar xf mailman-2.1.12.tgz 
[root@xiaoyu application]# cd mailman-2.1.12
[root@xiaoyu mailman-2.1.12]# ./configure --with-cgi-gid=zimbra
[root@xiaoyu mailman-2.1.12]# make
[root@xiaoyu mailman-2.1.12]# make install


第五部分:爲了和zimbra組合,修改相關設定

httpd服務:

1.修改mailman相關目錄的權限:

[root@xiaoyu ~]# cd /usr/local/mailman/archives
[root@xiaoyu archives]# chown zimbra private
[root@xiaoyu archives]# chmod o-x private
檢查安裝:
/usr/local/mailman/bin/check_perms -f

2.更改/usr/local/apache2/conf/httpd.conf文件:

   變更配置之前,先對配置文件進行備份:

[root@xiaoyu ~]# cp -a  /usr/local/apache2/conf/httpd.conf  /usr/local/apache2/conf/httpd.conf.bak

  (1)變更用戶:

   User zimbra
   Group zimbra

  (2)開啓LoadModule cgid_module modules/mod_cgid.so模塊

LoadModule cgid_module modules/mod_cgid.so   #-->去掉前面的#號

  (3)端口號爲了避免和zimbra的httpd服務衝突,改爲8081:

 Listen 8081  #-->此處的端口爲了避免和zimbra中的httpd服務衝突,進行變更,具體端口請自定義

  (4)在/usr/local/apache2/conf/httpd.conf增加如下內容:

在下述代碼下面增加mailman的相關配置:
<Directory />
    AllowOverride none
    Require all denied
</Directory>

增加的配置如下:
#
#  httpd configuration settings for use with mailman.
#

ScriptAlias /mailman/ /usr/local/mailman/cgi-bin/
<Directory "/usr/local/mailman/cgi-bin/">
   AllowOverride None
   Options None
   Require all granted
#   Order allow,deny
#   Allow from all
</Directory>

Alias /pipermail/ /usr/local/mailman/archives/public/
<Directory "/usr/local/mailman/archives/public">
   AllowOverride None
   Options None
   Require all granted
#   Order allow,deny
#   Allow from all
</Directory>


# Uncomment the following line, replacing www.example.com with your server’s
# name, to redirect queries to /mailman to the listinfo page (recommended).
# RedirectMatch ^/mailman[/]*$ http://www.example.com/mailman/listinfo

檢查語法:
[root@xiaoyu ~]# /usr/local/apache2/bin/apachectl -t
Syntax OK

3.拷貝mailman的icons並重啓Apache服務:

[root@xiaoyu ~]# cd /usr/local/apache2/htdocs/
[root@xiaoyu htdocs]# mkdir mmimages
[root@xiaoyu htdocs]# chown -R zimbra:zimbra mmimages

zimbra用戶:
[root@xiaoyu htdocs]# su - zimbra
Last login: Fri Sep 14 17:00:36 CST 2018 on pts/1
[zimbra@xiaoyu ~]$ cd /usr/local/apache2/htdocs/
[zimbra@xiaoyu htdocs]$ cp /usr/local/mailman/icons/* mmimages/

root用戶:
[root@xiaoyu htdocs]# /usr/local/apache2/bin/apachectl stop
httpd (no pid file) not running      #-->由於是首次啓動httpd服務,所以是沒有運行
[root@xiaoyu htdocs]# /usr/local/apache2/bin/apachectl start

postfix服務:

1.修改postfix服務之前,先關閉zimbra服務:

 [root@xiaoyu ~]#  /etc/init.d/zimbra stop

2.編輯 /opt/zimbra/postfix/conf/main.cf 配置文件:

[root@xiaoyu ~]# cp -a  /opt/zimbra/postfix/conf/main.cf /opt/zimbra/postfix/conf/main.cf.bak
[root@xiaoyu ~]# vim /opt/zimbra/postfix/conf/main.cf
將virtual_alias_maps和alias_maps修改爲如下內容: 
virtual_alias_maps = ldap:/opt/zimbra/conf/ldap-vam.cf,lmdb:/usr/local/mailman/data/virtual-mailman
alias_maps = lmdb:/etc/aliases,lmdb:/usr/local/mailman/data/aliases

3.編輯/opt/zimbra/conf/zmconfigd.cf刪除下述的配置變量,否則重啓zimbra時,/opt/zimbra/postfix/conf/main.cf 中的配置會變回默認配置:

[root@xiaoyu ~]# cp -a /opt/zimbra/conf/zmconfigd.cf /opt/zimbra/conf/zmconfigd.cf.bak
[root@xiaoyu ~]# vim /opt/zimbra/conf/zmconfigd.cf
刪除如下內容:
mydestination
virtual_alias_maps
alias_maps
mynetworks

刪除內容具體如下:
if VAR zimbraMtaMyDestination
                POSTCONF mydestination VAR zimbraMtaMyDestination
fi
POSTCONF virtual_alias_maps                     VAR zimbraMtaVirtualAliasMaps
POSTCONF alias_maps                             VAR zimbraMtaAliasMaps
if VAR zimbraMtaMyNetworks
                POSTCONF mynetworks VAR zimbraMtaMyNetworks
fi

4.編輯/usr/local/mailman/Mailman/mm_cfg.py文件,在文件結尾添加如下內容:

[root@xiaoyu ~]# cp -a /usr/local/mailman/Mailman/mm_cfg.py /usr/local/mailman/Mailman/mm_cfg.py.bak
[root@xiaoyu ~]# vim  /usr/local/mailman/Mailman/mm_cfg.py   
MTA = 'Postfix'
POSTFIX_ALIAS_CMD = '/opt/zimbra/postfix/sbin/postalias'
POSTFIX_MAP_CMD = '/opt/zimbra/postfix/sbin/postmap'
IMAGE_LOGOS = '/mmimages/'
DEFAULT_URL_PATTERN = '     #-->注意此處的端口號爲前面httpd自定義的端口號 
POSTFIX_STYLE_VIRTUAL_DOMAINS = [ 'husyt.com' ]
#add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
add_virtualhost('mail.husyt.com','husyt.com')


重啓httpd服務:
[root@xiaoyu ~]# /usr/local/apache2/bin/apachectl restart 

特別提示:
如果需要增加不同的域進行訪問,則只需要增加如下內容即可訪問
add_virtualhost( "abc.com", "abc.com )
add_virtualhost( "zxc.com", "zxc.com" )
add_virtualhost( "xxx.com", "xxx.com" )

5.啓動zimbra服務:

[root@xiaoyu ~]# /etc/init.d/zimbra start


第六部分:創建mailman的默認站點列表:

1.創建mailman的默認站點列表

[root@xiaoyu ~]#  cd /usr/local/mailman/
[root@xiaoyu mailman]# ./bin/newlist mailman [email protected]
Initial mailman password:      #-->輸入mailman的初始化密碼
Hit enter to notify mailman [email protected]   #--> 輸入mailman郵件組所屬者:[email protected] 

[root@xiaoyu mailman]#  bin/config_list -i /usr/local/mailman/data/sitelist.cfg mailman
Non-standard property restored: personalize
[root@xiaoyu mailman]# bin/genaliases 
[root@xiaoyu mailman]# chown  mailman:mailman /usr/local/mailman/data/aliases*
[root@xiaoyu mailman]# chown mailman:mailman /usr/local/mailman/data/virtual-mailman*
[root@xiaoyu mailman]# 
[root@xiaoyu mailman]# cd /usr/local/mailman/
[root@xiaoyu mailman]# bin/config_list -i data/sitelist.cfg mailman
Non-standard property restored: personalize
[root@xiaoyu mailman]# /usr/local/mailman/bin/genaliases

2.修改的屬主和屬組,必須是mailman(aliases and virtual-mailman must be owned by mailman):

[root@xiaoyu mailman]# chown mailman:mailman /usr/local/mailman/data/aliases*
[root@xiaoyu mailman]# chown mailman:mailman /usr/local/mailman/data/virtual-mailman*

3.將mailman加入計劃任務:

[root@xiaoyu ~]# cd /usr/local/mailman/cron 
[root@xiaoyu cron]# crontab -u mailman crontab.in

[root@xiaoyu cron]# cp /usr/local/mailman/scripts/mailman /etc/init.d/
[root@xiaoyu cron]# chkconfig --add mailman

4.啓動mailman服務:

[root@xiaoyu ~]# /etc/init.d/mailman start

5.驗證mailman管理界面是否能打開:

訪問網址:http://zimbra_ip:8081/mailman/listinfo

image.png



如需使用域名訪問,則在windows本地的hosts文件中增加如下內容:

192.168.1.10    husyt.com

訪問網址:http://husyt.com:8081/mailman/listinfo

image.png

至此,zimbra+mailman部署完成。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章