.. _bundled-installers:

======================
Customizing installers
======================


Anaconda Enterprise 4 Repository can distribute copies of the Anaconda Distribution installer
and the Miniconda installer that are pre-configured to use your
installation of Repository.

This applies to Anaconda Distribution version 4.1 and higher, and Miniconda
version 4.1.11 and higher.

By default the installers will be stored in
``$PREFIX/opt/anaconda-server/installers``. If you prefer to store the
installers in a different location, configure a new path::

    anaconda-server-config --set INSTALLER_DIR /preferred/directory

.. note::
    
    Replace ``/preferred/directory`` with the path to the directory where you prefer to store the installers.

If necessary, edit the script below and replace ``"5.2.0"`` with the current version number.

To download the installers:

.. code:: bash

    mkdir -p /tmp/extras
    pushd /tmp/extras

    URL="https://repo.anaconda.com"

    version="5.2.0"
    miniconda="Miniconda3-latest-Linux-x86_64.sh \
        Miniconda3-latest-MacOSX-x86_64.sh \
        Miniconda3-latest-Windows-x86.exe \
        Miniconda3-latest-Windows-x86_64.exe \
        Miniconda-latest-Linux-x86_64.sh \
        Miniconda-latest-MacOSX-x86_64.sh \
        Miniconda-latest-Windows-x86.exe \
        Miniconda-latest-Windows-x86_64.exe"
    anaconda="Anaconda2-$version-Linux-x86_64.sh \
        Anaconda3-$version-Linux-x86_64.sh \
        Anaconda2-$version-MacOSX-x86_64.sh \
        Anaconda3-$version-MacOSX-x86_64.sh \
        Anaconda2-$version-MacOSX-x86_64.pkg \
        Anaconda3-$version-MacOSX-x86_64.pkg \
        Anaconda2-$version-Windows-x86_64.exe \
        Anaconda3-$version-Windows-x86_64.exe"

    for installer in $miniconda; do
        curl -O $URL/miniconda/$installer
    done
    for installer in $anaconda; do
        curl -O $URL/archive/$installer
    done

    # Move the files into the installers directory
    popd
    cp -a /tmp/extras $PREFIX/opt/anaconda-server/installers

The installers will be available for download from ``http://your.anaconda.server:port/downloads``.

.. note:: 
    
    Replace ``your.anaconda.server:port`` with the name or IP address and port of your Anaconda server.

The downloadable file will be a zip file containing the Anaconda distribution
and the configuration files specific to your Repository. These zip files are
cached in the server's configured storage for quick retrieval.

Check that the ``SERVER_NAME`` :ref:`setting <server-name>` has been set so
you generate the correct URLs in the next step.

To pre-generate these installer bundles based on the downloaded
installers, or to re-generate after downloading new installers,
execute the command:

.. code-block:: none

    anaconda-server-admin update-installers

.. caution:: 

    Newer versions of Anaconda and Miniconda have an updated version name formatting that this command does not recognize. You *must* update the installer file name for the command to work. 

    .. dropdown:: Example file renaming
        :animate: fade-in
        :color: primary

        If you downloaded the installer file ``Anaconda3-<VERSION>-1-Windows-x86_64.exe``, you must remove the ``-1`` from the file name like this: ``Anaconda3-<VERSION>-Windows-x86_64.exe``


This command requires that the :ref:`SERVER_NAME setting <server-name>` be set in order to generate the correct URLs.

By default, the included ``conda`` installation will point to the default
``anaconda`` and ``r-channel`` accounts on your Anaconda Enterprise 4 Repository server,
if those accounts exist.

You can change these default channels by
setting the ``DEFAULT_CHANNELS`` :ref:`setting <default-channels>`, and then
running the ``anaconda-server-admin update-installers`` command.
