Linux设置yum源为阿里云镜像源

一、验证网络是否可以连接阿里云镜像

# 验证网络是否可以连接阿里云镜像
ping mirrors.aliyun.com

二、 手动配置

1、删除原yum源

cd /etc/yum.repos.d


# 删除原yum源
rm -rf /etc/yum.repos.d/*

2、下载阿里云Centos-7.repo文件 

# wget命令下载: wget [options] [url]
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

# curl命令下载: curl [options] [url]
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

 3、清除及生成缓存

# 清除yum缓存
yum clean all

# 缓存阿里云镜像
yum makecache

4、查看yum源信息,已经更换为了阿里云镜像源

yum repolist

猜你喜欢

转载自blog.csdn.net/summer_fish/article/details/125623862