Centos切换yum源

Centos切换yum源

常用命令

#查看内核/操作系统/CPU信息
uname -a
#查看yum源
yum list repolist all

切换步骤

1.备份yum源文件

cp -a /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

2.下载新的CentOS-Base.repo文件到/etc/yum.repos.d/目录下

#Centos7
wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
#CentOS 8
wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo

3.清除缓存

yum clean all

4.刷新缓存

yum makecache

你可能感兴趣的:(centos,linux,运维)