---
title: 配置Yum源
description: "1. 查看Yum源，如果存在外网Yum源（存在后缀为.repo的文件），则直接执行步骤5。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdbs/ecosystemEnable/TiDB/openmind_tidb81_02_0027.html
sourcePath: /source/zh/kunpengdbs/ecosystemEnable/TiDB/openmind_tidb81_02_0027.html
indexId: e4a3104a0f0fae5127a02cb746578f46e75d2292ab8f2d90cefa52180e260a8c71
---
# 配置Yum源

1. 查看Yum源，如果存在外网Yum源（存在后缀为.repo的文件），则直接执行步骤5。
  1 ls /etc/yum.repos.d/

2. 备份Yum源。
  1 2 3 cd /etc/yum.repos.d mkdir bak mv *.repo bak

3. 配置外网Yum源。

  - CentOS 7.6：
    1 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.huaweicloud.com/repository/conf/CentOS-AltArch-7.repo

  - CentOS 8.1：
    1 2 wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo sed -i "s/\$releasever/8-stream/g" /etc/yum.repos.d/CentOS-Base.repo

4. 查看Yum源。
  1 2 ls /etc/yum.repos.d/ cat /etc/yum.repos.d/CentOS-Base.repo

5. 使Yum源生效。
  1 2 3 yum clean all yum makecache yum list
