==================================
Installing on an air gapped system
==================================


These instructions are for installation on air gapped systems or
other machines that do not have access to the internet. The air
gap archives contain installers, dependencies and packages to
mirror.

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

Before you start
=================

Your server must meet the requirements for hardware, software,
security and network. Please review and verify that you have met
all :doc:`system requirements <requirements>` before beginning
your installation.

.. _download-mirror-archive:

Download the installers archive and the appropriate mirrors
archive for your needs. The :doc:`airgap-archive` page lists the
archives and their contents.

NOTE: These installation instructions assume the air gap media is
available on the target server at $INSTALLER_PATH.

EXAMPLE::

  tar xf <installer-archive> -C /installer/
  export INSTALLER_PATH=/installer/anaconda-enterprise-`date +%Y-%m-%d`


Also download and expand the archive of conda packages you plan to
mirror. These instructions assume packages are expanded to
$INSTALLER_PATH::

  tar xf <archive-of-pkgs-to-mirror> -C /installer/
  export MIRRORS_ARCHIVE=/installer/repo-mirrors-`date +%Y-%m-%d`

.. toctree::
   :maxdepth: 1
   :hidden:

   airgap-archive


.. include:: common.rst
   :start-after: S_HEADING_MONGO
   :end-before: E_HEADING_MONGO


Change the directory to the appropriate ``rpms*`` directory to
find dependencies::

  cd $INSTALLER_PATH/rpms*x/

.. include:: common.rst
   :start-after: S_MONGO_INSTALL
   :end-before: E_MONGO_INSTALL

.. begin 2. Anaconda Repository admin account

.. include:: common.rst
   :start-after: S_AER_ADMIN_ACT
   :end-before: E_AER_ADMIN_ACT

.. begin 3. Install Repository section

.. include:: common.rst
   :start-after: S_HEADING_INSTALL
   :end-before: E_HEADING_INSTALL

Install Repository, following the prompts in the installation
routine::

    bash $INSTALLER_PATH/anaconda_repository-*-linux-64.sh

NOTE: Path should have only one installer that is for the latest
stable version of Repository.

.. include:: common.rst
   :start-after: S_AER_INSTALL
   :end-before: E_AER_INSTALL

.. Sections 4, 5, 6, 7, 8

.. include:: common.rst
   :start-after: S_AER_SECTIONS_45678
   :end-before: E_AER_SECTIONS_45678

.. begin section 9. Mirror Anaconda and Miniconda

.. include:: common.rst
   :start-after: S_HEADING_MIRROR_CONDA
   :end-before: E_HEADING_MIRROR_CONDA

.. begin code to mirror installers

Define URL for miniconda installers::

    URL="file://$INSTALLER_PATH/conda/"

NOTE: Air gap archive only contains the latest version of both
Miniconda and Anaconda installers.

.. include:: common.rst
   :start-after: S_GET_MINICONDA
   :end-before: E_GET_MINICONDA

Download Anaconda installers.

.. include:: common.rst
   :start-after: S_GET_ANACONDA
   :end-before: E_GET_ANACONDA


.. Section 10

.. include:: common.rst
   :start-after: S_HEADING_MIRROR_CHANNELS
   :end-before: E_HEADING_MIRROR_CHANNELS

Since we are mirroring from a local file system, some additional
configuration is necessary. The steps are the same for each
channel:

#. Create a mirror configuration ``yaml`` typically stored in
   ``$PREFIX/etc/anaconda-server/mirror/``.

#. :doc:`Customize your mirror
   <config/mirrors/customize-mirror>`. An example is if you only
   need to mirror packages for a subset of platforms. By default,
   it mirrors all packages found in the channels linux-64,
   osx-64, win-64, win-32 and linux-32.

#. Invoke the mirror command by pointing it to the config file::

     echo "channels:" > ~/repo/etc/anaconda-server/mirror/conda.yaml
     echo " - file://$MIRRORS_ARCHIVE/anaconda-suite/pkgs" >> \
            ~/repo/etc/anaconda-server/mirror/conda.yaml

#. Mirror the default Anaconda packages::

     anaconda-server-sync-conda --mirror-config ~/repo/etc/anaconda-server/mirror/conda.yaml

:doc:`config/mirrors/mirror-anaconda-repository` contains
documentation and advanced ``yaml config`` for mirroring other
channels.
