> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Mirrors

export const Danger = ({children}) => {
  return <div class="callout my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border danger-admonition dark:danger-admonition" data-callout-type="danger">
      <div class="mt-0.5 w-4">
        <svg width="14" height="14" viewBox="0 0 14 14" fill="rgb(239, 68, 68)" xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 text-sky-500" aria-label="Danger">
          <path fill-rule="evenodd" clip-rule="evenodd" d="M7 1.3C10.14 1.3 12.7 3.86 12.7 7C12.7 10.14 10.14 12.7 7 12.7C5.48908 12.6974 4.0408 12.096 2.97241 11.0276C1.90403 9.9592 1.30264 8.51092 1.3 7C1.3 3.86 3.86 1.3 7 1.3ZM7 0C3.14 0 0 3.14 0 7C0 10.86 3.14 14 7 14C10.86 14 14 10.86 14 7C14 3.14 10.86 0 7 0ZM8 3H6V8H8V3ZM8 9H6V11H8V9Z"></path>
        </svg>
      </div>
      <div class="text-sm prose min-w-0 w-full">
        {children}
      </div>
    </div>;
};

export const MirrorFolder = () => {
  return <span className="inline_icon">
      <svg class="inline" width="1.2em" height="1em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 589 512">
        <path fill="currentColor" d="M517 73.9H314L261.7 21.6A74.1 74.1 0 0 0 209.5 0H74A73.9 73.9 0 0 0 .1 73.9V443A73.9 73.9 0 0 0 74 516.9H517a73.9 73.9 0 0 0 73.9-73.9V147.7A73.9 73.9 0 0 0 517 73.9zM109.9 192a18.6 18.6 0 0 1 18.2-12.8h61.1l-18.7 74.5H76.9zM337.6 412.2a27.9 27.9 0 0 1 -28 27.9H104.8A27.9 27.9 0 0 1 76.9 412.2V272.5H170v46.6a9.3 9.3 0 0 0 9.3 9.3h55.8a9.3 9.3 0 0 0 9.3-9.3V272.5h93.2zM244.5 254 225.9 179.2h61.1a18.6 18.6 0 0 1 17.7 12.8l33 61.8z"></path>
      </svg>
    </span>;
};

Mirroring is the process of copying the contents of an external repository locally, ensuring users have fast and reliable access to its packages. When you run a mirror, it populates your channel with packages from the mirror’s source. Anaconda recommends that channels contain *only one mirror each* to prevent conflicts between package sources.

For more information on channels, see [Channels and subchannels](/docs/psm-on-prem/6.7.1/user/channel).

<Note>
  Mirroring is restricted to users whose [role](./keycloak_config/permissions#permission-levels) provides `write` or `manage` permissions for **Channel Mirrors** and/or **Subchannel Mirrors** categories.
</Note>

Allowlist the following URLs before attempting to mirror:

* `https://repo.anaconda.com/`
* `https://repo.anaconda.cloud/`
* `https://anaconda.org/`
* `https://anaconda.com/`
* `https://api.anaconda.cloud/`
* `https://conda.anaconda.org/`
* `https://pypi.org/`
* `https://files.pythonhosted.org/`
* `https://cran.r-project.org/` (optional - for CRAN R users)

## Creating a mirror

When creating a mirror, the recommended workflow is:

1. Select a channel you want to contain your mirror.
2. Open the  <Icon icon="gear" iconType="light" /> **Manage** dropdown menu and select *Freeze*.
3. Click **Freeze**.
4. Open the  <Icon icon="gear" iconType="light" /> **Manage** dropdown menu again and select *Create Mirror*.
5. Complete the [Create mirror](#create-mirror-form) form.
6. Allow the mirror time to complete.

   <Accordion title="How do I know when my mirror is complete?">
     You can view the status of in progress mirrors from the **All repository mirrors** page, or from a channel’s **Mirrors** tab. In-progress mirrors display which step is currently being performed with a brief description of the operation.

     <Frame>
       <img src="https://mintcdn.com/anaconda-29683c67/abCdQ9kzAxRqPlhZ/images/as_mirror_status_3.png?fit=max&auto=format&n=abCdQ9kzAxRqPlhZ&q=85&s=2b844c8752ac058859c1e11ef4aa00c9" alt="" width="1920" height="846" data-path="images/as_mirror_status_3.png" />
     </Frame>
   </Accordion>
7. Open the  <Icon icon="gear" iconType="light" /> **Manage** dropdown and select *Unfreeze*.
8. Click **Unfreeze**.

<Note>
  For more information on freezing and unfreezing a channel, see [Freezing/Unfreezing Channels](/docs/psm-on-prem/6.7.1/user/channel#freezing-and-unfreezing-channels).
</Note>

### Create mirror form

The **Create mirror** form allows you to set the configurations for your mirror. Let’s take a look at the different sections of the **Create mirror** form and what configurations they control.

<Frame>
  <img src="https://mintcdn.com/anaconda-29683c67/thX2NnwjYcGQ9mji/images/as_create_mirror_ui_6.7.0.png?fit=max&auto=format&n=thX2NnwjYcGQ9mji&q=85&s=35022a18b7fa7aab13f83b2213de380b" alt="" width="1681" height="774" data-path="images/as_create_mirror_ui_6.7.0.png" />
</Frame>

<Steps>
  <Step title="Mirror Name">
    Enter a name for your mirror. Anaconda recommends you name your mirror something descriptive for your end users.
  </Step>

  <Step title="Mirroring Mode">
    Choose whether you want your mirror to be active or passive.

    **Active Mirroring**: Downloads all packages not filtered out immediately to your local server. These mirrors can be large (for example, Anaconda’s public repository is 700GB, conda-forge is 3TB, and PyPI is 10TB). Active mirroring can take a long time to complete.

    **Passive Mirroring**: Creates a metadata file listing all packages on the mirrored server. Packages are downloaded when users request them via `conda install <PKG_NAME>`.

    <Note>
      Regardless of which mirror you choose to create, the packages will be the same. Anaconda recommends establishing your mirrors as passive.
    </Note>
  </Step>

  <Step title="External Source URL">
    Enter the URL of the server/repository to mirror.
    **Anaconda recommends creating mirrors for the following external source channels:**

    * `https://repo.anaconda.cloud/pkgs/main`
    * `https://repo.anaconda.cloud/pkgs/msys2`
    * `https://repo.anaconda.cloud/pkgs/r`

    <Note>
      If your external source channel is another Package Security Manager channel, you *must* use the format `https://<URL>/api/repo/<CHANNEL_NAME>`.

      ***

      If your external source channel is another Package Security Manager channel *that contains CRAN R packages*, you *must* use the format `https://<URL>/api/repo/<CHANNEL_NAME>/cran`.

      ***

      If your external source channel is a *virtual* channel from Package Security Manager (Cloud), you *must* use the format `https://repo.anaconda.cloud/repo/t/<TOKEN>/<ORG_ID>/<CHANNEL_NAME>`.

      ***

      If your external source channel is one of the **Anaconda Channels** or **Community Package Channels** from Package Security Manager (Cloud), you *must* use the format `https://repo.anaconda.cloud/t/<TOKEN>/repo/<CHANNEL_NAME>`.

      ***

      When creating mirrors that use Package Security Manager (Cloud) channels as the external source, replace `<TOKEN>` with your [organization access token](/docs/anaconda-platform/user/tokens), and `<ORG_ID>` with your [organization ID](/docs/anaconda-platform/admin/organizations#creating-an-organization).
    </Note>
  </Step>

  <Step title="Mirror Type">
    Set the type of packages that will be mirrored from the external source channel. This should align with the selection on the **Create Channel** form. Packages in this mirror that do not match the channel package type will be filtered out.

    You can choose from conda, standard python, or standard R package types. *Make sure you have allowlisted the URLs listed at the top of this page before creating mirrors*.
  </Step>

  <Step title="Mirroring Frequency">
    Set the frequency you want your mirror to run and update your packages. The default value instructs the mirror to update at midnight on the first day of every month.

    Custom frequencies use [cron expressions](https://crontab.cronhub.io/) to determine when they run.

    <Warning>
      Mirroring large channels can take several hours. Anaconda recommends against setting a frequency greater than *Daily* to avoid collisions between currently running and updating mirrors.
    </Warning>

    <Danger>
      If you are mirroring the full PyPI repository, set your frequency to run once yearly. Once the PyPI mirror is complete, any attempts to re-run the mirror will cause issues.
    </Danger>
  </Step>

  <Step title="Run Now">
    Check this box to start your mirror when you click **Save & Run**. If the Run Now box was not checked, your changes are saved, and the mirror runs the next time its frequency configuration instructs it to do so.
  </Step>

  <Step title="Assign Mirror Policy">
    Toggle between using the policy that is applied to the channel or selecting a policy to apply to the mirror. For more information about policies, see [Policies](./policies).

    <Note>
      You cannot apply a policy to a mirror if it is already applied to the channel.
    </Note>
  </Step>

  <Step title="View Applied Policy">
    View details of the policy applied to the mirror.
  </Step>

  <Step title="Cancel/Save & Run">
    Select **Cancel** at any time to quit your mirror form completion and discard any set parameters. Select **Save & Run** to start your mirror.
  </Step>
</Steps>

## Managing mirrors

Select **<MirrorFolder /> All Mirrors** from the left-hand navigation to view mirrors globally for all users.

<Note>
  This view is only available to users whose role provides `Manage` permissions for the **mirror** attribute. This value must be assigned in Keycloak.
</Note>

<Frame>
  <img src="https://mintcdn.com/anaconda-29683c67/YGtija9HXl-k020Y/images/as_all_repository_mirrors_3.png?fit=max&auto=format&n=YGtija9HXl-k020Y&q=85&s=d7d0cf6e3bcf2728e4970ec8548a7dee" alt="" width="1922" height="858" data-path="images/as_all_repository_mirrors_3.png" />
</Frame>

<Tip>
  Use the search box to locate a mirror by name. Click a column header to sort mirrors by **Type**, **Mode**, **Mirroring Status**, or **Last Updated**.
</Tip>

### Mirror actions

Use the icons in the **Actions** column to manage your mirrors:

<Frame>
  <img src="https://mintcdn.com/anaconda-29683c67/FWjHZXWDjYmx0_bG/images/mirror_actions.png?fit=max&auto=format&n=FWjHZXWDjYmx0_bG&q=85&s=9767387a950bd9b43c801294e4e74419" alt="" width="1922" height="982" data-path="images/mirror_actions.png" />
</Frame>

<Tip>
  Mirror actions can also be performed from a channel’s **Mirrors** tab.
</Tip>

<Icon icon="pencil" iconType="regular" /> **Edit mirror**: Edit a mirror’s configurations.

<Note>
  You cannot edit the mode of an established mirror.
</Note>

<Icon icon="hand" iconType="regular" /> **Stop running mirror**: Stop an in-progress mirror.

<Note>
  It can take up to 10 minutes for a mirror to fully stop. A mirror in the process of stopping will display **Stopping** as its mirroring status. Once it is complete, it will display **Stopped** as its status. Stopping a mirror does not discard the progress the mirror has made, and some packages may appear in your channel’s **Packages** tab.
</Note>

<Icon icon="rotate-right" iconType="regular" /> **Restart Mirror**: Restart a stopped mirror.

<Note>
  Restarted mirrors run from the beginning of the mirroring process, not from where you stopped the run.
</Note>

<Icon icon="eye" iconType="light" /> **See details**: View information about how many packages were filtered from the source, reasons for their exclusion, and whether packages were mirrored passively or actively.

<Icon icon="trash" iconType="regular" /> **Delete mirror**: Delete a mirror.

<Icon icon="download" iconType="regular" /> **Download Dependency Report**: Download a dependency report (if available)

* A dependency report is a detailed list of all the software packages required for your specified packages to function correctly. It includes both direct dependencies (packages your specified packages require to run) and indirect dependencies (packages the dependencies require to run). A package dependency report can help you identify exactly which packages are necessary for your channel to be able to create a working environment using conda.
* Dependency reports are only available for mirrors that have policies with specific configurations applied:
  * You must set package rules to allow packages by their names using [MatchSpec protocol](https://docs.conda.io/projects/conda/en/latest/dev-guide/api/conda/models/match_spec/index.html)—a syntax for specifying package names and versions in conda
  * You must select the **Include dependencies** checkbox.
