Anaconda Enterprise: Documentation

# Installing on an online system

These instructions are for normal Linux installations on machines that have access to the internet.

NOTE: If the destination server is an air gapped system or otherwise does not have access to the internet, see Installing on an air gapped system.

- Before you start
- 1. Install MongoDB 2.6
- 2. Create the Repository administrator account
- 3. Install Repository
- 4. Configure Repository
- 5. Set up automatic restart on reboot, fail or error
- 6. Start and log in to Repository
- 7. Client configuration
- 8. Install the Repository license
- 9. OPTIONAL: Mirror installers for Anaconda and Miniconda
- 10. Mirror Anaconda Cloud

## Before you start

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

Your support representative provides you with a download URL for the Anaconda Repository installer. Make sure you have the download URL.

## 1. Install MongoDB 2.6

In a terminal window, create the `yum` repo file as the root user:

    RPM_CDN="https://820451f3d8380952ce65-4cc6343b423784e82fd202bb87cf87cf.ssl.cf1.rackcdn.com"
    curl -O $RPM_CDN/mongodb-org-tools-2.6.8-1.x86_64.rpm
    curl -O $RPM_CDN/mongodb-org-shell-2.6.8-1.x86_64.rpm
    curl -O $RPM_CDN/mongodb-org-server-2.6.8-1.x86_64.rpm
    curl -O $RPM_CDN/mongodb-org-mongos-2.6.8-1.x86_64.rpm
    curl -O $RPM_CDN/mongodb-org-2.6.8-1.x86_64.rpm

NOTE: Ubuntu users use `apt-get` instead of `yum`.

### MongoDB for Redhat and CentOS 7

1. Install MongoDB:

       sudo yum install -y mongodb-org*

2. Start MongoDB:

       sudo systemctl start mongod

3. Verify that MongoDB is running:

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

### MongoDB for Redhat and CentOS 6.7+

1. Install MongoDB:

       sudo yum install -y mongodb-org*

2. Start MongoDB:

       sudo /etc/init.d/mongod start

3. Verify that MongoDB is running:

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

### MongoDB for Ubuntu 12.04+

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

   NOTE: If you do not specify a version, such as 2.6.9, `apt-get` installs the latest stable version, which is 3.x.

2. Start MongoDB:

       sudo /etc/init.d/mongod start

   Verify that MongoDB is running:

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

   You receive verification that MongoDB is running:

       start: Job is already running: mongodb

### Additional MongoDB resources

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

## 2. Create the Repository administrator account

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

   NOTE: The anaconda-server user is the default for installing Repository. Any username can be used, but using the root user is discouraged.

2. Create a Repository package storage directory:

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

3. Assign ownership of this directory to the anaconda-server user:

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

4. Switch to the Repository administrator account:

       sudo su - anaconda-server

## 3. Install Repository

### Download the installer

Download the Repository installer from the download URL provided by your support representative:

    curl "$INSTALLER_URL" > anaconda_repository.sh

Install Repository, following the prompts in the installation routine:

    bash anaconda_repository.sh

1. Review and accept the license terms:

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

2. Once you have reviewed the license terms, approve them by typing `yes`:

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

3. 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 :: Anaconda, Inc.
         creating default environment... installation finished.

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

5. Type `yes` and press ENTER.

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

       source ~/.bashrc

## 4. Configure Repository

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 section 2 above.

   NOTE: As of Repository 2.33.8, the `fs_storage_root` configuration setting is mandatory for local filesystem storage and the Repository server will not run without it.

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.

3. If you are not using LDAP or Kerberos authentication, create an initial superuser account for Repository. Set the environment variable `USER_PASSWORD` with the desired password for the initial user. Then run:

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

   NOTE: Replace `superuser` with a username of your choice and `your@email.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 letters and numbers, with no punctuation. After setup, you can change the password in the web UI.

4. Initialize the Repository database:

       anaconda-server-db-setup --execute

   NOTE: The above command is also run when upgrading Repository. Upgrade and then run:

       anaconda-server-db-setup --execute

5. Restart the server.

NOTE: More configuration options can be controlled with one or more `.yaml` configuration files. Repository reads configuration files in this order:

1. From `/etc/anaconda-server/*.yaml`.
2. From `$PREFIX/etc/anaconda-server/*.yaml`.
3. 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.
4. 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.

   It will also create the folder `/home/anaconda-server/repo/etc/supervisord/conf.d/` where you can add `.conf` files with custom configuration.

   NOTE: If you don’t want to include the crontab rule, use the `--no-crontab` option when running the script.

   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:

       supervisorctl status

   If installed correctly, you see:

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

3. View the log file at:

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

## 6. Start and log in to Repository

1. Open your browser and log into Repository by visiting `http://your.anaconda.repository:8080/` using the superuser account you created in section 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.

   EXAMPLE: If your user account is “jsmith”:

       anaconda-server-admin set-superuser "jsmith"

NOTE: See Troubleshooting if you have issues starting the repo server.

## 7. Client configuration

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

## 8. Install the Repository license

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

2. After uploading the license file, you will see the login page. Log in using the superuser user and password that you created in section 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.

Alternatively, you can install the license by copying 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 Repository via the static directory located at `/home/anaconda-server/repo/opt/anaconda-server/installers`. 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 the URL for miniconda installers:

    URL="https://repo.continuum.io/miniconda/"

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

Define the URL for Anaconda installers:

    URL="https://repo.continuum.io/archive/"

Define the anaconda version to mirror.

EXAMPLE: 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 the `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 Repository. The channels to mirror are as follows:

Channel | Description
--- | ---
anaconda | Default anaconda channel containing all packages built and supported by Anaconda, Inc. 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 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 section 4 above.

### Mirror Anaconda

Mirror the Anaconda channel from Anaconda Cloud:

    anaconda-server-sync-conda

NOTE: Due to the size of the Cloud repository and depending on the available internet bandwidth, the mirroring process can take hours.

Mirroring an Anaconda repository contains documentation and advanced `yaml` configuration for mirroring other channels.