禁用 RHEL 的每个仓库配置

修改目录 /etc/yum.repos.d  下每个文件,将 enable=1 改为 enable=0,或者也可以将这个目录清空

建立 CentOS 的配置 /etc/yum.repos.d/centos.repo ,内容为:

[CentOS5 base]
name=CentOS-5-Base
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=os
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[CentOS5 updates]
name=CentOS-5-Updates
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=updates
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[CentOS5plus]
name=CentOS-5-Plus
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

这些仓库需要 GPG 验证,还需要把公钥复制下来。 或者也可以将 centos.repo 中 gpgcheck=1 改为 gpgcheck=0 来避免验证:

rpm --import http://isoredirect.centos.org/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

测试是否可用

[plain] view plaincopyprint?
  1. # yum list available
  2. Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
  3. This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
  4. Bad id for repo: CentOS5 base, byte =   7
  5. Bad id for repo: CentOS5 updates, byte =   7

上面的仓库地址是在 这里 找到的,因为 仓库 ID 带了空格造成 错误 Bad id for repo: CentOS5 base, byte =   7,去掉空格就可以了

Bad id 说的就是 repo 文件中方括号中的 仓库 ID, byte = 7 为引起错误的地方

对于 “This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register” 问题

可在使用 yum 时禁用相应插件,如:

[plain] view plaincopyprint?
  1. yum --disableplugin=subscription-manager list available

或 将 /etc/yumconf 中 plugins=1 改为 plugins=0 来禁用所有插件

也可以禁用指定插件,在 /etc/yum/pluginconf.d 下找到插件对应的文件 ,如要禁用 subscription-manager 插件,修改 /etc/yum/pluginconf.d/subscription-manager.conf 文件

将 enabled=1 改为 enabled=0 即可

如果要得到更好的支持,可以把 CentOS 的 Release Node : centos-release 和 centos-release-notes 安装上

wget http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-1.noarch.rpm
yum install epel-release-7-1.noarch.rpm

或者用 rpm -ivh epel-release-7-1.noarch.rpm 安装

查看是否安装成功:

yum repolist

二、redhat配置centos源

vi /etc/yum.repos.d/CentOS-Base.repo

[base]

name=CentOS-5-Base

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&repo=os

#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

baseurl=http://ftp.sjtu.edu.cn/centos/7/os/$basearch/

gpgcheck=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

#released updates

[updates]

name=CentOS-$releasever – Updates

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

baseurl=http://ftp.sjtu.edu.cn/centos/7/updates/$basearch/

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[extras]

name=CentOS-$releasever – Extras

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

baseurl=http://ftp.sjtu.edu.cn/centos/7/extras/$basearch/

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

b[centosplus]

name=CentOS-$releasever – Plus

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

baseurl=http://ftp.sjtu.edu.cn/centos/7/centosplus/$basearch/

gpgcheck=0

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
rpm -qa gpg-pubkey

1 删除rhel自带的yum包:

  1. rpm -aq | grep yum |xargs rpm -e --nodeps

2 安装yum:

  1. [china~/yum_64#]rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
  2. warning:python-iniparse-0.3.1-2.1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, keyID c105b9de: NOKEY
  3. Preparing...               ########################################### [100%]
  4. packagepython-iniparse-0.3.1-2.1.el6.noarch is already installed
  5. [china~/yum_64#]rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
  6. warning:yum-metadata-parser-1.1.2-16.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, keyID c105b9de: NOKEY
  7. Preparing...               ########################################### [100%]
  8. 1:yum-metadata-parser    ###########################################[100%]
  9. [china~/yum_64#]rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpmyum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
  10. warning:yum-3.2.29-40.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key IDc105b9de: NOKEY
  11. Preparing...               ########################################### [100%]
  12. 1:yum-plugin-fastestmirro########################################### [50%]
  13. 2:yum                   ########################################### [100%]
  14. [ichina~/yum_64#]

若提示需要依赖

  1. libc.so.6 is neededby yum-metadata-parser-1.1.2-16.el6.i686
  2. libc.so.6(GLIBC_2.0)is needed by yum-metadata-parser-1.1.2-16.el6.i686
  3. libc.so.6(GLIBC_2.1.3)is needed by yum-metadata-parser-1.1.2-16.el6.i686
  4. libglib-2.0.so.0 is needed by yum-metadata-parser-1.1.2-16.el6.i686
  5. libpthread.so.0 is needed by yum-metadata-parser-1.1.2-16.el6.i686
  6. libpython2.6.so.1.0 is needed by yum-metadata-parser-1.1.2-16.el6.i686
  7. libsqlite3.so.0 is needed by yum-metadata-parser-1.1.2-16.el6.i686
  8. libxml2.so.2 is needed by yum-metadata-parser-1.1.2-16.el6.i686
  9. libxml2.so.2(LIBXML2_2.4.30) is needed by yum-metadata-parser-1.1.2-16.el6.i686

安装: glibc-2.12-1.107.el6.x86_64.rpm http://pkgs.org/centos-6/centos-x86_64/glibc-2.12-1.132.el6.x86_64.rpm.html

3 添加网易163的yum源

获取文件:CentOS6-Base-163.repo

  1. wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
  2. cp CentOS-Base-163.repo rhel-source.repo
  3. sed -i 's/\$releasever/6/g' rhel-source.repo

4 清空 yum 缓存

  1. yum clean all

5 将服务器上的软件包信息缓存到本地

提高yum的更新效率

  1. yum makecache

rhel源更换为centos源相关推荐

  1. pip、conda源更换为清华源、查看源、删除源

    一.pip 使用pip默认的镜像在国外,网络连接较差,下载速度比较慢 D:\pythonProject3\Django>pip install Django==2.1.3 Collecting ...

  2. centos安装软件【google浏览器,QQ】【拷贝旧的文件源作为备份】【软件源更换为清华源】

    centos7.8(2003)安装google浏览器[2020-8-26] 用linux自带浏览器打开google网站 自动识别当前系统的安装版本 https://www.google.cn/chro ...

  3. pip源更换为清华源_kali2020更换国内的源

    kali2020更换国内的源 博客说明 文章所涉及的资料来自互联网整理和个人总结,意在于个人学习和经验汇总,如有什么地方侵权,请联系本人删除,谢谢! 说明 在使用kali的时候总是很慢,所以一般使用l ...

  4. pip源更换为清华源

    使用pip默认的镜像在国外,网络连接较差,下载速度比较慢 D:\pythonProject3\Django>pip install Django==2.1.3 Collecting Django ...

  5. CentOS7 中怎么把yum的源更换成163源

    CentOS默认yum源是国外的,今天我们把默认源换成国内的163源,163是目前国内最好用的源,速度是相当快的,还有一些比较好的源,比如阿里源. 1,进入yum源配置文件 cd /etc/yum.r ...

  6. CentOS7 中把yum源更换成163源

    CentOS默认yum源是国外的, 速度无法保证,用起来很不爽,今天我们把默认源换成国内的163源,163是目前国内最好用的源,速度是相当快的,还有一些比较好的源,比如阿里源. 1,首先我们把Cent ...

  7. Deepin更换镜像源,更换系统软件更新源方法完整整理用html书写。

    个人博客同文链接:http://www.987931.top/index.php/archives/4/ 首次安装Deepin使用一定要做的事,Deepin更换镜像源,换源教程. Deepin更换镜像 ...

  8. armbian 斐讯n1_斐讯N1刷入Armbian 更换国内系统源更换国内软件源修改DNS

    修改方法:nano /etc/apt/sources.list.d/armbian.list deb http://mirrors.nju.edu.cn/armbian/ bionic main bi ...

  9. Linux配置清华大学yum源,更换清华大学yum源

    清华大学开元软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/help/centos/ mv /etc/yum.repos.d/CentOS-Base.repo / ...

  10. 将Centos的yum源更换为国内的阿里云源

    为什么80%的码农都做不了架构师?>>>    CentOS系统更换软件安装源 第一步:备份你的原镜像文件,以免出错后可以恢复. mv /etc/yum.repos.d/CentOS ...

最新文章

  1. Aras学习笔记(1)学习Aras已半年有余,也积攒一些学习笔记,今天起会陆续分享出来,有兴趣的朋友一起交流...
  2. pytorch one-hot转数组
  3. (转)所有iOS设备的屏幕分辨率
  4. mfc 监控文件操作_实战经验:使用CFileDialog实现多个文件选择
  5. 云存储精华问答 | 如何选择云迁移策略?
  6. 2.0版本中如何取得当前的控制器和方法
  7. 通用版程序在the new iPad与Xcode4.3中的不兼容。
  8. OpenCV-膨胀cv::dilate
  9. spring mvc-基础-简单程序
  10. centos7 install pip
  11. WAF实现扫描器识别
  12. Python 大数据的进行信用卡欺诈检测(附源码与注释)
  13. EDA365 V2.5下载
  14. word目录生成JAVA_aspose word for java添加页码并自动生成目录
  15. 数字图像处理实验八--图像分割
  16. 漫画:位运算技巧整理汇总+一道被嫌弃的题目
  17. channel(3) 一 基本定义
  18. 转自51cto(http://smailes.blog.51cto.com/rss.php?uid=28248)
  19. 正则表达式详解(三、常用符号的使用)
  20. 让智能更落地,让中台更智能

热门文章

  1. Factory Method 抽象工厂模式(创建型)
  2. linux NFS共享
  3. Security+ 学习笔记26 业务连续性
  4. 使用Python调用ASA rest API进行配置
  5. OSPFv3中LSA详解(七)——Type4类LSA详解
  6. docker容器详解(入门必看)(一)
  7. 使用ImessageFilter接口实现截获键盘或者鼠标的消息
  8. 窥探源码,让我更加优雅的使用Kafka生产者!
  9. 验证码识别——基于CNN+BLSTM+CTC秒杀不定长复杂验证码
  10. hdoj1176 免费馅饼(dp 数塔)