mailcow

mailcow

PLEASE USE https://github.com/mailcow/mailcow-dockerized! This version is outdated/frozen until "mailcow: dockerized" code is merged to this repository. (No estimation of when this will occurs).

Official website: https://mailcow.email

mailcow is a mail server suite based on Dovecot, Postfix and other open source software, that provides a modern web UI for user/server administration.

mailcow supports Debian 8 (Jessie), Ubuntu LTS 14.04 (Trusty Tahr) and Ubuntu LTS 16.04 (Xenial Xerus)

Everybody loves screenshots (v0.14)

Get support

Commercial support

For commercial support contact info@servercow.de.

Community support

Introduction

Comes with...

System Requirements

Please check, if your system meets the following system resources:

Resource mailcow (Roundcube) mailcow (SOGo)
CPU 1 GHz 1 GHz
RAM                     800 MiB             1 GiB        
Disk 5 GiB 5 GiB
System Type x86 or x86_64 x86_64

Before You Begin: Prerequisites

apt-get purge exim4*
Service Protocol Port
Postfix Submission TCP 587
Postfix SMTPS TCP 465
Postfix SMTP TCP 25
Dovecot IMAP TCP 143
Dovecot IMAPS TCP 993
Dovecot POP3 TCP 110
Dovecot POP3S TCP 995
Dovecot ManageSieve TCP 4190
HTTP(S) TCP 80/443

Obviously you will need an A and/or AAAA record sys_hostname.sys_domain pointing to your IP address and a valid MX record. Let's Encrypt does not assign certificates when it cannot determine a valid IPv4 address.

Name Type Value Priority
sys_hostname.sys_domain A/AAAA IPv4/6 any
sys_domain MX sys_hostname.sys_domain 25

Optional: Auto-configuration services for Thunderbird (and derivates) + ActiveSync. You do not need to setup autodiscover when not using SOGo with ActiveSync.

Name Type Value Priority
autoconfig.sys_domain A/AAAA IPv4/6 any
autodiscover.sys_domain A/AAAA IPv4/6 any

Hint: ActiveSync auto-discovery is setup to configure desktop clients with IMAP!

Further DNS records for SPF and DKIM are recommended. These entries will raise trust in your mailserver, reduce abuse of your domain name and increase authenticity.

Find more details about mailcow DNS entries and SPF/DKIM related configuration in our wiki article on DNS Records.

I recommend PowerDNS Recursor as a local recursor with DNSSEC capabilities. See https://repo.powerdns.com/. Though any non-blocked or rate limited DNS server your ISP gave you should be fine.

Installation

Please run all commands as root

Download a stable release

Download mailcow to whichever directory (using ~/build here). Replace "v0.x" with the tag of the latest release: https://github.com/andryyy/mailcow/releases/latest

mkdir ~/build ; cd ~/build
wget -O - https://github.com/andryyy/mailcow/archive/v0.x.tar.gz | tar xfz -
cd mailcow-*

Now edit the file "configuration" to fit your needs!

nano mailcow.config

Please make sure your FQDN resolves correctly!

Empty configuration values are invalid!

You are ready to start the script:

./install.sh

Just be patient and confirm every step by pressing [ENTER] or [CTRL-C] to interrupt the installation. If you run into problems, try to locate the error with "inst_debug" enabled in your configuration. Please contact me when you need help or found a bug.

More debugging is about to come. Though everything should work as intended.

After the installation, visit your dashboard @ https://hostname.example.com, use the logged credentials in ./installer.log

Remember to create an alias or a mailbox for postmaster.

Again, please check you setup all DNS records accordingly.

Web UI configuration variables

Some settings can be changed by overwriting defaults of /var/www/mail/inc/vars.inc.php in /var/www/mail/inc/vars.local.inc.php.

Changes to /var/www/mail/inc/vars.local.inc.php will not be overwritten when upgrading mailcow.

Upgrade

Please run all commands as root

The mailcow configuration file (mailcow.config) will not be read, so there is no need to adjust it in any way before upgrading.

To start the upgrade, run the following command:

./install.sh -u

Please double check the detected FQDN!

When autodetection of your hostname and/or domain name fails, use the -H parameter to overwrite the hostname and/or -D to overwrite the domain name:

# FQDN: mx.example.org
./install -u -H mx -D example.org

Uninstall

Please remove the components you do not need manually. mailcow installs components that may be used by other software on your system. mailcow is an installer that installs and configures software, so there is no routine to remove itself.

A list of by apt-get installed components

# System tools
dnsutils sudo zip bzip2 unzip unrar-free curl openssl file bsd-mailx

# Core components
# ${OPENJDK} is either "openjdk-7" or "openjdk-9"
rrdtool mailgraph fcgiwrap spawn-fcgi python-setuptools libmail-spf-perl libmail-dkim-perl mailutils pyzor razor postfix postfix-mysql postfix-pcre postgrey pflogsumm spamassassin spamc opendkim opendkim-tools clamav-daemon python-magic liblockfile-simple-perl libdbi-perl libmime-base64-urlsafe-perl libtest-tempdir-perl liblogger-syslog-perl ${OPENJDK}-jre-headless libcurl4-openssl-dev libexpat1-dev solr-jetty

# PHP components
# ${PHP} is either PHP or PHP5
php-auth-sasl php-http-request php-mail php-mail-mime php-mail-mimedecode php-net-dime php-net-smtp php-net-socket php-net-url php-pear php-soap ${PHP} ${PHP}-cli ${PHP}-common ${PHP}-curl ${PHP}-gd ${PHP}-imap ${PHP}-intl ${PHP}-xsl libawl-php ${PHP}-mcrypt ${PHP}-mysql ${PHP}-xmlrpc

# Database components
mariadb-client mariadb-server
# or...
mysql-client mysql-server

# Webserver components
# ${PHP} is either PHP or PHP5
apache2 apache2-utils libapache2-mod-${PHP}
# or...
nginx-extras ${PHP}-fpm

# Dovecot components
dovecot-common dovecot-core dovecot-imapd dovecot-lmtpd dovecot-managesieved dovecot-sieve dovecot-mysql dovecot-pop3d dovecot-solr

# SOGo
# ALSO: rm /etc/apt/sources.list.d/sogo.list
sogo sogo-activesync libwbxml2-0 memcached

System modifications

# Cronjobs
rm /etc/cron.daily/mc_clean_spam_aliases /etc/cron.daily/mailcow-clean-spam-aliases /etc/cron.daily/dovemaint /etc/cron.d/solrmaint /etc/cron.daily/spamlearn /etc/cron.daily/spamassassin_heinlein /etc/cron.weekly/le-renew

# Sudo
rm /etc/sudoers.d/mailcow

# Executables
rm /usr/local/sbin/mailcow-reset-admin /usr/local/sbin/mailcow-dkim-tool /usr/local/sbin/mailcow-set-message-limit /usr/local/sbin/mailcow-renew-pflogsumm /usr/local/sbin/mc_pflog_renew /usr/local/sbin/mc_msg_size /usr/local/sbin/mc_dkim_ctrl /usr/local/sbin/mc_resetadmin

Manually installed components and miscellaneous

# Databases
# Besides aboves packages, you may want to drop the mailcow and, if installed, Roundcube database. SOGo uses the mailcow database.
DROP DATABASE $mailcowdb;
DROP DATABASE $roundcubedb;
 
# Let's Encrypt
rm -r /opt/letsencrypt-sh/

# FuGlu
systemctl disable fuglu
rm -rf /usr/local/lib/python2.7/dist-packages/fuglu*
update-rc.d -f fuglu remove
userdel fuglu
# FuGlu dependencies
python-sqlalchemy python-beautifulsoup python-mysqldb