MAIL SYSTEM FOR HIGH SIERRA    |   EXIM • DOVECOT • MYSQL • SPAMASSASSIN • CLAMAV • ROUNDCUBE • ECM3


    APPLE COMMAND LINE TOOLS

Install via terminal

$ xcode-select --install
Allow High Sierra to install third party software:

$ sudo spctl --master-disable

    BREW BASIC INSTALLATION

Install via terminal

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    APACHE Web Server (httpd)

Install httpd via brew modules

$ brew install httpd

      EDIT:$ open -e /usr/local/etc/httpd/httpd.conf
Listen 80

ServerName localhost

<Directory />
    AllowOverride All
    Require all granted
</Directory>

ErrorLog "/usr/local/var/log/httpd/error.log"
CustomLog "/usr/local/var/log/httpd/access.log" combined

$ sudo brew services start httpd

$ sudo apachectl -k start
$ sudo apachectl -k stop
$ sudo apachectl -k restart

If setup with virtual hosts:

$ mkdir /usr/local/var/www/Default
$ echo "<h1>localhost</h1>" > /usr/local/var/www/Default/index.html

$ mkdir /usr/local/var/www/Sites
$ mkdir /usr/local/var/www/Sites/example.com
$ echo "<h1>example.com</h1>" > /usr/local/var/www/Sites/example.com/index.html

      EDIT:$ open -e /usr/local/etc/httpd/httpd.conf

DocumentRoot /usr/local/var/www/Default
<Directory "/usr/local/var/www/Default">

#Include /usr/local/etc/httpd/extra/httpd-vhosts.conf

      EDIT:$ open -e /usr/local/etc/httpd/extra/httpd-vhosts.conf

<VirtualHost 0.0.0.0:80>
    ServerAdmin webmaster@example.com
    DocumentRoot "/usr/local/var/www/Sites/example.com"
    ServerName example.com
    ServerAlias www.example.com
    ErrorLog "/usr/local/var/log/httpd/example.com-error.log"
    CustomLog "/usr/local/var/log/httpd/example.com-access.log" common

</VirtualHost>

$ sudo apachectl -k restart
    TEST:
http://localhost

    PHP

Install php via brew

$ brew install php@5.6

You need to have this software first in your PATH run:

$ echo 'export PATH="/usr/local/opt/php@5.6/bin:$PATH"' >> ~/.bash_profile
$ echo 'export PATH="/usr/local/opt/php@5.6/sbin:$PATH"' >> ~/.bash_profile

(restart terminal to take effect)


      EDIT:$ open -e /usr/local/etc/httpd/httpd.conf

To enable PHP in Apache uncomment and add the following to httpd.conf and restart Apache:


uncomment: LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so
add line: LoadModule php5_module /usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

    EDIT:
$ open -e /usr/local/etc/php/5.6/php.ini

Insert the include path for pear and uncomment timezone after adding "UTC" to it in the php.ini file:


include_path=".:/usr/local/share/pear@5.6"

date.timezone = UTC

$ sudo brew services start php@5.6

$ pear install DB
$ pear install MDB2
$ pear install MDB2_Driver_mysqli

    EDIT:$ echo "<?php phpinfo(); ?>" > /usr/local/var/www/Default/info.php
$ echo "<?php phpinfo(); ?>" > /usr/local/var/www/Sites/example.com/info.php

$ sudo apachectl -k restart  
    TEST:
http://localhost/info.php


    APCu cache (PHP)

$ pecl channel-update pecl.php.net
$ pecl install apcu-4.0.11

    EDIT:$ open -e /usr/local/etc/php/5.6/php.ini

You will need to remove the extension="apcu.so" entry that PECL adds to the top of your php.ini. Edit this file and remove the top line:

extension="apcu.so"

Create a config file for APCu extension:

cat >/usr/local/etc/php/5.6/conf.d/ext-apcu.ini
[apcu]
extension="apcu.so"
apc.enabled=1
apc.shm_size=64M
apc.ttl=7200
apc.enable_cli=1

Hit Ctrl+D to finalize the "cat" process and finally restart server for it to take effect.

$ sudo apachectl -k restart

    MYSQL (INITIAL INSTALLATION)

Download and install the MySql DMG Archive package from MySQL Community Server. (We need version 5.7.22) (Version 8+ is not

working yet.) Use Preference paine to start it up and install a launch document. Be sure to copy the temporary root password mysql

installer creates at the end of install process.

      Download:     pkg my.cnf.zip

Unzip and move to:     /private/etc

$ echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.profile

Symlink client lib to /usr/local/lib

$ sudo ln -s /usr/local/mysql/lib/libmysqlclient.20.dylib /usr/local/lib/libmysqlclient.20.dylib


$ login root
$ mysql_secure_installation

    PHPMYADMIN


Download the latest version of phpmyadmin from: https://www.phpmyadmin.net/downloads

Preferable the "english.tar.gz" version. Unzip the folder and move it to /usr/local/share and rename the folder phpMyAdmin

$ mv /usr/local/share/phpMyAdmin/config.sample.inc.php /usr/local/share/phpMyAdmin/config.inc.php  
      EDIT:$ open -e /usr/local/etc/httpd/httpd.conf
Alias /phpmyadmin /usr/local/share/phpmyadmin
<Directory /usr/local/share/phpmyadmin/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>

      EDIT:$ open -e /usr/local/share/phpMyAdmin/config.inc.php
$cfg['Lang'] = 'en';

$cfg['TempDir'] = '/tmp';

Get a 32 chracter random string at https://strongpasswordgenerator.com change your secret blowfish

38S685N2u9986xYQ424VM37X3PpH7aNe
$ sudo apachectl -k restart 
       TEST:

http://localhost/phpmyadmin

    MAILADMIN (ECM3)

            Download:     pkg mailadmin.zip

Unzip and move to:      /usr/local/share

      EDIT:$ open -e /usr/local/etc/httpd/httpd.conf

Alias /mailadmin /usr/local/share/mailadmin

$ sudo apachectl -k restart 

Create database for ecm3

mysql -h 127.0.0.1 -u root -p 
mysql> CREATE database ecm3; 
mysql> use ecm3;
mysql> \. /usr/local/share/mailadmin/sql/ecm3.sql

    EDIT:$ open -e /usr/local/share/mailadmin/config/config.inc.php

For mailadmin (ecm3) enter username and password. (Use "root" as username and your mysql password.)

$sqluser = "username"; // Database user
$sqlpass = "password"; // Database password

    TEST:
http://localhost/mailadmin

Initial username is 'siteadmin' with password 'change'.