Installation
============

Anaconda Adam can be used to install the Anaconda platform, including multiple
nodes or virtual machines.

Refer to the :doc:`requirements` page for more information about system
requirements, including networking and security requirements.

.. contents::
   :local:
   :depth: 2

1. Download Adam
----------------

Download the installer to the host machine where you want to manage the Anaconda
platform:

.. code-block:: bash

    $ wget https://anaconda.org/anaconda-adam/adam-installer/4.2.13/download/adam-installer-4.2.13-Linux-x86_64.sh

or:

.. code-block:: bash

    $ curl -LO https://anaconda.org/anaconda-adam/adam-installer/4.2.13/download/adam-installer-4.2.13-Linux-x86_64.sh

2. Run the Installer
--------------------

Run the installer, and specify the destination directory (e.g., ``~/adam``):

.. code-block:: bash

    $ bash adam-installer-4.2.13-Linux-x86_64.sh -b -p ~/adam

Add the ``adam`` command to your path by modifying ``~/.bashrc``:

.. code-block:: bash

    $ echo -e '\n# Anaconda Adam\nexport PATH=~/adam/bin:$PATH' >> ~/.bashrc

Source your ``~/.bashrc`` file to activate the changes:

.. code-block:: bash

    $ source ~/.bashrc

Run the ``adam`` command to verify that the installation succeeded and to create
configuration files in ``~/.continuum/adam``:

.. code-block:: none

    $ adam
    Usage: adam [OPTIONS] COMMAND [ARGS]...

    Options:
      --version                       Show the version and exit.
      -l, --log-level [info|debug|error]
                                      Logging level  [default: debug]
      -h, --help                      Show this message and exit.

    Commands:
      cmd                   Execute a command on the nodes
      describe              Describe an Adam cluster or profile
      ec2                   EC2 options
      enterprise-notebooks  Anaconda Enterprise Notebooks options
      info                  Display Adam version, system, and license information
      jupyter               Jupyter options
      kubernetes            Kubernetes options
      list                  List Adam clusters and profiles
      platform              Anaconda Platform options
      provision             Provision options
      remove                Remove a cluster
      repository            Anaconda Repository options
      salt                  Execute a Salt module
      scale                 Anaconda Scale options
      ssh                   SSH to one of the nodes (0-based index)
      up                    Create a cluster from a profile

3. License File (Optional)
--------------------------

If you have an Anaconda Enterprise license file, you can copy it to the
``~/adam/licenses`` directory. Anaconda Adam will search this directory for
license files named ``license*.txt``, e.g.,
``~/adam/licenses/license_bundle_20160524191753.txt``.

TIP: In addition to ``~/adam/licenses/``, Adam checks for license files in
``~/.continuum/`` and the other directories shown by the command
``~/adam/bin/conda info --license``, so you may place the license file in any of
these directories.

4. Define Cluster Profile
-------------------------

Create a cluster profile at ``~/.continuum/adam/profile.d/profile.yaml``
with the following contents:

.. code-block:: yaml

    name: profile
    provider: bare

    bare:
      username: centos
      # password: password  # Optional
      port: 22
      keypair: ~/.ssh/my-private-key
      nodes:
      - host: node1.company.com
      - host: node2.company.com
      - host: node3.company.com
      - host: node4.company.com

    security:
      flush_iptables: false
      selinux_context: false
      selinux_permissive: false

In the profile, edit the ``username``, SSH ``port``, and IP addresses or
hostnames of the ``nodes`` in the cluster. The first node in the list of
``nodes`` will be defined as the head node, and the remaining nodes will be
defined as compute nodes.

Each host should be able to connect to the other hosts via the specified FQDN or
IP address. It is recommended that you use the FQDN of the nodes that matches
the hostname on each machine.

You will need to specify the location of your private SSH key (``keypair``) to
use. Verify that you have SSH access to all of the cluster nodes, and that the
specified ``username`` has sudo privileges.

By default, the ``anaconda`` user/group will be created across the cluster and
will own the directory and files located in the root installation directory
(default: ``/opt/continuum/``). You can customize these settings in the cluster
profile (refer to the :doc:`install-advanced` documentation).

You can also enable the various ``security`` settings depending on your cluster
setup.

Refer to the :doc:`install-advanced` page for more information about advanced
configuration options for Anaconda Adam and Anaconda platform components.

5. Create Cluster
-----------------

Create your cluster by specifying the name of the cluster and the profile name.
For example, to create a cluster named ``cluster`` from a profile named
``profile``:

.. code-block:: bash

    $ adam up -n cluster profile

6. Install Platform Components
------------------------------

After creating a cluster, you can install platform components using
``adam <platform-component> install``:

.. code-block:: bash

    $ adam repository -n cluster install
    $ adam enterprise-notebooks -n cluster install
    $ adam scale -n cluster cluster install
    $ adam scale -n cluster dask install

7. Access Platform Components
-----------------------------

After the platform component installations complete, you can open the platform
components interface in your browser using ``adam <platform-component> open``:

.. code-block:: bash

    $ adam repository -n cluster open
    $ adam enterprise-notebooks -n cluster open

Refer to the :doc:`getting-started` page for more information about using
the Anaconda platform components.
