Updated: 14 Nov 2019
Current for: Mango 3.6.6

Linux is the preferred operating system for running Mango in production environments. Mango works on a wide variety of Linux distributions and architectures.

Please note that we also provide an installation script which will download and configure Mango for you, these instructions are manual instructions for users who are familiar with Linux.

Requirements

  • Java JDK is installed and either

    • JAVA_HOME environment variable points to the JDK installation directory

    • The JDK bin directory is available on your path (specifically the java command is available)

Installation

These instructions assume that you will install Mango as root, you should switch to the root user or prefix the commands with sudo. If you do not have root access you can still install Mango under your home directory and run it as yourself.

Create an installation directory

mkdir /opt/mango

Set a system wide MA_HOME environment variable (recommended but not required)

echo 'MA_HOME=/opt/mango' >> /etc/environment

Create a user for Mango

You should create a user for Mango to run under. Never run Mango as root.

useradd --system --home-dir /opt/mango --shell /bin/false mango

Download Mango

Download a full core zip file from the Infinite Automation store. Copy the zip file to your home directory.

Extract the zip file to the installation directory

You will need the unzip package installed to extract the zip file. e.g. for Debian/Ubuntu

apt-get install unzip

Extract the zip file

unzip enterprise-m2m2-core-3.6.6.zip -d /opt/mango

Set the correct owner on the installation directory

chown -R mango:mango /opt/mango

Configure Mango

Copy the env.properties file into overrides

cp /opt/mango/classes/env.properties /opt/mango/overrides/properties/

Edit env.properties and configure Mango, see the installation configuration page for more details.

nano /opt/mango/overrides/properties/env.properties

Configure Java options for starting Mango

You can set Java command line options such as memory limits, debug options, garbage collection settings etc by copying the start-options.sh script into the overrides directory.

cp /opt/mango/scripts/start-options.sh /opt/mango/overrides/

You can then edit the /opt/mango/overrides/start-options.sh file and un-comment lines to configure various Java command line options.

Note: Configuring these settings was previously accomplished via the start extensions (ext-enabled directory), as of Mango 3.6.6 and when using the start-mango.sh script these extensions are no longer user.

Manually starting and stopping Mango

At this point you can manually start Mango, however we recommend you install a service instead (see below). To manually start Mango:

sudo -u mango /opt/mango/bin/start-mango.sh > /dev/null &

To manually stop Mango:

kill $(cat /opt/mango/bin/ma.pid)

Note: Never run Mango as root, this is a security risk and will also result in files in /opt/mango having the incorrect owner. If you do accidentally run Mango as root, stop Mango and run:

chown -R mango:mango /opt/mango

Installing Mango as a service

We recommend installing Mango as a systemd service so that it starts at system startup. Most modern Linux distributions use systemd.

cp /opt/mango/bin/mango.service /etc/systemd/system/

You may wish to edit the service file if you have used a different installation directory or user than the instructions above. Default mango.service file contents:

[Unit]
Description=Mango Automation
After=mysqld.service
StartLimitIntervalSec=0

[Service]
EnvironmentFile=/etc/environment
Type=forking
WorkingDirectory=/opt/mango
PIDFile=/opt/mango/bin/ma.pid
ExecStart=/opt/mango/bin/start-mango.sh
SuccessExitStatus=0 SIGINT SIGTERM 130 143
Restart=always
RestartSec=5s
User=mango
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

Now enable the service:

systemctl enable mango

To stop/start/restart the Mango service

systemctl stop mango
systemctl start mango
systemctl restart mango

To get the Mango service status

systemctl status mango