CentOS7 更换为阿里镜像源

  1. 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  1. 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

如果提示-bash: wget: command not found,则需要将步骤1中的备份文件还原,然后安装wget

yum install wget -y
  1. 添加EPEL
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  1. 更新
# 清除缓存目录下的软件包及旧的 headers
yum clean all
# 生成缓存
yum makecache -y
# 升级所有包同时也升级软件和系统内核(看个人需要)
# yum update -y
posted @ 2022-02-27 22:30  mayhot  阅读(298)  评论(0编辑  收藏  举报