Linux-openeuler更换yum镜像源

将 openEuler 系统镜像源更换为华为镜像 以openEuler 24.03 LTS SP1 为例。操作前建议备份原配置文件,并确保系统已联网。

一、确认系统版本与架构

  1. 查看系统版本

    bash 复制代码
     [root@eulerzy yum.repos.d]# cat /etc/os-release
    	NAME="openEuler"
    	VERSION="24.03 (LTS-SP1)"
    	ID="openEuler"
    	VERSION_ID="24.03"
    	PRETTY_NAME="openEuler 24.03 (LTS-SP1)"
    	ANSI_COLOR="0;31"
  2. 确认架构

    bash 复制代码
    [root@eulerzy yum.repos.d]# uname -m
    x86_64

    常见输出为 x86_64(Intel/AMD 架构)或 aarch64(鲲鹏架构)。

二、备份原镜像源配置

  1. 进入配置目录

    bash 复制代码
    cd /etc/yum.repos.d/
  2. 备份原 repo 文件

    bash 复制代码
     cp openEuler.repo openEuler.repo.back

    若存在其他 .repo 文件(如 epel.repo),建议一并备份或删除。

三、创建华为镜像源配置文件

  1. 新建配置文件

    bash 复制代码
    sudo vim /etc/yum.repos.d/huawei-openeuler.repo
  2. 粘贴以下内容 ,华为开源镜像地址:OpenEuler 24.03-LTS-SP1/x86_64

    bash 复制代码
     [openEuler-everything]
     name=openEuler-everything
     baseurl=https://mirrors.huaweicloud.com/openeuler/openEuler-24.03-LTS-SP1/everything/x86_64/
     enabled=1
     gpgcheck=0
     gpgkey=https://mirrors.huaweicloud.com/openeuler/openEuler-24.03-LTS-SP1/everything/x86_64/RPM-GPG-KEY-openEuler
             
     [openEuler-EPOL]
     name=openEuler-epol
     baseurl=https://mirrors.huaweicloud.com/openeuler/openEuler-24.03-LTS-SP1/EPOL/main/x86_64/
     enabled=1
     gpgcheck=0
     
     [openEuler-update]
     name=openEuler-update
     baseurl=https://mirrors.huaweicloud.com/openeuler/openEuler-24.03-LTS-SP1/update/x86_64/
     enabled=1
     gpgcheck=0

四、清理缓存并生成新元数据

  1. 清除旧缓存

    bash 复制代码
    sudo dnf clean all
  2. 生成新缓存

    bash 复制代码
    dnf makecache

    若提示 Metadata cache created,表示配置成功。

    复制代码
    [root@eulerzy yum.repos.d]# dnf makecache
     openEuler-everything                                                                                                  2.4 MB/s |  16 MB     00:06    
     openEuler-epol                                                                                                        5.3 MB/s | 5.7 MB     00:01    
     openEuler-update                                                                                                      4.1 MB/s |  10 MB     00:02    
     Last metadata expiration check: 0:00:02 ago on 2025年05月08日 星期四 15时33分13秒.
     Metadata cache created.

五、验证镜像源

  1. 查看可用仓库

    bash 复制代码
    dnf repolist

    输出应包含 huawei-openeuler 相关仓库,例如:

    复制代码
     [root@eulerzy yum.repos.d]# dnf repolist
     repo id                                                                    repo name
     openEuler-EPOL                                                             openEuler-epol
     openEuler-everything                                                       openEuler-everything
     openEuler-update                                                           openEuler-update
  2. 测试软件安装

    bash 复制代码
    sudo dnf install -y wget

    若能正常下载并安装 wget,说明镜像源已生效。

相关推荐
阿里云大数据AI技术14 小时前
阿里云 EMR AI 助手正式发布:从问答工具到全栈智能运维助手
运维·人工智能
你好潘先生20 小时前
别再记命令了,用 yeero do 说句人话就能跑脚本,而且不烧 token
服务器·python·命令行
orion571 天前
Missing Semester Class1:course overview and introduction of shell
linux
SkyWalking中文站2 天前
认识 Horizon UI · 6/17:Trace 探索器
运维·监控·自动化运维
用户120487221612 天前
Linux驱动编译与加载
linux·嵌入式
程序员老赵2 天前
服务器文件不想 SFTP 上传?Docker 跑个 File Browser,浏览器就能管理
服务器·docker·开源
火车叼位2 天前
写给初级开发者:SSL、SSH、HTTPS 与证书体系全解析
运维
vivo互联网技术2 天前
从 10 分钟到 1 秒:ES 深度分页任意跳页的三轮优化实战
服务器·数据库·redis·elasticsearch·深度分页
用户805533698032 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式