Mirroring an Anaconda repository¶
Before you begin¶
You need to have already completed installing and configuring your Anaconda Server instance. Due to the size of the Anaconda repository, it is important that you have configured a file storage location with sufficient disk space. If necessary please see the instructions for setting the file storage location.
The full Anaconda mirror requires approximately 90GB.
The mirror command¶
You can mirror some or all of the contents of the Anaconda repository using the anaconda-server-sync-conda command:
This will mirror all of the packages from the Anaconda repository into the anaconda binstar user account.
Verify that this is working by opening your browser to http://<anaconda.server.addr>/anaconda/
Alternately, you may not wish to mirror all packages. To mirror a subset of the total repository, specify which platforms you want to include, or use the whitelist, blacklist or license_blacklist functionality to control which packages are mirrored:
anaconda-server-sync-conda --mirror-config /etc/binstar/mirrors/conda.yaml
If necessary, refer to more information on whitelist, blacklist and license_blacklist functionality.
In an air-gapped environment:¶
To mirror the Anaconda repository in an air-gapped environment, using a system with no internet access, you create a local copy of the Anaconda repository using a USB drive provided by Continuum, and point anaconda-server-sync-conda to the extracted tarball.
First, mount the USB drive and extract the tarball. In this example we will extract to /tmp:
$ cd /tmp $ tar xvf <path to>/mirror.tar
Now you have a local Anaconda repository located at /tmp/mirror/pkgs. This repository can be mirrored. Edit /etc/binstar/mirrors/conda.yaml to contain:
channels: - /tmp/mirror/pkgs
And then run the above command:
$ anaconda-server-sync-conda --mirror-config /etc/binstar/mirrors/conda.yaml
This will mirror the contents of the local Anaconda repository to your Anaconda Server installation under the username ‘anaconda.’
Having created the mirror, you will still need to configure conda to search for packages here rather than on the default Anaconda repository. You can do that by editing your ~/.condarc file to add the appropriate channel:
channels: - http://<anaconda.server.ipaddress>:<port>/conda/anaconda/
NOTE: This configuration change can be made at the user level or via an administrative conda file, to force all internal users to use your local Anaconda mirror rather than querying the Anaconda repository.
Advanced mirror configuration¶
These instructions are for OS X and Linux only.
Point Anaconda repository to multiple mirrors.
You can create multiple mirrors, with each mirror put into its own account. You must specify the account name when mirroring. If the account does not exist, a mirror account is created and assigned a random password. This allows you to use the GUI to log in, create tokens and manage the mirror.
sync_conda_mirror.py –account anaconda –mirror-config /etc/binstar/mirrors/anaconda.yaml
Note: If the account doesn’t exist, Anaconda repo will create the account and a default password.
Make packages on mirror private.
Packages may also be set to be private as shown:
sync_conda_mirror.py –account private –mirror-config /etc/binstar/mirrors/private.yaml –private
NOTE: Packages must be set to “private” when they are first created; you cannot retroactively designate an existing package as private.