**********************
Command line interface
**********************

.. raw:: html

    <div class="section" id="cas-mirror">
    <h2>cas-mirror<a class="headerlink" href="#cas-mirror" title="Permalink to this headline">¶</a></h2>
    <p>NOTE: The cas-mirror tool is a component of the Anaconda repository
    enterprise product and is not available for free.</p>
    <p>The mirror tool is used to setup a package mirror of the Anaconda repository
    within your organization.  The following <code class="docutils literal"><span class="pre">conda</span></code> command installs the
    mirror tool:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">install</span> <span class="n">cas</span><span class="o">-</span><span class="n">mirror</span>
    </pre></div>
    </div>
    <p>Installing cas-mirror will make these commands available:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">cas</span><span class="o">-</span><span class="n">sync</span> <span class="o">--</span><span class="n">help</span>
    <span class="n">cas</span><span class="o">-</span><span class="n">server</span> <span class="o">--</span><span class="n">help</span>
    </pre></div>
    </div>
    <p>The first command <code class="docutils literal"><span class="pre">cas-sync</span></code> is used to bring the local mirror of the
    Anaconda repository up-to-date with our remote servers.
    To configure the location of the mirror on your file system, check
    the output of:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">cas</span><span class="o">-</span><span class="n">sync</span> <span class="o">--</span><span class="n">config</span>
    </pre></div>
    </div>
    <p>and, if necessary, create a configuration file (either <code class="docutils literal"><span class="pre">~/.cas-mirror</span></code> or
    system-wise <code class="docutils literal"><span class="pre">/etc/cas-mirror</span></code>) which contains the desired location
    of the local mirror on the filesystem, the platforms which should be
    mirrored, as well as an optional blacklist of packages (the names of
    packages which should not be mirrored, e.g.</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">mirror_dir</span><span class="p">:</span> <span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">data</span><span class="o">/</span><span class="n">mirror</span>
    <span class="n">remote_url</span><span class="p">:</span> <span class="s2">&quot;&quot;</span>  <span class="c1"># where to get miniconda and anaconda installers -- blank to skip</span>
    <span class="c1"># possible platforms are: linux-64, linux-32, osx-64, win-32, win-64</span>
    <span class="n">platforms</span><span class="p">:</span>
      <span class="o">-</span> <span class="n">linux</span><span class="o">-</span><span class="mi">64</span>
      <span class="o">-</span> <span class="n">win</span><span class="o">-</span><span class="mi">32</span>
    <span class="n">blacklist</span><span class="p">:</span>
      <span class="o">-</span> <span class="n">dnspython</span>
      <span class="o">-</span> <span class="n">shapely</span>
      <span class="o">-</span> <span class="n">gdal</span>
    </pre></div>
    </div>
    <p>Once you are happy with the mirror directory (which may be the default),
    you can run:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">cas</span><span class="o">-</span><span class="n">sync</span>
    </pre></div>
    </div>
    <p>Running this command for the first time will take many hours, because the
    entire Anaconda repository is being downloaded.  Subsequent runs will take
    significantly less time.
    To serve the Anaconda repository over HTTP, you can run:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">cas</span><span class="o">-</span><span class="n">server</span>
    </pre></div>
    </div>
    <p>The port on which the repository is being served may be changed using
    the <code class="docutils literal"><span class="pre">--port</span></code> option.  Note that you will need to run <code class="docutils literal"><span class="pre">cas-server</span></code> as
    root when you intend to serve on port 80.</p>
    <p>More extensive information about the cas-mirror tool&#8217;s functionality and configurable options is available <a class="reference external" href="mirrors-sync-configuration.html">here</a>.</p>
    </div>
    <div class="section" id="cas-installer">
    <h2>cas-installer<a class="headerlink" href="#cas-installer" title="Permalink to this headline">¶</a></h2>
    <p>A token from Continuum is required to install cas-installer, and you should
    have received it when your organization purchased Anaconda Server, Workgroup or
    Enterprise. If you no longer have access to your token, submit a support ticket
    or contact us at <a class="reference external" href="https://support.continuum.io/">priority support</a>. You can
    also email support at the email address given to you by your sales
    representative.</p>
    <p>When you have the token, run:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span>export TOKEN=&lt;your Anaconda Cloud token&gt;
    conda config --add channels https://conda.anaconda.org/t/$TOKEN/anaconda-server
    </pre></div>
    </div>
    <p>This tool allows you to create an installer for a conda environment.
    It is important that the cas-installer package is installed into the &#8220;root&#8221;
    conda environment (not &#8220;root&#8221; user).  The following command ensures that
    this happens:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">conda</span> <span class="n">install</span> <span class="o">-</span><span class="n">n</span> <span class="n">root</span> <span class="n">cas</span><span class="o">-</span><span class="n">installer</span><span class="o">=</span><span class="mf">1.3</span><span class="o">.</span><span class="mi">2</span>
    </pre></div>
    </div>
    <p>Once installed, the <code class="docutils literal"><span class="pre">cas-installer</span></code> command will be available:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">cas</span><span class="o">-</span><span class="n">installer</span> <span class="o">-</span><span class="n">h</span>
    </pre></div>
    </div>
    <p>The command takes an installer specification file as its argument, which
    specifies the name of the installer, the conda channel to pull packages
    from, the conda packages included in the installer etc.  Here is an
    example:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># ----------------- required -----------------</span>
    <span class="c1"># name</span>
    <span class="n">name</span><span class="p">:</span> <span class="n">test</span>

    <span class="c1"># channels to pull packages from</span>
    <span class="c1"># The &amp;channels creates a backreference so that it can be reused as</span>
    <span class="c1"># *channels in the conda_default_channels section below.</span>
    <span class="n">channels</span><span class="p">:</span> <span class="o">&amp;</span><span class="n">channels</span>
      <span class="o">-</span> <span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">repo</span><span class="o">.</span><span class="n">continuum</span><span class="o">.</span><span class="n">io</span><span class="o">/</span><span class="n">pkgs</span><span class="o">/</span><span class="n">free</span><span class="o">/</span>

    <span class="c1"># specifications</span>
    <span class="n">specs</span><span class="p">:</span>
      <span class="o">-</span> <span class="n">python</span>
      <span class="o">-</span> <span class="n">grin</span>

    <span class="c1"># ----------------- optional -----------------</span>
    <span class="c1"># platform e.g. linux-32, osx-64, win-32 defaults to current platform</span>
    <span class="c1">#platform: linux-64</span>

    <span class="c1"># The conda default channels which are used when running a conda which</span>
    <span class="c1"># was installed be the cas-installer created (requires conda (3.6.2 or</span>
    <span class="c1"># greater) in the specifications). The *channels is a YAML reference to</span>
    <span class="c1"># &amp;channels above.  It inserts all the channels from the channels key, so</span>
    <span class="c1"># that they do not have to be typed twice.</span>
    <span class="n">conda_default_channels</span><span class="p">:</span> <span class="o">*</span><span class="n">channels</span>

    <span class="c1"># installer filename</span>
    <span class="c1">#installer_filename: grin.sh</span>

    <span class="c1"># default install prefix</span>
    <span class="n">default_prefix</span><span class="p">:</span> <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">anaconda</span>
    </pre></div>
    </div>
    <p>For Windows, the tool creates nsis-based <code class="docutils literal"><span class="pre">.exe</span></code> installers, which can only
    be created on a Windows platform, although the architecture may be different.
    For Unix, the tool creates bash-based <code class="docutils literal"><span class="pre">.sh</span></code> installer, which can only
    be created on Unix (Linux, Mac OS X) systems.</p>
    </div>
