logo

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

作者:CodeSlinger2025.12.04 17:43浏览量:8

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

概述

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

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



配置方法

1. 备份原有 repo 文件

 
 
  1. mkdir -p /etc/yum.repos.d/backup
  2. mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/



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

 
 
  1. cat > /etc/yum.repos.d/baidu.repo << 'EOF'
  2. [baseos]
  3. name=CentOS Stream $releasever - BaseOS - Baidu
  4. baseurl=http://mirrors.baidubce.com/centos-stream/9-stream/BaseOS/$basearch/os/
  5. gpgcheck=1
  6. enabled=1
  7. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
  8. [appstream]
  9. name=CentOS Stream $releasever - AppStream - Baidu
  10. baseurl=http://mirrors.baidubce.com/centos-stream/9-stream/AppStream/$basearch/os/
  11. gpgcheck=1
  12. enabled=1
  13. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
  14. EOF



3. 清理并重建缓存

 
 
  1. yum clean all
  2. yum makecache



4. 验证源是否生效

 
 
  1. Repository baseos is listed more than once in the configuration
  2. Repository appstream is listed more than once in the configuration
  3. repo id repo name
  4. appstream CentOS Stream 9 - AppStream - Baidu
  5. baseos CentOS Stream 9 - BaseOS - Baidu
  6. epel Extra Packages for Enterprise Linux 9 - x86_64
  7. epel-next Extra Packages for Enterprise Linux 9 - Next - x86_64

相关文章推荐

发表评论