> ## 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.

# Anaconda Server CLI

The Anaconda Server command line interface (CLI) is a tool that can be used to do the following:

* Install packages from private or authenticated channels
* Configure channels, default channels, and the channel alias
* Upload assets
* Create mirrors

This topic provides guidance on the following actions:

* [Installing the conda repo CLI](#installing-the-conda-repo-cli)
* [Conda repo configuration](#conda-repo-configuration)
* [OAuth and SAML configuration](#oauth-and-saml-configuration)
* [Logging in](#logging-in)
* [Using the wizard](#using-the-wizard)
* [Further assistance](#further-assistance)

## Installing the conda repo CLI

Install the Anaconda Server CLI `conda-repo-cli` package:

```sh theme={null}
conda install conda-repo-cli
```

<Note>
  The Anaconda Server administrators may also choose to mirror this package into a channel on the server. Contact your administors to determine if `conda-repo-cli` can be installed from an Anaconda Server channel.
</Note>

## Conda repo configuration

Follow these steps to configure your conda repo site:

* Use the following commands if you are using SSL:

  ```sh theme={null}
  # Replace <SITE_NAME> with the short tag you'll use to identify the fully qualified domain name.
  # Replace <DOMAIN> with your domain.
  conda repo config --set sites.<SITE_NAME>.url https://<DOMAIN>/api
  conda repo config --set default_site <SITE_NAME>

  # The following is an example of two sites, one for production and the second for development:
  # conda repo config --set sites.production.url https://prod.my-ate.company.com/api
  # conda repo config --set sites.development.url https://dev.my-ate.company.com/api
  ```

* Use the following commands if you are **not** using SSL:

  ```sh theme={null}
  # Replace <SITE_NAME> with the short tag you'll use to identify the fully qualified domain name.
  # Replace <DOMAIN> with your domain.
  conda repo config --set sites.<SITE_NAME>.url http://<DOMAIN>/api
  conda repo config --set default_site <SITE_NAME>
  ```

For example, `SITE\_NAME` may be anaconda-repo and `DOMAIN` may be anaconda-repo.company.com.

## OAuth and SAML configuration

If you are using OAuth or SAML, run the following command to go through the standard SAML authorization flow **after** configuring your site:

```sh theme={null}
conda repo config --set oauth2 true
```

when you run `conda repo login`, a browser window will open for you to log in to Anaconda Server. After login has completed, the window will display “Token Received.”
You can then close the browser window and continue to use the CLI.

## Logging in

Run the following code to log in to Anaconda Server:

```sh theme={null}
conda repo login # You will be prompted to enter your Anaconda Server username and password
```

Now you will be able to install packages from private and authenticated channels you have access to.

## Using the wizard

Use the Anaconda Server CLI `conda repo wizard` command to configure `channels` and `default_channels` while setting a `channel_alias` for them. You can also use the command to backup and restore your `.condarc` file.

1. Log in to your instance of Anaconda Server.

2. Run the command:

   ```sh theme={null}
   conda repo wizard
   ```

3. Enter the channels you want to set to your `default_channels` list, separated by a space. You *must* set a default channel before proceeding.

4. Enter the channels you want to add to the `channels` list, separated by a space. Leave this blank if you do not need to add any additional channels.

<Note>
  Channel names must be exact. Misspelled channel names will not be accepted, for both the `default_channels` and `channels` lists. If you enter a channel name that does not match an existing channel in your instance, a warning appears and no channel is added to the list.
</Note>

Your output will look something like this:

```
Conda configuration wizard.
This wizard will configure your CondaRC file using channels from https://<YOUR_DOMAIN>

The following channels are available:
Name                           | Mirror | Privacy         | Owners
---------------------------------------------------------------------------
main                           |  ︎ ✔    | public          | anaconda-admin
msys2                          |  ︎ ✔    | public          | anaconda-admin
r                              |  ︎ ✔    | public          | anaconda-admin
anaconda-admin                 |  ︎      | public          | anaconda-admin

Provide a space-separated list of channels to set as default_channels
It is common to add mirror channels here.
: main r

If you want to add channels to the "channels" list
provide a space-separated list. You may leave this blank.
:
The following conda configuration will be applied
channel_alias: https://<YOUR_DOMAIN>
default_channels:
  - main
  - r
channels:
  - defaults
Confirm (Your current condarc file will be archived) [Y, n]: y
Backing up your current condarc file to /Users/<USER>/.condarc.backup
```

You can now restore your `.condarc` file at any time, if necessary. To do this, run the command:

```sh theme={null}
conda repo wizard --restore
```

This overwrites your current `.condarc` configuration with the configuration you’ve backed up.

## Further assistance

For a more robust view of conda repo commands, run the command:

```sh theme={null}
conda repo --help
```

Similarly, appending `--help` or the shorthand `-h` to a command will provide you with further actions you can take, such as the following:

```sh theme={null}
conda repo mirror -h
conda repo channel -h
conda repo upload -h
conda repo wizard -h
```
