Mirroring an Anaconda repository¶
NOTE: This documentation is for versions of Anaconda Repository 2.26 and newer. For versions between 2.30 and 2.26, see 2.23 documentation. For documentation of older versions, see 2.20 documentation.
Before you start¶
You need to have already installed and configured your Repository instance. Due to the size of Repository, it is important that you have configured a file storage location with sufficient disk space. If necessary, see the requirements for the file storage location.
A full Anaconda mirror requires approximately 90 GB.
Mirroring all packages¶
You can mirror some or all of the contents of the
Anaconda repository using the
anaconda-server-sync-conda command:
anaconda-server-sync-conda
This mirrors all of the packages from the Anaconda repository into the
anaconda user account.
Verify this by opening your browser to
http://your-anaconda-repo/anaconda/.
NOTE: Replace your-anaconda-repo with the URL to your installation
of Repository.
Mirroring some packages¶
Alternately, you may not want 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, by copying the
default configuration file
$PREFIX/etc/anaconda-server/mirror/anaconda.yaml to
$PREFIX/etc/anaconda-server/mirror/anaconda-custom.yaml.
For Repository 2.27 or newer, there are sample yaml config files
located at: $PREFIX/etc/anaconda-server/mirror. PREFIX is
the install location of Repository, which by default is
~anaconda-server/repo/etc/anaconda-server/mirror.
This command mirrors the repository according to the settings in the
configuration file anaconda-custom.yaml:
anaconda-server-sync-conda --mirror-config anaconda-custom
For more information, see Customizing mirrors.
Mirroring with the deprecated anaconda-mirror command¶
The anaconda-mirror command is deprecated but still in use at some
installations.
It is used with the command anaconda-mirror sync, or with a
configuration file such as anaconda-custom.yaml with the command
anaconda-mirror --config-file anaconda-custom sync.
Resetting packages¶
Use the --reset option to reset the previously mirrored
packages:
anaconda-mirror --config-file anaconda-custom sync --reset
This resets the “last sync” time for the repository, so
anaconda-mirror requests all packages, not just those changed or
added since the last sync. As the requests are processed,
anaconda-mirror still automatically downloads only those files
that differ from the files currently in the repository.
Exporting a mirror¶
To generate a mirror archive:
anaconda-mirror export mirror.tar
This command dumps the packages, according to the
configured settings, into the file
mirror.tar.
This mirror can be used in an air gapped environment.
Importing a mirror¶
To mirror the Anaconda repository in an air gapped environment,
point anaconda-mirror to the exported mirror archive.
Mount the USB drive and then run:
anaconda-mirror import $USB/mirror.tar
This command mirrors the contents of the local Anaconda repository to your Repository installation under the username “anaconda.”
Filtering¶
If you want to update the filters on your mirror—for example, to
exclude additional licenses—running anaconda-mirror sync again
retrieves new packages that match this filter, but it does not remove
existing packages that no longer match the filter.
To see which packages no longer match your filter:
anaconda-mirror clean --dry-run
To remove these packages from your mirror:
anaconda-mirror clean
Mirroring additional channels¶
If mirroring from an air gap archive, the channel in the following configuration points to a local directory to which the archive is expanded.
In addition, if a platform-specific archive is downloaded, then the
config file needs the platforms section. The examples in the
following sections assume
x64-repo-mirrors-\*.tar <airgap-archive-mirrors> is expanded to
$MIRRORS_ARCHIVE.
Similarly, for an online system, the channel points to Anaconda Cloud. The platforms are optional and limit the mirrored conda packages to the specified platforms.
Mirroring R channel¶
Create the
yamlconfig file.EXAMPLE: The following is a config to mirror from an air gap archive containing only x64 packages:
cat $PREFIX/etc/anaconda-server/mirror/r.yaml channels: - file://$MIRRORS_ARCHIVE/r/pkgs # The platforms should correspond to the platforms contained in # the archive. Omit if the archive contains conda packages for all platforms. platforms: - linux-64 - osx-64 - win-64
EXAMPLE: The following is for an online system:
cat $PREFIX/etc/anaconda-server/mirror/r.yaml channels: - https://conda.anaconda.org/r
Mirror the packages to r-channel:
anaconda-server-sync-conda --mirror-config \ $PREFIX/etc/anaconda-server/mirror/r.yaml --account=r-channel
Mirroring Wakari channel for AEN¶
Create the
yamlconfig file.EXAMPLE: The following is a config to mirror from an air gap archive containing only x64 packages:
cat $PREFIX/etc/anaconda-server/mirror/wakari.yaml channels: - file://$MIRRORS_ARCHIVE/wakari/pkgs # The platforms should correspond with the platforms contained in # the archive. Omit if the archive contains conda packages for all platforms. platforms: - linux-64 - osx-64 - win-64
EXAMPLE: The following is for an online system:
cat $PREFIX/etc/anaconda-server/mirror/wakari.yaml channels: - https://conda.anaconda.org/t/<TOKEN>/anaconda-nb-extensions - https://conda.anaconda.org/wakari
NOTE: Replace
<TOKEN>with the token for the anaconda-nb-extensions channel that you should have received along with your Repository license.Mirror the packages to the Wakari channel:
anaconda-server-sync-conda --mirror-config \ $PREFIX/etc/anaconda-server/mirror/r.yaml --account=wakari
Mirroring anaconda-adam channel for cluster management¶
Create the
yamlconfig file.EXAMPLE: The following is a config to mirror from an air gap archive containing only x64 packages:
cat $PREFIX/etc/anaconda-server/mirror/anaconda-adam.yaml channels: - file://$MIRRORS_ARCHIVE/anaconda-adam/pkgs # The platforms should correspond with the platforms contained in # the archive. Omit if the archive contains conda packages for all # platforms. platforms: * linux-64 * osx-64 * win-64EXAMPLE: The following is for an online system:
cat $PREFIX/etc/anaconda-server/mirror/anaconda-adam.yaml channels: - https://conda.anaconda.org/anaconda-adam
Mirror the packages to anaconda-adam channel:
anaconda-server-sync-conda --mirror-config \ $PREFIX/etc/anaconda-server/mirror/r.yaml --account=anaconda-adam
Configuring conda¶
Having created the mirror, you 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.repo.ipaddress>:<port>/conda/anaconda/
NOTE: Replace <anaconda.repo.ipaddress> with the URL to your
installation of Repository.
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.
NOTE: Users can download Anaconda installers that are
pre-configured to search your Repository from
http://<anaconda.repository.addr>/downloads. To learn how to
generate these installers, see Customizing installers.