# Installing Flux

This guide describes the installation procedure for Flux on both Windows and Unix / Linux Operating Systems.

# Windows

To install Flux on Windows, follow these steps:

1. Download and install the Flux package to your system. This can be done in one of two ways:
1. Download and run the EXE installer (following the on-screen instructions where prompted by the installer), or
2. (If you are installing Flux from the ZIP archive) Navigate to the Flux directory and edit the file setenv.bat located there. Find the line:

set JAVA_HOME=<Java home>

Make sure that <Java home> is set to one of the following:
1. The location of your Java installation directory (like C:\path\to\java), or
3. (If you are installing Flux from the ZIP archive) While in the Flux directory, run the configure.bat script. This script will configure all of the files necessary for Flux to launch the Operations Console web application.
4. (If this is not an evaluation version of Flux) Install the license key as described in License Keys.
5. (Optionally) Follow the steps described in Configuring Flux to Run with Databases to connect Flux to your enterprise database.

That's it! Flux is now installed and ready to run using the .bat scripts included in the Flux installation directory. There, you can find scripts for starting unsecured engines, secured engines, The Flux Designer, and the Flux Operations Console (the Flux web application).

If this is your first time using Flux, the quick start guides located in /doc/quick_start_guides under your Flux installation directory are a great place to get started learning about Flux, and the best ways to use and interact with each of its components.

## Installing Flux as a Windows Service

NOTE: If you have installed Flux using the EXE installer, you will find three services automatically installed: a secured engine service, an Operations Console (web application) service, and a Flux agent service.

.bat scripts for installing Windows services are included in /service/windows under your Flux installation directory. To install a particular Flux component as a service, simply navigate to this directory and run the installation script for that service (for example, to install the unsecured engine service, you would run the install-unsecured-flux-engine-service.bat script).

In addition, each service includes a .conf file for configuring the service. These .conf files provide information like the location of the engine configuration file (for engine service scripts), and the name and location of the wrapper log file where standard out and standard error from the service will be directed.

These .conf files also specify the name and description of the services as they will appear in the Windows service console. You can change this information by editing the following lines in the file:

wrapper.ntservice.name=
wrapper.ntservice.displayname=
wrapper.ntservice.description=

### Installing the Flux Agent as a Windows Service

To install the Flux agent as a service, you must first edit the .conf (configuration) file for the agent service to point to the correct engine. The configuration settings for agents are supplied in the lines that look like:

wrapper.app.parameter.<number>=<value>

Each configuration option is supplied on two lines; the first line specifications the name of the configuration property (with a "-" symbol before the property name), while the second line specifies the value. So, for example, to specify the configuration file that should be used to configure the agent, you could set:

wrapper.app.parameter.4=-configurationfile
wrapper.app.parameter.5=<path/to>/agent-config.properties

The numbers on these lines are sequential, so if you add or remove a configuration option, it is necessary to update the numbers for all of the subsequent wrapper.app.parameter.<number> values to remain in order.

You will need to supply the same set of parameters for both the "start" and "dispose" commands for the agent. Your configuration file will end up containing parameters that look something like:

wrapper.app.parameter.1=flux.Main
wrapper.app.parameter.2=4
wrapper.app.parameter.3=agent-server
wrapper.app.parameter.4=-configurationfile
wrapper.app.parameter.5=<path/to>/agent-config.properties
wrapper.app.parameter.6=start

wrapper.app.parameter.7=flux.Main
wrapper.app.parameter.8=true
wrapper.app.parameter.9=4
wrapper.app.parameter.10=agent-client
wrapper.app.parameter.11=-configurationfile
wrapper.app.parameter.12=<path/to>/agent-config.properties
wrapper.app.parameter.13=dispose

Next, you'll want to edit your agent configuration file (agent-config.properties) according to the configuration settings in Flux Agents. You may, for example, need to edit the file to specify a host where the engine is running, a username / password to connect to the engine, port usage settings, or other configuration options.

Once the configuration is set, you can install the agent service by running install-flux-agent-service.bat.

# Unix / Linux

To install Flux on Unix or Linux, follow these steps:

2. (If your environment does not have a JAVA_HOME system enviroment variable set) Navigate to the Flux directory and edit the file setenv.sh located there. Find the lines:

#JAVA_HOME=$JAVA_HOME #export JAVA_HOME Remove the "#" symbol from the start of each line, and change the$JAVA_HOME parameter to the location of your Java installation. This might look something like:

JAVA_HOME=/path/to/java/home
export JAVA_HOME

3. Edit the /etc/hosts file on the system as described in Installing License Keys on Unix / Linux.
4. (If this is not an evaluation version of Flux) You should have a license key file for your version of Flux (if you don't, contact support@fluxcorp.com to request one). Install the license key as described in License Keys.
5. (Optionally) To enable persistent storage of flow charts and data, follow the steps described in Configuring Flux to Run with Databases to connect Flux to a database.

That's it! You are now ready to run Flux using the .sh scripts included in the Flux installation directory. There, you can find scripts for starting unsecured engines, secured engines, The Flux Designer, and the Flux Operations Console (the Flux web application).

If this is your first time using Flux, the quick start guides located in /doc/quick_start_guides under your Flux installation directory are a great place to get started learning about Flux, and the best ways to use and interact with each of its components.

## Installing Flux as a Unix or Linux Service

You can find .sh scripts for several Flux services (unsecured engine, secured engine, web application, and agent) located in /service/unix under your Flux installation directory.

These scripts can be installed as service using standard techniques for your particular Operating System. If you are not familiar with the service installation procedure for your OS, you may find the following link useful:

### Installing the Flux Agent as a Unix or Linux Service

Before you can install the Flux agent as a service, you will need to edit the script (flux-agent.sh) to correctly locate your Flux engine.

To do so, locate the following two lines in the file:

nohup su $USERNAME -c "$JAVA_CMD flux.Main agent-server -configurationfile <path/to>/agent-config.properties start" &
su $USERNAME -c "$JAVA_CMD flux.Main agent-client -configurationfile <path/to>/agent-config.properties dispose"

Next, you'll want to edit your agent configuration file (agent-config.properties) according to the configuration settings in Flux Agents. You may, for example, need to edit the file to specify a host where the engine is running, a username / password to connect to the engine, port usage settings, or other configuration options.

Once this file has been appropriately modified, install the agent service as described above.

# Installing Flux in an Application Server

You can install Flux as a servlet in an application container as well. For more information, see the /examples/software_developers/servlet directory under your Flux installation directory. This example directory includes sample code for creating Flux as a servlet, as well as a script to package the servlet as a WAR file (which you can then deploy to your application server using standard techniques for that container).

This method of installation is recommended for advanced users only and requires knowledge of Java code for configuring and creating the Flux engine.