Miniconda 的 RPM 和 Debian 存储库#
Conda 可以作为 RedHat RPM 或 Debian 包使用。这些包等效于 Miniconda 安装程序,其中仅包含 conda 及其依赖项。您可以使用 yum 或 apt 在您的系统上安装、卸载和管理 conda。要安装 conda,请按照适用于您的 Linux 发行版的说明进行操作。
要在 RedHat、CentOS、Fedora 发行版以及其他基于 RPM 的发行版(如 openSUSE)上安装 RPM,请下载 GPG 密钥并为 conda 添加存储库配置文件。
# Import our GPG public key
rpm --import https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc
# Add the Anaconda repository
cat <<EOF > /etc/yum.repos.d/conda.repo
[conda]
name=Conda
baseurl=https://repo.anaconda.com/pkgs/misc/rpmrepo/conda
enabled=1
gpgcheck=1
gpgkey=https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc
EOF
Conda 现在已准备好安装在您的基于 RPM 的发行版上。
# Install it!
yum install conda
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: repo1.dal.innoscale.net
* extras: mirrordenver.fdcservers.net
* updates: mirror.tzulo.com
Resolving Dependencies
--> Running transaction check
---> Package conda.x86_64 0:4.5.11-0 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================
Package Arch Version Repository Size
===============================================================================
Installing:
conda x86_64 4.5.11-0 conda 73 M
Transaction Summary
===============================================================================
Install 1 Package(s)
Total download size: 73 M
Installed size: 210 M
Is this ok [y/N]:
要在基于 Debian 的 Linux 发行版(如 Ubuntu)上安装,请下载公共 GPG 密钥并将 conda 存储库添加到源列表。
# Install our public GPG key to trusted store
curl https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > conda.gpg
install -o root -g root -m 644 conda.gpg /usr/share/keyrings/conda-archive-keyring.gpg
# Check whether fingerprint is correct (will output an error message otherwise)
gpg --keyring /usr/share/keyrings/conda-archive-keyring.gpg --no-default-keyring --fingerprint 34161F5BF5EB1D4BFBBB8F0A8AEB4F8B29D82806
# Add our Debian repo
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" > /etc/apt/sources.list.d/conda.list
**NB:** If you receive a Permission denied error when trying to run the above command (because `/etc/apt/sources.list.d/conda.list` is write protected), try using the following command instead:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" | sudo tee -a /etc/apt/sources.list.d/conda.list
Conda 现在已准备好安装在您的基于 Debian 的发行版上。
# Install it!
apt update
apt install conda
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
conda
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 76.3 MB of archives.
After this operation, 221 MB of additional disk space will be used.
Get:1 https://repo.anaconda.com/pkgs/misc/debrepo/conda stable/main amd64
conda amd64 4.5.11-0 [76.3 MB]
Fetched 76.3 MB in 10s (7733 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package conda.
(Reading database ... 4799 files and directories currently installed.)
Preparing to unpack .../conda_4.5.11-0_amd64.deb ...
Unpacking conda (4.5.11-0) ...
Setting up conda (4.5.11-0) …
通过键入以下命令查看安装是否成功
source /opt/conda/etc/profile.d/conda.sh
conda -V
conda 4.5.11
使用系统包管理器安装 conda 包使在运行 Linux 的机器集群中分发 conda 变得非常容易,而无需担心任何非特权用户修改安装。任何非特权用户只需运行 source /opt/conda/etc/profile.d/conda.sh
即可使用 conda。
管理员还可以分发位于 /opt/conda/.condarc 的 .condarc 文件,以便将通道、包缓存目录和环境位置的预定义配置预先播种到大型组织中的所有用户。示例配置可能如下所示
channels:
- defaults
pkg_dirs:
- /shared/conda/pkgs
- $HOME/.conda/pkgs
envs_dirs:
- /shared/conda/envs
- $HOME/.conda/envs
这些 RPM 和 Debian 包还提供另一种在 Docker 容器内设置 conda 的方法。
提示
建议以只读方式使用此安装方法,并且仅使用相应的包管理器升级 conda。