0
0

【云服务器BCC】Centos-stream镜像配置

1月14日20看过

本文提供在云服务器 BCC 中部署和配置Centos-stream镜像的基本指引。

概述

基于Red Hat的开源企业级操作系统(Linux发行版),本目录仅提供 CentOS Stream 9,非 Stream 版的 CentOS 已经停止支持。

下载地址:http://mirrors.baidubce.com/centos-stream/

配置方法

1. 备份原有 repo 文件

# 创建备份文件夹
mkdir -p /etc/yum.repos.d/backup
# 将原配置文件移动至备份文件夹
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/

2. 创建百度镜像源配置文件

# 执行以下命令
cat > /etc/yum.repos.d/baidu.repo << 'EOF'
[baseos]
name=CentOS Stream $releasever - BaseOS - Baidu
baseurl=http://mirrors.baidubce.com/centos-stream/9-stream/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[appstream]
name=CentOS Stream $releasever - AppStream - Baidu
baseurl=http://mirrors.baidubce.com/centos-stream/9-stream/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF

3. 清理并重建缓存

# 清理旧缓存
yum clean all
# 更新缓存
yum makecache

4. 验证源是否生效

# 执行命令:
yum repolist
# appstream和baseos指向Baidu表示配置成功

示例:
[root@rocky95 yum.repos.d]# yum repolist
Repository baseos is listed more than once in the configuration
Repository appstream is listed more than once in the configuration
repo id                                                                        repo name
appstream                                                                  CentOS Stream 9 - AppStream - Baidu
baseos                                                                        CentOS Stream 9 - BaseOS - Baidu
epel                                                                             Extra Packages for Enterprise Linux 9 - x86_64
epel-next                                                                    Extra Packages for Enterprise Linux 9 - Next - x86_64
评论
用户头像