==============================================================
Configuring your PyPI or Anaconda Repository mirror (AER 2.28)
==============================================================

.. raw:: html

    <p>NOTE: This documentation is for versions of Anaconda Repository 2.26 and newer. For versions between 2.3.0 and 2.26,
    see <a class="reference internal" href="../../2.23/admin/mirrors-anaconda-repository.html#mirrors-anaconda-repository-2-23"><span>2.23 documentation</span></a>.
    For documentation of older versions, please see <a class="reference internal" href="../../2.23/admin/mirrors-sync-configuration-2.2.html#mirrors-sync-configuration-2-2"><span>2.2 documentation</span></a>.</p>
    <div class="section" id="before-you-begin">
    <h2>Before you begin<a class="headerlink" href="#before-you-begin" title="Permalink to this headline">¶</a></h2>
    <p>Anaconda Repository comes with the command line tool <code class="docutils literal"><span class="pre">anaconda-mirror</span></code> to mirror packages from Anaconda Cloud. An administrator
    can customize which packages to mirror by creating a configuration file in <code class="docutils literal"><span class="pre">$PREFIX/etc/anaconda-server/mirror/</span></code>, such as
    <cite>$PREFIX/etc/anaconda-server/mirror/my-mirror.yaml`</cite> and specifying that configuration file in the arguments to <code class="docutils literal"><span class="pre">anaconda-mirror</span></code>:</p>
    <div class="highlight-python"><div class="highlight"><pre><span></span>anaconda-mirror --config-file my-mirror
    </pre></div>
    </div>
    <ul class="simple">
    <li>platforms (valid options are: &#8216;linux-64&#8217;, &#8216;linux-32&#8217;, &#8216;osx-64&#8217;, &#8216;win-32&#8217;, and &#8216;win-64&#8217;)</li>
    <li>package_list</li>
    <li>python_versions (valid options are: 2.6, 2.7, 3.3, 3.4, 3.5)</li>
    <li>license_blacklist (valid options are:  AGPL, GPL2, GPL3, LGPL, BSD, MIT, Apache, PSF, Public-Domain, Proprietary and Other) *</li>
    <li>blacklist</li>
    <li>whitelist</li>
    <li>accounts</li>
    </ul>
    <p>Specifies the Anaconda Cloud accounts that will be mirrored. The default is the <code class="docutils literal"><span class="pre">anaconda</span></code> account.</p>
    </div>
    <div class="section" id="customizing-the-mirror">
    <h2>Customizing the mirror<a class="headerlink" href="#customizing-the-mirror" title="Permalink to this headline">¶</a></h2>
    <p>There are additional configuration settings that can be used to customize the account that is
    created on Anaconda Repository.</p>
    <ul class="simple">
    <li>account_mapping</li>
    <li>access (valid options are: authenticated, private, public)</li>
    </ul>
    <p>The <code class="docutils literal"><span class="pre">account_mapping</span></code> setting defines what account name the mirror will be created with. The default is to
    use the same account name as on Anaconda Cloud.</p>
    <p>For example:</p>
    <div class="highlight-python"><div class="highlight"><pre><span></span>account_mapping:
      anaconda: anaconda-mirror
    </pre></div>
    </div>
    <p>The <code class="docutils literal"><span class="pre">access</span></code> setting defines what permissions mirrored packages will have on your Anaconda Repository mirror.</p>
    <ul class="simple">
    <li>api_domain</li>
    <li>api_token</li>
    </ul>
    <p>These settings can be used if you wish to mirror from a different Anaconda Repository server, or if you wish to
    mirror private packages from Anaconda Cloud.</p>
    </div>
    <div class="section" id="platform-specific-mirroring">
    <h2>Platform-specific mirroring<a class="headerlink" href="#platform-specific-mirroring" title="Permalink to this headline">¶</a></h2>
    <p>By default, the anaconda-mirror tool will mirror all platforms.  If you know that you will <em>not</em> need all platforms, it will save you time and disk space if you edit the YAML file to specify the platform(s) you want mirrored:</p>
    <div class="highlight-python"><div class="highlight"><pre><span></span>platforms:
      - linux-64
      - win-32
    </pre></div>
    </div>
    </div>
    <div class="section" id="package-specific-mirroring">
    <h2>Package-specific mirroring<a class="headerlink" href="#package-specific-mirroring" title="Permalink to this headline">¶</a></h2>
    <p>In some cases you may want to mirror only a small subset of the Anaconda Repository.  Rather than blacklisting a long list of packages you do not want mirrored, you can instead simply enumerate the list of packages you DO want mirrored.</p>
    <p>For example:</p>
    <div class="highlight-python"><div class="highlight"><pre><span></span>package_list:
    - accelerate
    - pyqt
    - zope
    </pre></div>
    </div>
    <p>This example mirrors only the three packages: Accelerate, PyQt &amp; Zope.  All other packages will be completely ignored.</p>
    </div>
    <div class="section" id="python-version-specific-mirroring">
    <h2>Python version-specific mirroring<a class="headerlink" href="#python-version-specific-mirroring" title="Permalink to this headline">¶</a></h2>
    <p>In some cases on a few versions</p>
    <p>For example:</p>
    <div class="highlight-python"><div class="highlight"><pre><span></span>python_versions:
    - 3.3
    </pre></div>
    </div>
    <p>Mirrors only Anaconda packages built for Python 3.3.</p>
    </div>
    <div class="section" id="license-blacklist-mirroring">
    <h2>&#8220;License blacklist&#8221; mirroring<a class="headerlink" href="#license-blacklist-mirroring" title="Permalink to this headline">¶</a></h2>
    <p>As of Anaconda Repository 2.26.0, the Anaconda mirroring script supports license blacklisting for the following license families:</p>
    <ul class="simple">
    <li>AGPL</li>
    <li>GPL2</li>
    <li>GPL3</li>
    <li>LGPL</li>
    <li>BSD</li>
    <li>MIT</li>
    <li>APACHE</li>
    <li>PSF</li>
    <li>PUBLICDOMAIN</li>
    <li>PROPRIETARY</li>
    <li>OTHER</li>
    <li>NONE</li>
    </ul>
    <p>For example:</p>
    <div class="highlight-python"><div class="highlight"><pre><span></span>license_blacklist:
      - GPL2
      - GPL3
      - BSD
    </pre></div>
    </div>
    <p>Mirrors all the packages in the repository EXCEPT those that are GPL2-, GPL3-, or BSD-licensed, because those three licenses have been completely blacklisted.</p>
    <p>NOTE: Older versions of Anaconda Mirror support only license blacklisting for GPL.  If you are using an older version of Anaconda Repository, see the documentation for <a class="reference internal" href="../../2.23/admin/mirrors-sync-configuration-2.2.html#mirrors-sync-configuration-2-2"><span>customizing your PyPI or Anaconda Repository mirror</span></a>.</p>
    </div>
    <div class="section" id="blacklist-mirroring">
    <h2>&#8220;Blacklist&#8221; mirroring<a class="headerlink" href="#blacklist-mirroring" title="Permalink to this headline">¶</a></h2>
    <p>The blacklist allows access to all packages EXCEPT those explicitly listed.</p>
    <p>For example:</p>
    <div class="highlight-python"><div class="highlight"><pre><span></span>blacklist:
      - bzip2
      - tk
      - openssl
    </pre></div>
    </div>
    <p>Mirrors the entire Anaconda Repository except the bzip2, tk, and openssl packages.</p>
    </div>
    <div class="section" id="whitelist-mirroring">
    <h2>&#8220;Whitelist&#8221; mirroring<a class="headerlink" href="#whitelist-mirroring" title="Permalink to this headline">¶</a></h2>
    <p>The whitelist functions in combination with either the license_blacklist or blacklist arguments, AND re-adds packages that were excluded by a previous argument.</p>
    <p>For example:</p>
    <div class="highlight-python"><div class="highlight"><pre><span></span>license_blacklist:
      - GPL2
      - GPL3
    whitelist:
      - readline
    </pre></div>
    </div>
    <p>Mirrors the entire Anaconda Repository EXCEPT any GPL2- or GPL3-licenses packages, but including readline, despite the fact that it is GPL3-licensed.</p>
    </div>
    <div class="section" id="combining-multiple-mirror-configurations">
    <h2>Combining multiple mirror configurations<a class="headerlink" href="#combining-multiple-mirror-configurations" title="Permalink to this headline">¶</a></h2>
    <p>You may find that combining two or more of the arguments above is the simplest way to get the exact combination of packages that you want.</p>
    <p>The <em>platform</em> argument is evaluated before any other argument.  For example:</p>
    <div class="highlight-python"><div class="highlight"><pre><span></span>platforms:
      - linux-64
    package_list:
      - dnspython
      - shapely
      - gdal
    </pre></div>
    </div>
    <p>Mirrors ONLY linux-64 distributions of the dnspython, shapely and gdal packages.</p>
    <p>If the <em>license_blacklist</em> and <em>blacklist</em> arguments are combined, the <em>license_blacklist</em> is evaluated first, and the <em>blacklist</em> is a supplemental modifier:</p>
    <div class="highlight-python"><div class="highlight"><pre><span></span>license_blacklist:
      - GPL2
    blacklist:
      - pyqt
    </pre></div>
    </div>
    <p>In this example, the mirror configuration does not mirror GPL2-licensed packages. It does not mirror the GPL3 licensed package pyqt because it has been blacklisted. It does mirror all other packages in the repository.</p>
    <p>If the <em>blacklist</em> and <em>whitelist</em> arguments are both employed, the <em>blacklist</em> is evaluated first, with the <em>whitelist</em> functioning as a modifier:</p>
    <div class="highlight-python"><div class="highlight"><pre><span></span>blacklist:
     - accelerate
     - astropy
     - pygments
    whitelist:
     - accelerate
    </pre></div>
    </div>
    <p>This mirrors all packages in the repository except astropy and pygments.  Despite being listed on the blacklist, accelerate IS mirrored because it is listed on the whitelist.</p>
    </div>
