# Installing Exago on Linux

The following article walks through the installation process for Linux systems.

# Supported distros

- Red Hat Enterprise Linux 7+
- SUSE Linux Enterprise Server 12+
- CentOS 7+
- Fedora 21+
- Debian 8+
- Ubuntu 14+

# Requirements

- mono 4.0+

## Apache 2.4+

- mod-mono

## Nginx

- mono-fastcgi-server4

Optional:

- mono-basic, which provides support for VB.NET

Note: The Exago installer can automatically download and install supported versions of mono and mod-mono. Apache or Nginx must be installed prior to installing Exago.

WARNING: Exago is incompatible with SELinux.

# Installation

The Exago Linux Installer can be used to install the Exago Web Application, Web Service API, and Scheduler Service. It can also install mono and mod-mono. Use the following steps to install Exago on Linux.

Note: Apache or Nginx must be installed prior to installing Exago.

Navigate to the Downloads page, select a build, and then use the Linux Download option. Decompress the download:

    tar zxvf ExagoInstaller_vX.X.X.X.tgz

Then run `installExago.sh` as root:

    sudo ./installExago.sh

The installer can be run in guided or silent mode. The Linux distribution and the type and version of web server software will be detected automatically.

### Silent Installation with Parameters

Usage:

    [-d <install path>] [-m <TRUE|FALSE>] [-i <WEBAPP|WEBAPI|SCHEDULER>] [-y] [-h]

-d <Install Path> | Default is `/opt/Exago`
-m <TRUE|FALSE> | Whether or not to install Mono
-i <WEBAPP|WEBAPI|SCHEDULER> | Which component(s) to install
-a <Web App URL Alias> | Default is `/Exago`
-s <Web Service URL Alias> | Default is `/ExagoWebApi`
-y | Do not prompt for final verification before installing
-h | Show this help screen

### Guided Installation

Specify an install path when prompted. Default is `/opt/Exago`.

If the proper versions of mono (and mod-mono) are not present in your distribution's package repository then the Exago installer can be used to download and install the correct versions. If so, the mono repositories will be added to the package manager's repository list so that they can be updated in the future.

Select which components to install:

1. Web Application
2. Web Service API
3. Scheduler Service

Note: It is possible to install any components at a later time by running `installExago.sh` again.

See either Apache or Nginx for web server configuration details.

# Apache

If Apache is detected, the installer will additionally do the following:

- Download and install mod-mono, if it is not already present.
- Generate an Apache configuration file `exago.conf` in the Apache site path.
- Set read/write permissions for the current Apache user on the install paths.
  - Config - Permissions and path set automatically
  - Temp - Requires read and write permissions
  - Reports - Requires read and write permissions
  - MapCache - Requires read and write permissions

See Folder Configuration to continue with the installation.

# Nginx

Nginx proxies incoming and outgoing requests to a running instance of Exago using a fastcgi module that is installed during the installation process.

mono-fastcgi-server4 is a prerequisite for Exago to run on Nginx. The installer will not download this automatically, so be sure to install it beforehand. (Some distributions may include it by default).

## Run Exago at Startup

Two Exago scripts created during installation need to be started manually or configured to run at startup:

    <Web App Install Dir>/bin/startExago.sh
    <Web Service Install Dir>/bin/startWebService.sh

### Example

Note: These steps are applicable for Ubuntu and Debian. They may differ for other distributions.

Link the scripts to `/etc/init.d`:

    sudo ln startExago.sh /etc/init.d/startExago.sh
    sudo ln startWebService.sh /etc/init.d/startWebService.sh

Make them executable:

    sudo chmod 775 /etc/init.d/startExago.sh
    sudo chmod 775 /etc/init.d/startWebService.sh

Add the necessary symbolic links:

    sudo update-rc.d /etc/init.d/startExago.sh defaults
    sudo update-rc.d /etc/init.d/startWebService.sh defaults

Then restart the server. Check that the scripts will run on startup:

    sudo service --status-all | grep start

Output should include the following:

    [ - ] startExago.sh
    [ - ] startWebService.sh

Finally, check that Exago is running:

    ps aux | grep Exago

Output should include (something like) the following:

    ... /usr/bin/mono /usr/lib/mono/4.5/fastcgi-mono-server4.exe /applications=/Exago/:/opt/Exago ...

    ... /usr/bin/mono /usr/lib/mono/4.5/fastcgi-mono-server4.exe /applications=/ExagoWebApi:/opt/Exago/WebServiceApi ...

## Configure Nginx

The required configuration is created in a separate site file located at `/etc/nginx/sites-available/exago`. The site file is not enabled by default.

### Example

    server {
            listen 80;
            listen [::]:80;
            server_name _;
            root /var/www;

            location /<Web App Alias>/ {
                    include /etc/nginx/fastcgi_params;
                    root <Web App Install Dir>;
                    access_log /var/log/nginx/exago.log;
                    fastcgi_param SERVER_NAME $host;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_param PATH_INFO "";
                    fastcgi_pass 127.0.0.1:9000;
            }
    }

To enable the site file, link it to `/etc/nginx/sites-enabled`:

    sudo ln /etc/nginx/sites-available/exago /etc/nginx/sites-enabled/exago

Or include the configuration in another running site configuration file.

Note: Make sure that the default port does not conflict with another running site. If it does, you will see a warning when reloading Nginx:

    nginx: [warn] conflicting server name "Exago" on 0.0.0.0:80

Then reload Nginx to refresh the configuration:

    sudo nginx -s reload

See Folder Configuration to continue with the installation.

# Folder Configuration

The Config sub-folder of the Exago installation has read and write permissions set by default and the default path `/opt/Exago/Config` is preferred.

Create a folder for storing reports. This folder needs to be accessible from the web server, but is not required to be on the web server. The report folder can reside on any server accessible by Exago, provided a mount point is accessible on the Exago server.

IMPORTANT. Do not create the reports folder within the Exago application structure. This can cause sessions to crash when report folders are created or deleted within Exago.

1. Set the Report folder's read and write permissions to 775.

       sudo chmod 775 Reports

2. (Apache) Set the default ownership to the specific <apache user>:<apache group>
3. Specify the location of the Report Folder in the "Report Path" setting in the Admin Console:
   ( Main Settings ) Report Path

Note: The group ownership on the reports directory is not mandatory, and can be changed to have other group ownership as needed for access outside of Exago.

Default UMASK for files written by Exago is 027 and can be changed by updating the MonoUnixUmask option in the generated `exago.conf` Apache configuration file.

The recommended path for the Temp folder is `/opt/Exago/Temp`.

1. Set the Temp folder’s read and write permissions to 775.

       sudo chmod 775 /opt/Exago/Temp

2. (Apache) Set the default ownership to <apache user>:root
3. Specify the location of the Temp Folder in the Temp Path setting of the Admin Console:
   ( Main Settings ) Temp Path

Set the MonitoringService folder's read and write permissions for the Apache user to 775, and set the default ownership to <apache user>:root.

# Scheduler and Monitoring Services

If necessary, configure the Scheduler and Monitoring services to run at startup.

First see Scheduler Configuration and Setting Up Monitoring to configure the services correctly.

Then do the following for Ubuntu or Debian. (This may differ for other distributions).

Add the following scripts to `/etc/init.d`:

### Scheduler

    sudo vi /etc/init.d/startScheduler.sh

Add the following lines, then save the file:

    #!/bin/bash
    mono-service /opt/Exago/Scheduler/eWebReportsScheduler.exe

### Monitoring

    sudo vi /etc/init.d/startMonitoring.sh

Add the following lines, then save the file:

    #!/bin/bash
    mono-service /opt/Exago/MonitoringService/Monitoring.exe

Make them executable:

    sudo chmod 775 /etc/init.d/startScheduler.sh
    sudo chmod 775 /etc/init.d/startMonitoring.sh

Add the necessary symbolic links:

    sudo update-rc.d /etc/init.d/startScheduler.sh defaults
    sudo update-rc.d /etc/init.d/startMonitoring.sh defaults

Then restart the server. Check that the scripts will run on startup:

    sudo service --status-all | grep start

Output should include the following:

    [ - ] startScheduler.sh
    [ - ] startMonitoring.sh

Finally, check that they are running:

    ps aux | grep Exago

Output should include (something like) the following:

    ... /usr/bin/mono /usr/lib/mono/4.5/mono-service.exe /opt/Exago/Scheduler/eWebReportsScheduler.exe ...

    ... /usr/bin/mono /usr/lib/mono/4.5/mono-service.exe /opt/Exago/MonitoringService/Monitoring.exe ...