博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
redhat6.4更换centos 6 的 yum源
阅读量:6853 次
发布时间:2019-06-26

本文共 3071 字,大约阅读时间需要 10 分钟。

  hot3.png

#!/bin/bash

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# Check if user is root
if [ $(id -u) != "0" ]; then
    echo "Error: You must be root to run this script"
    exit 1
fi
clear
echo "========================================================================="
echo "Replace Redhat Enterprise Yum to CentOS Yum and Repos,  Written by Licess"
echo "========================================================================="
# uninstall rhel yum 
echo "Uninstall Rhel Yum......"
rpm -qa|grep yum|xargs rpm -e --nodeps
# delete old rpm
echo "Clean old cache......"
rm -rf python-iniparse-0.3.1-2.1.el6.noarch.rpm
rm -rf yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rm -rf yum-3.2.29-40.el6.centos.noarch.rpm
rm -rf yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
# download CentOS Yum
echo "Download Python-iniparse......"
wget 
echo "Download yum-metadata-parse......"
wget  
echo "Download yum......"
wget 
echo "Download yum fastmirror......"
wget 
# install CentOS Yum
echo "Installing......"
rpm -ivh  python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh  yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh  yum-3.2.29-60.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
# replace repos
rm -rf /etc/yum.repos.d/CentOS-Base.repo
echo "[base]
name=CentOS-6.4 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6.4/os/x86_64/
#mirrorlist=http://mirrors.163.com/?release=6.4&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#released updates 
[updates]
name=CentOS-6.4 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6.4/updates/x86_64/
#mirrorlist=http://mirrors.163.com/?release=6.4&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6.4 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6.4/extras/x86_64/
#mirrorlist=http://mirrors.163.com/?release=6.4&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.4 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6.4/centosplus/x86_64/
#mirrorlist=http://mirrors.163.com/?release=6.4&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.4 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6.4/contrib/x86_64/
#mirrorlist=http://mirrors.163.com/?release=6.4&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6" >> /etc/yum.repos.d/CentOS-Base.repo
#####
yum clean all
yum makecache
yum update
echo "=========================================================================="
echo "You have successfully replace RedhatEnterprise Yum to CentOS yum and repos"
echo "=========================================================================="

转载于:https://my.oschina.net/duolus/blog/348256

你可能感兴趣的文章
技术总结:自动扩张WPF树型表格列宽
查看>>
使用wxWidgets for C++从资源文件中静态装载图像
查看>>
WINSTC(windows remote server/run time/remote client)自己想的b/s方案
查看>>
oc54--auatorelease应用场景
查看>>
Ext.Net全部Icon图标名称展示
查看>>
RHEL7.0 配置网络IP的三种方法
查看>>
使用endmqm 命令无法停止MQ队列管理器,怎么办?
查看>>
ArcGIS中ObjectID,FID和OID字段区别
查看>>
Linux 小知识翻译 - 「Linux和CPU的兼容性」
查看>>
docker数据拷贝
查看>>
ejs模板中的四种表达式输出形式
查看>>
innerHTML与innerText的异同
查看>>
【阿里云MVP Meetup 第五期】如何使用Elasticsearch进行智能运维
查看>>
学习笔记:md5加密算法极其应用(转)
查看>>
Azure ARM (17) 基于角色的访问控制 (Role Based Access Control, RBAC) - 自定义Role
查看>>
beginner3
查看>>
QT Creater + vs2010 发布程序
查看>>
android adb shell 总结
查看>>
闲话WPF之二五(WPF中的ControlTemplate [3])
查看>>
JavaScript之web通信
查看>>