RedHat7切换YUM源
1、下载所需要的rpm安装包
https://mirrors.aliyun.com/centos/7/os/x86_64/Packages
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm
注:截止目前安装包是上述版本,如果发现报404错误可以去对比一下最新安装包。
2、安装rpm包
查询yum包和删除yum现有rpm包,删完以后再查看一下,是否删除干净,删除完成后安装刚刚下载好的rpm包,yum包安装时必须取消依赖关系和强制安装。
rpm -qa | grep yum
rpm -qa | grep yum | xargs rpm -e --nodeps
rpm -ivh python-urlgrabber-3.10-10.el7.noarch.rpm
rpm -ivh yum-* --force --nodeps
3、准备CentOS-Base.repo
现有的redhat .repo的包重命名,再下载阿里云的.repo到/etc/yum.repos.d目录下。
mv /etc/yum.repos.d/redhat.repo /etc/yum.repos.d/redhat.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
4、编辑CentOS-Base.repo
修改刚下载的.repo文件,将里面所有$releasever替换为7。
vim /etc/yum.repos.d/CentOS-Base.repo
:%s/$releasever/7/g
替换完输入wq保存一下文件。
5、yum源重构及升级
yum clean all yum makecache
#update可执行可不执行,根据实际环境操作。 yum update
阅读剩余
版权声明:
作者:SE_You
链接:https://www.cnesa.cn/3711.html
文章版权归作者所有,未经允许请勿转载。
THE END