一、删除原来的yum源
1、检查yum源:
2、删除原来的yum源
- rpm -qa|grep yum|xargs rpm -e --nodeps
复制代码 3、防止系统自带的插件subscription-manager订阅管理器进行注册
- vi /etc/yum/pluginconf.d/subscription-manager.conf
- #enabled=1
复制代码 二、拷贝这三个安装包
如果没有可以从这个地址下载:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
yum-3.4.3-168.el7.centos.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
三、安装三个包
1、使用以下下令一次性安装3个包
2、检查是否安装成功
四、设置repo文件
1、在linux中进入etc文件,备份yum.repos.d文件
- cd /etc
- mv yum.repos.d yum.repos.d.bak
- mkdir yum.repos.d
复制代码 2、下载repo文件
- wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
复制代码 或者
- wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
复制代码 3、修改下载好的repo文件
下载好的repo文件应该在etc/yum.repos.d目录下,里面应该也只有一个文件,直接vim 文件名
- vim /etc/yum.repos.d/CentOS-Base.repo
复制代码 把repo文件里全部 $releasever全部更换成版本号7
操作如下:
按下i键,然后按:
输入下令:
更换完毕后,按Esc,然后 :wq 生存退出vim模式
2)-3)也可以手工放入
- # CentOS-Base.repo
- #
- # The mirror system uses the connecting IP address of the client and the
- # update status of each mirror to pick mirrors that are updated to and
- # geographically close to the client. You should use this for CentOS updates
- # unless you are manually picking other mirrors.
- #
- # If the mirrorlist= does not work for you, as a fall back you can try the
- # remarked out baseurl= line instead.
- #
- #
-
- [base]
- name=CentOS-7 - Base - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
- http://mirrors.aliyuncs.com/centos/7/os/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
- gpgcheck=1
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
-
- #released updates
- [updates]
- name=CentOS-7 - Updates - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
- http://mirrors.aliyuncs.com/centos/7/updates/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/
- gpgcheck=1
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
-
- #additional packages that may be useful
- [extras]
- name=CentOS-7 - Extras - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
- http://mirrors.aliyuncs.com/centos/7/extras/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/
- gpgcheck=1
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
-
- #additional packages that extend functionality of existing packages
- [centosplus]
- name=CentOS-7 - Plus - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
- http://mirrors.aliyuncs.com/centos/7/centosplus/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/centosplus/$basearch/
- gpgcheck=1
- enabled=0
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
-
- #contrib - packages by Centos Users
- [contrib]
- name=CentOS-7 - Contrib - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/
- http://mirrors.aliyuncs.com/centos/7/contrib/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/
- gpgcheck=1
- enabled=0
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
复制代码 4、清除缓存
5、重新天生缓存
6、yum 更新
- yum updateyum clean all
- && yum makecache
- && yum update
复制代码 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |