linux更新yum源

先进入到yum源文件cd /etc/yum.repos.d/ 

1、创建一个repo_bak目录,用于保存系统中原来yum的repo文件。

sudo mkdir repo_bak

2、备份yum源文件至repo_bak

sudo mv *.repo repo_bak/

3、到网易和阿里开源镜像站点下载系统对应版本的repo文件

wget http://mirrors.aliyun.com/repo/Centos-7.repo

如果提示: 无法解析主机地址 “mirrors.aliyun.com”

登录root用户,用vim /etc/resolv.conf ,打开rsolv.conf,添加DNS地址:

nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 223.5.5.5
nameserver 223.6.6.6

4、清除系统yum缓存并生成新的yum缓存

yum clean all 清除系统yum 缓存

yum makecache 生成yum缓存

5、安装epel源

yum list | grep epel-release 

yum install -y epel-release

6、使用阿里开源镜像提供的epel源

wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo

7、再次清除系统yum缓存,并重新生成新的yum缓存

yum clean all 清除yum缓存

yum makecache 生成yum缓存

8、查看系统可用的yum源和所有的yum源

yum repolist enabled

posted @   study_php_java_C++  阅读(202)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示