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

 

posted on 2019-09-21 21:59  Ruthless  阅读(1143)  评论(0编辑  收藏  举报