centos8设置阿里云的安装源
时间: 2023-12-13 09:01:35 浏览: 179
CentOS7阿里云yum源
好的,以下是在 CentOS 8 中设置阿里云的安装源的步骤:
1. 打开阿里云的 CentOS 8 安装源页面:https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.4d1f59b7J6NTE9
2. 根据你的 CentOS 8 版本选择相应的 yum 源,比如选择 CentOS 8.4 版本的 yum 源,复制对应的 BaseRepo 地址,如下所示:
```
https://mirrors.aliyun.com/centos/8.4.2105/BaseOS/x86_64/os/
```
3. 打开终端,使用 root 用户登录,并备份原来的 yum 源配置文件:
```
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
```
4. 创建一个新的 CentOS-Base.repo 配置文件:
```
vi /etc/yum.repos.d/CentOS-Base.repo
```
5. 将下面的内容粘贴到 CentOS-Base.repo 配置文件中:
```
[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
[epel]
name=Extra Packages for Enterprise Linux $releasever - $basearch
baseurl=https://mirrors.aliyun.com/epel/$releasever/$basearch
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-8
enabled=1
```
6. 保存并退出 CentOS-Base.repo 配置文件。
7. 运行以下命令更新 yum 缓存:
```
yum makecache
```
现在你的 CentOS 8 系统就已经成功切换到了阿里云的 yum 源,可以使用 yum 命令安装软件包了。
阅读全文