Install script for Linux and Mac

Script installation guide for Linux and Mac

August 26th, 2021


An automatic installation script is available for Linux and Mac. This script is interactive and will:

  • Create a user for Mango to run under (Linux only)
  • Create a H2 or MySQL database
  • Download and extract the Mango zip file to your chosen installation directory
  • Create a pre-configured env.properties file in overrides
  • Create a self-signed SSL/TLS certificate
  • Register a systemd service so Mango starts at boot (Linux only)

Requirements

  • Your operating system is Linux or macOS
  • Java JDK 11 is installed and at least one of the following two conditions is
    true:
    • JAVA_HOME environment variable points to the JDK installation directory
    • The JDK bin directory is available on your path (specifically the java, keytool, and jar commands are
      available)
  • (MySQL only) The mysql client is available on the path and the admin/root user can run SQL without a password
    • You can configure the username and password for the admin/root user via a
      .mylogin.cnf file
    • This user will be used to create a new database and user for Mango
    • Note: If you run the install script using sudo, ensure you place the config file in /root

Instructions

You must run the script as root. If you have any reservations about doing so, please see our manual installation instructions for your operating system.

Download the script

      curl -o install-mango.sh https://raw.githubusercontent.com/MangoAutomation/ma-core-public/main/Core/bin/install-mango.sh

Run the script

If logged in as root:

sh install-mango.sh

Using sudo to run the script as root:

sudo sh install-mango.sh

Answer the prompts

The script will prompt you to enter details about where to install Mango, which version of Mango to install etc. Hit enter and accept the default option shown inside the square brackets [default]. Yes/no answers must be written as ‘yes’ or ‘no’, ‘y’ or ‘n’ are not sufficient. (For macOS you must choose an existing user as the Mango User since the useradd command isn't available.)

Advanced options

You can automate the script by providing answers to the prompts using environment variables. e.g.

MA_HOME=/opt/mango MA_USER=mango MA_DB_TYPE=h2 MA_VERSION=4.0.0 sh install-mango.sh

Environment variables

  • MA_HOME — The directory in which to install Mango
  • MA_DATA — The directory in which Mango will store its data
  • MA_USER — The OS username under which Mango will run (will be created if user doesn't exist)
  • MA_SERVICE_NAME — The systemd service name which will be installed [mango]
  • MA_DB_TYPE — The SQL database type for the installation [h2/mysql]
  • MA_DB_NAME — The SQL database name which will be created [mango]
  • MA_DB_USER — The SQL database username for Mango [mango]
  • MA_DB_PASSWORD — The SQL database password for Mango user [auto-generated]
  • MA_DB_HOST — The SQL database hostname [localhost]
  • MA_DB_PORT — The SQL database port number [3306]
  • MA_DB_CREATE — Whether to create database and user (MySQL only) [yes/no]
  • MA_CONFIRM_DROP — Confirms that the SQL DB should be dropped (MySQL only) [yes/no]
  • MA_CONFIRM_DELETE — Confirms that the contents of the installation directory can be deleted [yes/no]
  • MA_CORE_ZIP — Path to an installation zip file to use instead of downloading one
  • MA_VERSION — The version of Mango to install e.g. 4.0.0 or 3.7.7

Copyright © 2024 Radix IoT, LLC.