We strongly recommend installing EMG 7.1 and EMG Portal 3 on CentOS 7 instead. Read more
This document describes the steps involved to install a complete EMG platform with
running in CentOS 6, released in October 2014 (end of support, November 30, 2020).
CentOS 6.6 provides
- Apache 2.2.15
- PHP 5.3.3
- MySQL 5.1.73
through the default yum repositories which meet the EMG Portal requirements well.
We will install on Centos 6.6 (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.
Basic OS installation and configuration
- Download and install CentOS 6.6 (64-bit). We choose the "minimal" distribution,
- After installation, login as "root"
- Consider disabling SELinux, at least during the installation,
Run a "yum update" to ensure all packages are up to date and if any kernel packages were updated reboot the server
Install some additional required packages
Create user "emg" and assign a good password to the new account. Consider having a strong password generated, for example using https://strongpasswordgenerator.com/
Consider limiting ssh access to specific users by adding "AllowUsers emg" to /etc/ssh/sshd_config
Consider synchronizing server time with NTP servers
- Start services and secure the mysql installation by setting a root password etc
Set the default timezone in php.ini. In the distributed php.ini there is a line ";date.timezone =" which should be replace with "date.timezone = 'Europe/Stockholm'" or whichever timezone is correct for you, check http://php.net/manual/en/timezones.php for more information.
We are now ready to install and configure EMG
- Request an eval license key via http://www.nordicmessaging.se/icablic-confirm
- Login as "root"
- Download latest EMG 6 (Linux 64-bit) "Full distribution" via http://www.nordicmessaging.se/download/overview/download-index.html using download username / password from the eval license key email
- Specify newly created user "emg" for user and group, "/home/emg/etc" for configuration files, "/home/emg/bin" for executables plus your eval license information.
- Add "export EMGDIR=$HOME/etc" to the end of bash profile script
- Login as "emg"
- Replace default EMG configuration file with the EMG dbconfig configuration file
- Create EMG database and schema, but first edit the script to set a secure password, preferably generated
- Edit server.cfg file and change the database credentials to match the above in the DATABASE section
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.
Download and extract EMG perl distribution as user "root"
Install some required CPAN modules. When running the cpan command the first time you need to hit enter a couple of times to accept configuration.
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.
- Login as "emg"
Some more CPAN modules are required. You may need to hit enter multiple times during the installation.
Copy the sample watchdog script
- Go through the "Configuration variables" section in the watchdog script and change it to match your environment. More specifically make sure the following are set to relevant values:
- @notify_recipients - E-mail address(es) to which watchdog should send e-mail notifications
- $mail_from - Sender address ("From") for e-mail notifications
Start the EMG watchdog by running the command below. You should receive an e-mail notification when the watch has started if all went ok.
- Login as "root"
Ensure EMG watchdog is started automatically on system boot.
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.
As user "root", open firewall to allow https (port 443) and optionally http (port 80) connections in firewall and start httpd service. We recommend using https only since communication will then be protected by SSL encryption. However, if you use the default self-signed SSL certificate the visting browser will throw a warning when accessing the page. Installation of a proper certificate signed by a trusted CA is therefore strongly recommended.
Download the ionCube loader wizard from http://www.ioncube.com/loaders.php and install it by placing the installer wizard in /var/www/html and point your browser to . Follow the instructions and remember to delete the loader files in web directory after completing the loader installation.
- Download the current 30-day eval as user "root". You will end up with a file named something similar to emgportal-1.6-38876-ioncube-20140725.tar.gz
Modify .htaccess to use the right sub-uri by uncommenting "#RewriteBase /emgportal"
Configure apache by copying emgportal.conf to apache config directory and restart httpd servce
If you access the EMG Portal installer from a remote computer you will need to add your IP address to AUTHORIZED_IPS variable on line 3 in the installer file.
Now you should be able to point your browser to your serverand see the EMG Portal installer.
- After finishing the installer you need to remove installation directory and secure config files
- As a final step you should check the main config file for any settings you want to customize especially the "baseUrl", "adminEmail" and "emailReportCopy" settings. You can also define your own layout file and point to it through the "layout" setting.
- You should now be able to log in to EMG Portal as the web user you specified during installation.
- In EMG Portal under "Dashboard" -> "System settings" on the bottom of the page under "EMG Server(s)" add "3000" as the "Watchdog port" on the first line and save.
You should now see "EMG watchdog: Enabled - Running" on the "Dashboard".
Finish EMG installation
You need to copy the billing plugin from EMG Portal distribution into the EMG etc directory.
- Copy the file as "emg" user and update database credentials in the file
As user "root", open firewall for incoming SMPP connections. In server.cfg there is an incoming SMPP connector listening on port 2775 but we have yet to allow inbound connections on that port
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.
Extract from "crontab -l -u emg" on a running server:
There is a sample script "cleandb.sh" in the /home/emg/bin directory. The "hourly_summary.pl" 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.
Then add crontab entries from above
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:
- Set up routing (we recommend adding a default route)
- Set up pricing (we recommend adding a default price)
- Provision customer accounts
- Remember to open firewall if you add new inbound connectors
- Consider adding a proper SSL certificate to protect your site and for increased customer trust
Please consult the EMG Portal documentation for some more information about EMG Portal functionality.