当前位置:首页 - Linux

centos换源到阿里云

作者:高景洋 日期:2024-07-05 14:25:49 浏览次数:89
一、验证网络是否可以连接阿里云镜像

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

ping mirrors.aliyun.com

二、 手动配置
#删除原yum源
rm -rf /etc/yum.repos.d/*
三、下载阿里云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
四、清除及生成缓存
#清除yum缓存
yum clean all
#缓存阿里云镜像
yum makecache
五、查看yum源信息,已经更换为了阿里云镜像源
yum repolist
本文永久性链接:
<a href="http://r4.com.cn/art239.aspx">centos换源到阿里云</a>
当前header:Host: r4.com.cn X-Host1: r4.com.cn X-Host2: r4.com.cn X-Host3: 127.0.0.1:8080 X-Forwarded-For: 18.119.162.209 X-Real-Ip: 18.119.162.209 X-Domain: r4.com.cn X-Request: GET /art239.aspx HTTP/1.1 X-Request-Uri: /art239.aspx Connection: close Accept: */* User-Agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) Accept-Encoding: gzip, br, zstd, deflate