==================================
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

9. OPTIONAL: Mirror installers for Anaconda and Miniconda
=========================================================

Miniconda and Anaconda installers can be served by Repository
via the static directory located at
``/home/anaconda-server/repo/opt/anaconda-server/installers``.
To serve up the latest installers for each platform, copy them from your
:doc:`air gap archive <airgap-archive>` to this directory.::

  cp Miniconda-latest-Linux-x86_64.sh /home/anaconda-server/repo/opt/anaconda-server/installers

Replace ``Miniconda-latest-Linux-x86_64.sh`` with your Anaconda or Miniconda installer name.

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

Users can download the installers using curl from following URL::

  # Fill in server name, port, and specific installer for your platform
  curl -s -O http://your.anaconda.repository:8080/downloads/Miniconda-latest-Linux-x86_64.sh

NOTE: Replace ``your.anaconda.repository`` with the IP address or domain name of your repository.


.. 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.
