==========================
Preparing for installation
==========================

.. contents::
   :local:
   :depth: 1

Downloading AEN installers
==========================

Download the installers and copy them to the corresponding servers.

.. code-block:: bash

   RPM_CDN="https://820451f3d8380952ce65-4cc6343b423784e82fd202bb87cf87cf.ssl.cf1.rackcdn.com"
   curl -O $RPM_CDN/aen-server-4.2.2-Linux-x86_64.sh
   curl -O $RPM_CDN/aen-gateway-4.2.2-Linux-x86_64.sh
   curl -O $RPM_CDN/aen-compute-4.2.2-Linux-x86_64.sh

NOTE: The current $RPM_CDN server will be confirmed in an email
provided by your sales rep.

NOTE: These instructions use `curl` or `wget` to download packages, but you may
use other means to move the necessary files into the installation directory.

Gathering IP addresses or FQDNs
===============================

AEN is very sensitive to the IP address or domain name used to
connect to the server and gateway nodes. If users will be
using the domain name, you should install the nodes using
the domain name instead of the IP addresses. The authentication
system requires the proper hostnames when authenticating users
between the services.

Print this page and fill in the domain names or IP addresses of the nodes
below and record the user name and auto­-generated password for the
administrative user account in the box below after installing the
AEN server node:

+------------------+-----------------+-------------+----------+----------------+
| Node          | Name or IP address | Port Number | Username |  Password      |
+==================+=================+=============+===========================+
| AEN server    |                    |             |          |                |
+------------------+-----------------+-------------+----------+----------------+
| AEN gateway   |                    |             |          |                |
+------------------+-----------------+-------------+----------+----------------+
| AEN compute   |                    |             |          |                |
+------------------+-----------------+-------------+----------+----------------+

NOTE: The values of these IP entries or DNS entries are referred
to as ``<AEN_SERVER_IP>`` or ``<AEN_SERVER_FQDN>``, particularly
in examples of shell commands. Consider actually assigning those
values to environment variables with similar names.

Set up variables
================

Certain variables need to have values assigned to them before you
start the installation.

AEN server address
------------------

To define an environment variable for the AEN server
address---FQDN or IP:

.. code-block:: bash

    export AEN_SERVER=<AEN_SERVER_IP>  # <from table above>

NOTE: The address---FQDN or IP---specified for the AEN server
must be resolvable by your intended AEN users' web clients.

To verify your hostname, run ``echo $AEN_SERVER``.

.. _`aen-functional-id`:

AEN functional ID
-----------------

AEN must be installed and executed by a Linux account called the
AEN Service Account. The username of the AEN Service Account is
called the AEN Functional ID (NFI). The AEN Service Account is
created during AEN installation---if it does not exist---and is
used to run all AEN services.

The default NFI username is wakari. Another popular choice is
aen_admin.

To set the environment variable AEN_SRVC_ACCT to ``wakari`` or
your chosen name before installation, run
``export AEN_SRVC_ACCT="aen_admin"``.

This name is now the username of the AEN Service Account and of
the AEN administrator account.

When upgrading AEN, set the NFI to the NFI of the current
installation.

AEN functional group
--------------------

The AEN Functional Group (NFG) may be given any name. Most often, it is
set to ``aen_admin`` or ``wakari``. This Linux group includes the AEN service
account, so all files and directories that have the owner NFI also have the
group NFG.

When upgrading AEN, set the NFG to the NFG of the current
installation.

To set the NFG before installation, run:

.. code-block:: bash

    export AEN_SRVC_GRP="<NFG>"

NOTE: Replace ``<NFG>`` with your NFG name.

AEN install sudo command
------------------------

During AEN installation the installers perform various operations
that require root level privileges. By default, the installers use
the sudo command to perform these operations.

Before installation, set the AEN_SUDO_CMD_INSTALL environment
variable to perform root level operations. You can also set it to
no command at all if the user running the installer(s) has root
privileges and the sudo command is not needed or is not
available.

EXAMPLES:

.. code-block:: bash

    export AEN_SUDO_CMD_INSTALL=""
    export AEN_SUDO_CMD_INSTALL="sudo2"


AEN sudo command
----------------

By default the AEN services uses ``sudo -u`` to perform
operations on behalf of other users---including ``mkdir``,
``chmod``, ``cp`` and ``mv``.

To override the default sudo command when sudo is not
available on the system, before installing, set the AEN_SUDO_CMD
environment variable.

AEN must have the ability to perform operations on behalf
of other users. Therefore, this environment variable cannot be
set to an empty string or to ``null``.

CAUTION: Any command that replaces AEN_SUDO_CMD must support the
``-u`` command line parameter---similarly to the sudo command.

EXAMPLE:

.. code-block:: bash

    export AEN_SUDO_CMD="sudo2"

The optional environmental variable AEN_SUDO_SH is another way
to customize AEN sudo operations. When AEN executes any sudo
command, it will include the value of AEN_SUDO_SH, if it is set.

EXAMPLE: If your username is "jsmith" and the values are set as:

.. code-block:: none

   AEN_SUDO_CMD=sudo
   OWNER=jsmith
   AEN_SUDO_SH=sudologger
   PROJECT_HOME=/projects/jsmith/myproj

Then AEN will resolve:

.. code-block:: bash

   $AEN_SUDO_CMD -u ${OWNER} $AEN_SUDO_SH rm -rf $PROJECT_HOME

As:

.. code-block:: bash

   sudo -u jsmith sudologger rm -rf /projects/jsmith/myproj

In this case the sudologger utility could be a pass-through
utility that logs all sudo usage and then executes the remaining
parameters.

Post-installation Sudo configuration
------------------------------------

While root/sudo privileges are required during installation,
root/sudo privileges are not required during normal operations
after install, if user accounts are managed outside the software.
However root/sudo privileges are required to start the services,
thus in the service config files there may still need to be an
AEN_SUDO_CMD entry.

For more information, see :doc:`config/config-sudo-customizations`.


AEN remote database settings
----------------------------

By default AEN server uses a local database.
To override the default database location, see :doc:`config/config-remote-mongodb`.


What's next
===========

:doc:`Install the AEN server <install-server-node>`.
