The instructions below applies to EMG 7.0, EMG 7.1 and EMG 7.2.

 

This document describes the steps involved to install a complete EMG platform with

running in CentOS 7.2.1511, released in December 2015 (end of support, June 30, 2024).

CentOS 7 provides

through the default yum repositories which meet the EMG Portal requirements well.

We will install on Centos 7 (64-bit), create a separate user for emg and place the EMG installation in /home/emg.

This will give us a privilege-separated installation in its own location.

Contents

Basic OS installation and configuration

EMG installation

We are now ready to install and configure EMG

cd /tmp
wget --http-user=emg --http-password=letmein \
   http://www.nordicmessaging.se/files/emg/emg71/emg7110-50622-linux-64bit-full.tar.gz
tar xvzf emg7110-50622-linux-64bit-full.tar.gz
cd emg-dist
sh ./INSTALL
echo 'export EMGDIR=$HOME/etc' >>/home/emg/.bash_profile
cp /home/emg/etc/server.cfg.dbconfig /home/emg/etc/server.cfg
cd /home/emg/etc/sql
vi ./createemgdb-mysql.sh
sh ./createemgdb-mysql.sh createdb
sh ./createemgdb-mysql.sh createtables
sh ./createemgdb-mysql.sh initdbconfig
vi /home/emg/etc/server.cfg

EMG perl installation

In order for the EMG Portal billing plugin (and EMG perl plugins in general) to work properly the EMG perl distribution needs to be installed. More information http://www.nordicmessaging.se/tech-notes/emg/emg-526-and-perl-plugins.html.

Please note that this will be a perl installation completely separated from the default perl installation used by /usr/bin/perl. To install modules and run the EMG perl distribution you must run the perl binary with the full path (/opt/perl-5.12.2-emg/bin/perl) and preferably always as user "emg" to avoid mixing up file permissions. However, below we add the new perl bin directory first in the PATH for the "emg" user in order to ensure the EMG perl binary is always used when using "emg" account.

EMG watchdog installation

The EMG watchdog can monitor the EMG server process (emgd) and perform operations such as stopping server, starting server and retrieve EMG server log files to EMG Portal. It also monitors available disk space in the file system and sends a notification when a specified limit has been reached.

It features a built-in web server used to serve the API calls. The web server listens on port 3000 by default.

EMG Portal installation

Time to download and install EMG Portal. The evaluation version of EMG Portal is encoded with ionCube and first an ionCube loader must be configured in PHP.

Finish EMG installation

You need to copy the billing plugin from EMG Portal distribution into the EMG etc directory.

Finally you should be able to start the EMG server by running command "emgd" as user "emg". The command "emgstat" should give you a list of connectors in the EMG server and their status.

You should also be able to login to the EMG Portal and see the same information under "Dashboard -> Connectors".

Recurring tasks (cron)

A few cron jobs need to be added to enable recurring tasks.

There is a sample script "cleandb.sh.sample" in the /home/emg/bin directory. The "hourly_summary.pl.sample" script is part of the EMG Portal distribution.

As user "emg", copy them and review paths and database settings in the scripts to ensure they run correctly.

cp /home/emg/bin/cleandb.sh.sample /home/emg/bin/cleandb.sh
cp /var/www/html/emgportal/misc/hourly_summary.pl.sample /home/emg/bin/hourly_summary.pl
cp /var/www/html/emgportal/misc/hourly_summary_connector.pl.sample /home/emg/bin/hourly_summary_connector.pl
vi /home/emg/bin/cleandb.sh
vi /home/emg/bin/hourly_summary.pl 

Then add crontab entries similar to extract below.

crontab -u emg -e (if running as user "root")
crontab -e (if running as user "emg")

Extract from "crontab -l -u emg" on a running server:

# Purge old records from EMG database
*/5 * * * * /home/emg/bin/cleandb.sh >>/tmp/cleandb.log 2>&1
# Aggregate statistics for EMG Portal message reports
* * * * * /home/emg/bin/hourly_summary.pl >>/tmp/hourly_summary.log 2>&1
* * * * * /home/emg/bin/hourly_summary_connector.pl >>/tmp/hourly_summary_connector.log 2>&1
# Trigger daily report for current month
5 0 * * * wget --no-check-certificate -O - https://127.0.0.1/emgportal/cron/reportMonth >/tmp/cron_report.log 2>&1
# Trigger scheduled jobs
* * * * * wget --no-check-certificate -O - https://127.0.0.1/emgportal/cron/sendScheduled >/tmp/cron_send.log 2>&1

What's next?

You should now have a running messaging solution with server and web interface for provisioning tasks.

When using the command-line, remember to always run commands as user "emg", or file permissions may be incorrectly set.

Next steps include:

Please consult the EMG Portal documentation for some more information about EMG Portal functionality.