Anaconda Enterprise: Documentation

# Offline Installation (AER 2.31)

This section is for installations on machines that do not have access to the internet. The air gap archives contain installers, dependencies and packages to mirror.

Note: Before proceeding, ensure the installation requirements are met.

## Download air gap archive

Download the installers archive and the appropriate mirrors archive for your needs. The Air gap archive page lists the archives and their contents.

This document assumes the air gap media is available on the target server at $INSTALLER_PATH. For 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. Documentation assumes 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`

## 1. Install MongoDB 2.6

Change directory to appropriate rpms* directory to find dependencies:

    cd $INSTALLER_PATH/rpms*x/

### MongoDB for Redhat and CentOS 7

Install MongoDB:

    sudo yum install -y mongodb-org*

Start MongoDB:

    sudo systemctl start mongod

Verify that MongoDB is running:

    $ sudo systemctl status mongod
    mongodb (pid 17258) is running...

### MongoDB for Redhat and CentOS 6.7+

Install MongoDB:

    sudo yum install -y mongodb-org*

Start MongoDB:

    sudo /etc/init.d/mongod start

Verify that MongoDB is running:

    $ sudo /etc/init.d/mongod status
    mongodb (pid 17258) is running...

### MongoDB for Ubuntu 12.04+

Install MongoDB:

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

    echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list

    sudo apt-get update

    sudo apt-get install -y mongodb-org=2.6.9 mongodb-org-server=2.6.9 mongodb-org-shell=2.6.9 mongodb-org-mongos=2.6.9 mongodb-org-tools=2.6.9

Start MongoDB:

    sudo service mongodb start

You will receive verification that MongoDB is running:

    start: Job is already running: mongodb

Note: If you don’t specify a version like 2.6.9, apt-get will install the latest stable version, which is 3.x.

### Additional MongoDB resources

For additional MongoDB installation information see https://docs.mongodb.org/manual/

## 2. Create the Anaconda Repository administrator account

In a terminal window, create a new user account for Anaconda Repository named anaconda-server, and switch to this new account:

    sudo useradd -m anaconda-server

The anaconda-server user is the default for installing Anaconda Repository. Any username can be used.

NOTE: The use of the root user is discouraged.

Create Anaconda Repository package storage directory:

    sudo mkdir -m 0770 -p /opt/anaconda-server/package-storage

Assign the anaconda-server user ownership of this directory:

    sudo chown -R anaconda-server:anaconda-server /opt/anaconda-server

Switch to the Anaconda Repository administrator account:

    sudo su - anaconda-server

## 3. Install Anaconda Repository

Install Anaconda 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 anaconda repository.

Review and accept the license terms:

    Welcome to Anaconda Repository 2.31.6 (by Continuum Analytics, Inc.)
    In order to continue the installation process, please review the license agreement.
    Please, press ENTER to continue.

Once you have reviewed the license terms, approve them:

    Do you approve the license terms? [yes|no] yes

Accept the default location or specify an alternative:

    anaconda_repository will now be installed into this location:
    /home/anaconda-server/repo  -Press ENTER to confirm the location
    -Press CTRL-C to abort the installation
    -Or specify a different location below
     [/home/anaconda-server/repo] >>> /home/anaconda-server/repo" [Press ENTER]
      PREFIX=/home/anaconda-server/repo
      installing: python-2.7.11-0
      ...
      Python 2.7.11 :: Continuum Analytics, Inc.
      creating default environment... installation finished.

At the end of the installation routine, update the anaconda-server user’s path (prepending /home/anaconda-server/repo) by answering yes at the prompt to add the install location to your path:

    Do you wish the installer to prepend the anaconda_repository install location to PATH in your /home/anaconda-server/.bashrc ? [yes|no]

Type “yes” and press ENTER.

For the new path changes to take effect, source your .bashrc:

    source ~/.bashrc

## 4. Configure Anaconda Repository

Now initialize the web server, choose the package storage location, and create the first user.

1. Initialize the web server and indicate the filepath for the package storage location:

       anaconda-server-config --init
       anaconda-server-config --set fs_storage_root /opt/anaconda-server/package-storage

   NOTE: The location for file storage can be any location owned by the anaconda-server user that you created in step 2.

2. Configure the connection to your MongoDB database:

       anaconda-server-config --set MONGO_URL mongodb://localhost

   NOTE: You may also configure an external MongoDB database. See the advanced installation instructions for details.

3. If you are not using LDAP or Kerberos authentication, create an initial superuser account for Anaconda Repository:

       anaconda-server-create-user --username "superuser" --password "yourpassword" --email "your@email.com" --superuser

   NOTE: Replace “superuser” with a username of your choice, “yourpassword” with a password of your choice, and “you@youremail.com” with an email address where you wish to receive system email notifications.

   NOTE: To ensure the bash shell does not process any of the characters in this password, limit the password to lower case letters, upper case letters and numbers, with no punctuation. After setup the password can be changed with the web interface.

4. Initialize the Anaconda Repository database:

       anaconda-server-db-setup --execute

   NOTE: The above command is also run when upgrading AE-Repo. Upgrade and then run:

       anaconda-server-db-setup --execute

   Then restart the server.

   NOTE: More configuration options can be controlled with one or more .yaml configuration files. Anaconda Repository reads configuration files from `/etc/anaconda-server/*.yaml`, then `$PREFIX/etc/anaconda-server/*.yaml`, then from the path specified in the environment variable `ANACONDA_SERVER_CONFIG` if it is set and the command line argument `--config-file` was not used, then from the path specified in the command line argument `--config-file` if it was used. All configuration is merged, and options from files read earlier are overwritten by files read later. If there are multiple files in the same directory, they are read in alphabetical order.

## 5. Set up automatic restart on reboot, fail or error

1. Run the anaconda-server-install-supervisord-config.sh script to configure supervisord management of the Anaconda server and worker processes:

       anaconda-server-install-supervisord-config.sh

   This will generate the /home/anaconda-server/repo/etc/supervisord.conf file and add a crontab rule to restart supervisor after each reboot.

   If an error message says that the user is disallowed from using cron and could not add the crontab rule, you can add it manually with sudo. Edit the crontab file:

       sudo crontab -e -u anaconda-server

   When the file is open for editing, add this entry:

       @reboot /home/anaconda-server/repo/bin/supervisord

2. Verify that the server is running with:

       supervisorctl status

   If installed correctly, you see:

       binstar-server RUNNING   pid 10831, uptime 0:00:05

3. View log file at:

       $PREFIX/var/log/anaconda-server/application.log

## 6. Start and log on to Anaconda Repository

1. Open your browser and log onto Anaconda Repository by visiting `http://your.anaconda.repository:8080/` using the superuser account you created in step 4 above.

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

2. If you are using LDAP or Kerberos authentication, modify your user account to be a superuser. For example, if your user account is “jsmith”:

       anaconda-server-admin set-superuser "jsmith"

NOTE: See Troubleshooting your Anaconda repository installation if you have issues starting the repo server.

## 7. Client configuration

Follow the Client configuration instructions so you can use one or more clients to communicate with the server.

## 8. Install Anaconda Repository License file

In your browser, go to `http://your.anaconda.repository:8080`. Follow the onscreen instructions to upload the license file that you received in an email from your sales representative.

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

Contact your sales representative or support representative if you cannot find or have any questions about your license.

After uploading the license file, you will see the login page. Log in using the superuser user and password that you created in step 4 above.

TIP: You can view the current license information and upload a new license file by visiting the URL `http://your.anaconda.repository:8080/admin/license`. NOTE: Replace “your.anaconda.repository” with the IP address or domain name of your repository.

Alternate license install: Copy the license file directly into the `/home/anaconda-server/.continuum` directory.

## 9. (Optional) Mirror installers for Anaconda and Miniconda

Miniconda and Anaconda installers can be served by Anaconda Repository via the static directory located at /home/anaconda-server/repo/lib/python2.7/site-packages/binstar/static/extras. To serve up the latest Miniconda installers for each platform, download them and copy them to the extras directory. The following code snippets assume /tmp exists.

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.

The Miniconda*latest*.sh always point to the latest Miniconda installers. Either these can be mirrored or the ones with the latest version number can be mirrored. Define the list of installers to mirror:

    versions="Miniconda2-4.3.11-Linux-x86_64.sh
              Miniconda2-4.3.11-MacOSX-x86_64.sh
              Miniconda2-4.3.11-Windows-x86.exe
              Miniconda2-4.3.11-Windows-x86_64.exe
              Miniconda3-4.3.11-Linux-x86_64.sh
              Miniconda3-4.3.11-MacOSX-x86_64.sh
              Miniconda3-4.3.11-Windows-x86.exe
              Miniconda3-4.3.11-Windows-x86_64.exe"

    # miniconda installers
    mkdir -p /tmp/extras
    pushd /tmp/extras

    for installer in $versions
    do
        curl -O $URL$installer
    done

Download anaconda installers.

Similarly, define the anaconda version to mirror. For instance, to mirror version 4.3:

    versions="Anaconda3-4.3.1-Linux-x86_64.sh
              Anaconda3-4.3.1-MacOSX-x86_64.pkg
              Anaconda3-4.3.1-MacOSX-x86_64.sh
              Anaconda3-4.3.1-Windows-x86.exe
              Anaconda3-4.3.1-Windows-x86_64.exe
              Anaconda2-4.3.1-Linux-x86_64.sh
              Anaconda2-4.3.1-MacOSX-x86_64.pkg
              Anaconda2-4.3.1-MacOSX-x86_64.sh
              Anaconda2-4.3.1-Windows-x86.exe
              Anaconda2-4.3.1-Windows-x86_64.exe"

    # miniconda installers
    mkdir -p /tmp/extras
    pushd /tmp/extras

    for installer in $versions
    do
        curl -O $URL$installer
    done

Copy extras folder which contains all installers that will be mirrored in the repo:

    # Move installers into static directory
    popd
    cp -a /tmp/extras /home/anaconda-server/repo/lib/python2.7/site-packages/binstar/static

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/static/extras/Miniconda-latest-Linux-x86_64.sh

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

## 10. Mirror Anaconda Cloud

The final step is to mirror the packages from a subset of channels on Anaconda Cloud to the local Anaconda Repository. The channels to mirror are as follows:

Channel | Description
--- | ---
anaconda | Default anaconda channel containing all packages built and supported by Continuum Analytics. Also contains custom packages.
r | If you would like conda packages for r, mirror this channel. It is typically done under an r account.
wakari anaconda-nb-extensions | If the local Anaconda Repository will be used by Anaconda Enterprise Notebooks the recommended method is to mirror these channels under the wakari account.
anaconda-adam | Anaconda-adam is used to manage the environments on a cluster. If you plan to use anaconda-scale for cluster management, mirror the anaconda-adam packages.
msys2 | msys2 is required by quite a few windows packages. See http://www.msys2.org/

The packages will be mirrored to the package store defined by the “fs_storage_root” key as described in the section “Configure Anaconda Repository” above.

### Mirror Anaconda

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

1. Create a mirror config yaml typically stored in $PREFIX/etc/anaconda-server/mirror/
2. Customize configuration. 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, linux-32.
3. Invoke the mirror command by pointing it to the config file

Create config:

    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

Mirror anaconda repository contains documentation and advanced yaml config for mirroring other channels.