Showing posts with label linux mail. Show all posts
Showing posts with label linux mail. Show all posts

Wednesday, January 15, 2014

How to setup Zimbra on Debian Squeeze


What is Zimbra?

Zimbra is a complete email, address book, calendar and tasks solution that can be accessed from the Zimbra Web Client, Zimbra Desktop offline client, Outlook and a variety of other standards-based email clients and mobile devices. It can be deployed as a traditional binary install on Linux, or as a software virtual appliance, commonly referred to as Zimbra appliance.There are several versions of ZCS to choose from:

    >> ZCS Network Edition
    >> ZCS hosted email by a Zimbra partner
    >> ZCS Open Source Edition (free)

Zimbra is a groupware system that provides email, calendaring, integrated antivirus and spam filtering, and more for multiple domains. Available in several editions, this guide will help you get Zimbra Collaboration Suite-Open Source Edition installed on your Debian 6 (Squeeze) Linux VPS.

Please note that Zimbra is a fairly "heavy" (resource-intensive) product compared to some other groupware offerings. We recommend a Linode 2048 or higher for best results; you may encounter issues using Zimbra with plans with less resources. Additionally, note that Zimbra works best as a standalone product on your VPS; installation alongside other software is not advised. Zimbra is deprecating support for 32-bit systems, and therefore it is assumed you have deployed the 64-bit version of Debian 6. If this is not the case, you will want to redeploy with the 64-bit version before continuing. All configuration will be performed through the terminal; please make sure you're logged into your Linode as root via SSH.

Please note that as of this writing, Zimbra is not officially supported on Debian 6. The software should function as expected but your support options may be limited by choosing to install it on Debian 6.


Please check your host record is Ok...
------------------------------------------------
    # vim /etc/hosts

====================================================
127.0.0.1       localhost
127.0.1.1       mx.mithu.com    mx
172.16.0.7     mx.mithu.com    mx

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
====================================================



Check your debian squeeze source list is Ok...
------------------------------------------------------------
  
    # vim /etc/apt/sources.list

===========================================================
deb ftp://ftp.us.debian.org/debian/ squeeze main contrib non-free
deb-src ftp://ftp.us.debian.org/debian/ squeeze main contrib non-free

deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main
===========================================================


Don't forget to update & upgrade:

    # apt-get update
    # apt-get upgrade


Download & Install several packages required by Zimbra:


    # apt-get install libpcre3 libgmp3c2 libgmp3-dev sysstat libexpat1 libidn11 perl-modules wget lzma sudo


Download Zimbra Software for Debian:


    # wget http://files2.zimbra.com/downloads/6.0.10_GA/zcs-6.0.10_GA_2692.DEBIAN5.20101215161423.tgz
    # tar -xzvf zcs*
    # cd zcs*

Now we have to edit the file util/utilfunc.sh
    # vim /root/zcs-6.0.10_GA_2692.DEBIAN5.20101215161423/util/utilfunc.sh                    [assumed that zimbra software donloaded and extracted in /root folder..    ]

=========================================================
=========================================================
Search for the first instance of the following line:

--------------------------------------------------------------------------------
PREREQ_PACKAGES="sudo libidn11 libgmp3 libstdc++6"
--------------------------------------------------------------------------------


Change it to match the following line:


------------------------------------------------------------------------------------
PREREQ_PACKAGES="sudo libidn11 libgmp3c2 libstdc++6"
------------------------------------------------------------------------------------

=========================================================
=========================================================

====================================================================
Note: while editing this file it will fire a message that... the file is read only. You have forcefully save it using (wq!).
====================================================================


Due to stricter behavior in the version supplied in Debian 6, you'll need to temporarily downgrade your dpkg binary before proceeding.
Download appropriate package depending on whether you are running 32-bit or 64-bit Debian:

Assumed that you are downloading the package in /root folder..
==========================================================
wget http://security.ubuntu.com/ubuntu/pool/main/d/dpkg/dpkg_1.15.5.6ubuntu4.5_amd64.deb [for 64bit]
wget http://security.ubuntu.com/ubuntu/pool/main/d/dpkg/dpkg_1.15.5.6ubuntu4.5_i386.deb     [for 32bit]   
==========================================================

Install the downloaded dev package with the following command:
    # dpkg -i dpkg_1.15.5.6ubuntu4.5_i386.deb

Now its time for the installation of ZIMBRA... ha ha ha
    # cd /root/zcs-6.0.10_GA_2692.DEBIAN5.20101215161423  (assumed that you extracted zimbra package in this direcotry..)
    # ./install.sh --platform-override

The install will begin, prompting you to respond to a number of questions, and consuming a moment to perform various tasks.

You can safely assume the default configuration..... (Asking prompts are as follows....)

-------------------------------------------------------------------
The system will be modified.  Continue? [N] Y
-------------------------------------------------------------------


-------------------------------------------------------------------------------------------------
DNS ERROR resolving MX for hostname.example.com
It is suggested that the domain name have an MX record configured in DNS
Change domain name? [Yes] No
--------------------------------------------------------------------------------------------------


You'll then be presented with an admin menu next.....


-------------------------------------------------------------------------------------------------------------
Main menu

   1) Common Configuration:
   2) zimbra-ldap:                                   Enabled
   3) zimbra-store:                                  Enabled
        +Create Admin User:                     yes
        +Admin user to create:                  admin@hostname.example.com
******* +Admin Password                        UNSET
        +Enable automated spam training:       yes
        +Spam training user:                           spam.5jdzb7fy@hostname.example.com
        +Non-spam(Ham) training user:          ham.vhdq0mhzo@hostname.example.com
        +Global Documents Account:             wiki@hostname.example.com
        +SMTP host:                                       hostname.example.com
        +Web server HTTP port:                     80
        +Web server HTTPS port:                   443
        +Web server mode:                             http
        +IMAP server port:                              143
        +IMAP server SSL port:                       993
        +POP server port:                               110
        +POP server SSL port:                       995
        +Use spell check server:                     yes
        +Spell server URL:                             http://hostname.example.com:7780/aspell.php
        +Configure for use with mail proxy:     FALSE
        +Configure for use with web proxy:     FALSE
        +Enable version update checks:          TRUE
        +Enable version update notifications:  TRUE
        +Version update notification email:       admin@hostname.example.com
        +Version update source email:              admin@hostname.example.com

   4) zimbra-mta:                                Enabled
   5) zimbra-snmp:                             Enabled
   6) zimbra-logger:                            Enabled
   7) zimbra-spell:                              Enabled
   8) Default Class of Service Configuration:
   r) Start servers after configuration        yes
   s) Save config to file
   x) Expand menu
   q) Quit

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


Enter "3" to enter the zimbra-store menu, which will look similar to the following:

-------------------------------------------------------------------------------------------------------------
Store configuration

   1) Status:                                               Enabled
   2) Create Admin User:                           yes
   3) Admin user to create:                        admin@hostname.example.com
** 4) Admin Password                               UNSET
   5) Enable automated spam training:      yes
   6) Spam training user:                           spam.5jdzb7fy@hostname.example.com
   7) Non-spam(Ham) training user:          ham.vhdq0mhzo@hostname.example.com
   8) Global Documents Account:             wiki@hostname.example.com
   9) SMTP host:                                       hostname.example.com
  10) Web server HTTP port:                    80
  11) Web server HTTPS port:                  443
  12) Web server mode:                            http
  13) IMAP server port:                            143
  14) IMAP server SSL port:                     993
  15) POP server port:                              110
  16) POP server SSL port:                      995
  17) Use spell check server:                    yes
  18) Spell server URL:                            http://hostname.example.com:7780/aspell.php
  19) Configure for use with mail proxy:         FALSE
  20) Configure for use with web proxy:         FALSE
  21) Enable version update checks:             TRUE
  22) Enable version update notifications:     TRUE
  23) Version update notification email:        admin@hostname.example.com
  24) Version update source email:               admin@hostname.example.com

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

You can configure various options here; but, the most important option is the one for setting the administrator password.Enter "4" to set it, choosing a strong password comprised of letters, numbers, and non-alphanumeric characters. After setting the admin password, enter "r" to return to the main menu. At this point you can enter "a" to apply the configuration that you have set, and follow this procedure. This allows Zimbra to proceed with the remaining installation steps.


Issue the following command to restore your original version of dpkg:
====================================================================
    # apt-get install dpkg

And finally don't forget restart zimber service.
    # /etc/init.d/zimbra restart



Now time to visit the Zimbra admin URL in your browser. It will be in the form of :
=====================================================================
    # https://hostname.example.com:7071/

Once you have configured the server and added accounts, users may log in using a link similar to

    # http://hostname.example.com/zimbra/mail



Note:    Default Admin Account : admin@hostname.example.com
                                      Password: as you entered during setup



Tuning:
Problem in log:

zimbra postfix/smtp[1927]: 34A2F90126: to=<email@host.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=26462, delays=26461/0.49/0.05/0.15, dsn=4.5.0, status=deferred (host 127.0.0.1[127.0.0.1] said: 451 4.5.0 Error in processing, id=32120-01, parts_decode_ext FAILED: Unix utility file(1) not available, but is needed at (eval 85) line 113. (in reply to end of DATA command))

451 4.5.0 Error in processing, id=16530-01, parts_decode_ext FAILED: Unix utility file(1) not available, but is needed at (eval 85) line 113. (in reply to end of DATA command))

Solution:

    #apt-get install file

Restart Zimbra...
    # /etc/init.d/zimbra restart

Tuesday, August 27, 2013

How to Configure Mail Server with Postfix and Dovecot in Debian 7.0 (Wheezy)


Setup your host name like this:
---------------------------
 root@mail:~# vim /etc/hosts
===========================================
127.0.0.1       localhost
146.184.13.55   mail.server.world      mail

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
============================================
For Incomming Mail:
------------------

root@mail:~# apt-get install dovecot-common dovecot-pop3d dovecot-imapd

root@mail:~# vim /etc/dovecot/dovecot.conf
# line 26: change ( if not listen IPv6 port )
listen = *

root@mail:~# vim /etc/dovecot/conf.d/10-auth.conf
# line 9: uncomment and change ( allow plain text auth )
disable_plaintext_auth = no

# line 99: add
auth_mechanisms = plain login


root@mail:~# vim /etc/dovecot/conf.d/10-mail.conf
# line 30: uncomment and add

mail_location = maildir:~/Maildir


root@mail:~# vim /etc/dovecot/conf.d/10-master.conf
# line 96-98: uncomment and add

# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
    mode = 0666
    user = postfix
    group = postfix
}


root@mail:~# /etc/init.d/dovecot restart



For Outgoing Mail:
-----------------
root@mail:~# apt-get install postfix postfix-tls sasl2-bin


# select 'No Configuration' (configure manually)

                 

root@mail:~# cp /usr/lib/postfix/main.cf /etc/postfix/main.cf

root@mail:~# vim /etc/postfix/main.cf



# line 59: uncomment
mail_owner = postfix

# line 76: uncomment and specify hostname
myhostname = mail.server.world

# line 83: uncomment and specify domain name
mydomain = server.world

# line 104: uncomment
myorigin = $mydomain

# line 118: uncomment
inet_interfaces = all

# line 166: uncomment
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

# line 209: uncomment
local_recipient_maps = unix:passwd.byname $alias_maps

# line 268: uncomment and specify your LAN
mynetworks = 127.0.0.0/8, 10.0.0.0/24

# line 388: uncomment
alias_maps = hash:/etc/aliases

# line 399: uncomment
alias_database = hash:/etc/aliases

# line 421: uncomment (use Maildir)
home_mailbox = Maildir/

# line 557: make it comment and add below

# smtpd_banner = $myhostname ESMTP $mail_name (@@DISTRO@@)
smtpd_banner = $myhostname ESMTP

# line 631: add
sendmail_path = /usr/sbin/postfix

# line 636: add
newaliases_path = /usr/bin/newaliases

# line 641: add
mailq_path = /usr/bin/mailq

# line 647: add
setgid_group = postdrop

# line 651: make it comment
#html_directory =

# line 655: make it comment
# manpage_directory =

# line 660: make it comment
# sample_directory =

# line 664: make it comment
# readme_directory =

# add at the last line: limit an email size 10M
message_size_limit = 10485760

# limit mailbox 1G
mailbox_size_limit = 1073741824

# Add the following line to locate transport file
transport_maps = hash:/etc/postfix/transport

# for SMTP-Auth settings

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_client_restrictions = permit_mynetworks,reject_unknown_client,permit
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject

root@mail:~# vim /etc/postfix/header_checks

# for example, reject from the addreses "*@bdjobs.com"

/^From:.*@bdjobs.com/ REJECT


root@mail:~# vim /etc/postfix/transport
--------------------------------------
nationalhousingbd.com    local:
.nationalhousingbd.com    local:
--------------------------------------
root@mail:~# postmap transport
root@mail:~# newaliases
root@mail:~# postalias aliases
root@mail:~# /etc/init.d/postfix restart

Stopping Postfix Mail Transport Agent: postfix.
Starting Postfix Mail Transport Agent: postfix.