一键替换RHEL yum

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:31

#/bin/bash
tmpdir=`mktemp -d`
cd $tmpdir
rpm -qa |grep yum |xargs rpm -ev --nodeps
wget [url]http://mirrors.aliyun.com/centos/6.5/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget [url]http://mirrors.aliyun.com/centos/6.5/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget [url]http://mirrors.aliyun.com/centos/6.5/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
wget [url]http://mirrors.aliyun.com/centos/6.5/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
rpm --import [url]http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
rpm -ivh python-*
rpm -ivh yum-*
cd ..
rm -fr $tmpdir
cd /etc/yum.repos.d/
tar cfvz repo.tar.gz * --remove-files
wget -O /etc/yum.repos.d/CentOS-Base.repo [url]http://mirrors.aliyun.com/repo/Centos-6.repo
sed -i "s/\$releasever/6/g" /etc/yum.repos.d/CentOS-Base.repo
yum clean all
yum makecache
exit

本文标签:
本文标题:一键替换RHEL yum
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】