===========================================
Mirroring an Anaconda repository (AER 2.26)
===========================================

.. 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 class="std std-ref">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 class="std std-ref">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>You need to have already completed <a class="reference external" href="install.html">installing and configuring your Anaconda Repository instance</a>.
    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 <a class="reference external" href="install.html#configure-the-server">instructions for setting the file storage location</a>.</p>
    <p>The full Anaconda mirror requires approximately 90GB.</p>
    </div>
    <div class="section" id="the-mirror-command">
    <h2>The mirror command<a class="headerlink" href="#the-mirror-command" title="Permalink to this headline">¶</a></h2>
    <p>You can mirror some or all of the contents of the <a class="reference external" href="http://docs.continuum.io/anaconda/pkg-docs.html">Anaconda repository</a> using the <code class="docutils literal"><span class="pre">anaconda-mirror</span></code> command:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">anaconda</span><span class="o">-</span><span class="n">mirror</span> <span class="n">sync</span>
    </pre></div>
    </div>
    <p>This will mirror all of the packages from the Anaconda repository into the <cite>anaconda</cite> user account.</p>
    <p>Verify by opening your browser to <code class="docutils literal"><span class="pre">http://&lt;your.anaconda.repo&gt;/anaconda/</span></code></p>
    <p>NOTE: Replace <code class="docutils literal"><span class="pre">&lt;your.anaconda.repo&gt;</span></code> with the actual URL to your installation of Anaconda Repository.</p>
    <p>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 by copying the default configuration file
    <code class="docutils literal"><span class="pre">$PREFIX/etc/anaconda-server/mirror/anaconda.yaml</span></code> to <code class="docutils literal"><span class="pre">$PREFIX/etc/anaconda-server/mirror/anaconda-custom.yaml</span></code>:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">anaconda</span><span class="o">-</span><span class="n">mirror</span> <span class="o">--</span><span class="n">config</span><span class="o">-</span><span class="n">file</span> <span class="n">anaconda</span><span class="o">-</span><span class="n">custom</span> <span class="n">sync</span>
    </pre></div>
    </div>
    <p>If necessary, refer to more information on <a class="reference external" href="mirrors-sync-configuration.html">whitelist, blacklist and license_blacklist functionality</a>.</p>
    <div class="section" id="in-an-air-gapped-environment">
    <h3>In an air-gapped environment:<a class="headerlink" href="#in-an-air-gapped-environment" title="Permalink to this headline">¶</a></h3>
    <p>To mirror the Anaconda repository in an air-gapped environment, using a system with no internet access,
    point <code class="docutils literal"><span class="pre">anaconda-mirror</span></code> to the mirror archive on a USB drive provided by Continuum.</p>
    <p>Mount the USB drive and then run the following command:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span>anaconda-mirror import $USB/mirror.tar
    </pre></div>
    </div>
    <p>This will mirror the contents of the local Anaconda repository to your Anaconda Repository installation under the username <code class="docutils literal"><span class="pre">anaconda</span></code>.</p>
    </div>
    <div class="section" id="filtering">
    <h3>Filtering<a class="headerlink" href="#filtering" title="Permalink to this headline">¶</a></h3>
    <p>If you wish to update the filters on your mirror (for example, to exclude additional licenses), running <code class="docutils literal"><span class="pre">anaconda-mirror</span> <span class="pre">sync</span></code> again
    will retrieve new packages that match this filter, but it will not remove existing packages that no longer match the filter.</p>
    <p>To see which packages no longer match your filter, run the command:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">anaconda</span><span class="o">-</span><span class="n">mirror</span> <span class="n">clean</span> <span class="o">--</span><span class="n">dry</span><span class="o">-</span><span class="n">run</span>
    </pre></div>
    </div>
    <p>To remove these packages from your mirror, run the command:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">anaconda</span><span class="o">-</span><span class="n">mirror</span> <span class="n">clean</span>
    </pre></div>
    </div>
    </div>
    </div>
    <div class="section" id="configure-conda">
    <h2>Configure conda<a class="headerlink" href="#configure-conda" title="Permalink to this headline">¶</a></h2>
    <p>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 <cite>~/.condarc</cite> file to add the appropriate channel:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">channels</span><span class="p">:</span>
        <span class="o">-</span> <span class="n">http</span><span class="p">:</span><span class="o">//&lt;</span><span class="n">anaconda</span><span class="o">.</span><span class="n">repo</span><span class="o">.</span><span class="n">ipaddress</span><span class="o">&gt;</span><span class="p">:</span><span class="o">&lt;</span><span class="n">port</span><span class="o">&gt;/</span><span class="n">conda</span><span class="o">/</span><span class="n">anaconda</span><span class="o">/</span>
    </pre></div>
    </div>
    <p>NOTE: Replace &lt;anaconda.repo.ipaddress&gt; with the actual URL to your installation of Anaconda Repository.</p>
    <p>NOTE: This configuration change can be made at the user level or via an <a class="reference external" href="http://conda.pydata.org/docs/admin.html">administrative</a> conda file, to force all internal users to use your local Anaconda mirror rather than querying the Anaconda repository.</p>
    <p>NOTE: Users can download Anaconda installers that are pre-configured to search your Repository from <code class="docutils literal"><span class="pre">http://&lt;anaconda.repository.addr&gt;/downloads</span></code>. To
    learn how to generate these installers, see the <a class="reference internal" href="custom-anaconda-installers.html#bundled-installers"><span class="std std-ref">bundled installers</span></a> documentation.</p>
    </div>
