随笔 - 1357  文章 - 0  评论 - 1104  阅读 - 1941万

yum 找不到程序,yum更换国内阿里源

使用百度云服务器,发现百度yum源非常不稳定,果断采用阿里源,操作步骤如下:

一、备份
$ cd /etc/yum.repos.d/
$ mv baidu-bcm.repo baidu-bcm.repo.backup
$ mv CentOS-Base.repo CentOS-Base.repo.backup

二、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
##查看Centos操作系统版本,选择对应的源
$ cat /etc/redhat-release 
##CentOS 5
$ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
##CentOS 6
$ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
##CentOS 7
$ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
 
三、运行yum makecache生成缓存
$ rm -rf /var/cache/yum
$ yum clean all 
$ yum makecache
$ yum update

下载失败,需要更换DNS服务器:

sudo bash -c "echo 'nameserver 8.8.8.8' > /etc/resolv.conf"
sudo bash -c "echo 'nameserver 8.8.4.4' >> /etc/resolv.conf"

  vim /etc/sysconfig/network-scripts/ifcfg-ens33
 然后在最后一行添加上DNS1=8.8.8.8。

 

 

 

 

 

posted on   Ruthless  阅读(1152)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 写一个简单的SQL生成工具
· AI 智能体引爆开源社区「GitHub 热点速览」
历史上的今天:
2018-09-21 公平锁与非公平锁
2018-09-21 如何上传本地代码到码云
2018-09-21 SpringBoot+Mybatis+Pagehelper分页
2018-09-21 SpringBoot集成Mybatis(0配置注解版)
2016-09-21 Eclipse安装ZooKeeper插件
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示