默认情况下红帽的yum是需要注册的,据我所知要钱。而CentOS与RedHat几乎是一样的,所以redhat的软件centos也可用,于是上网查资料没想到还真是可以,所以写了一个备忘录。万一以后还要用到呢。

也希望本文可以帮到有需要的人。

1.查看系统预装的yum rpm包:

rpm - qa | grep yum

以下是我的系统预装的软件(我的是redhat7):

[root@localhost ~]# rpm -qa|grep yum

yum-langpacks-0.4.2-4.el7.noarch

yum-metadata-parser-1.1.4-10.el7.x86_64

yum-3.4.3-132.el7.centos.0.1.noarch

yum-utils-1.1.31-34.el7.noarch

yum-plugin-fastestmirror-1.1.31-34.el7.noarch

yum-rhn-plugin-2.0.1-5.el7.noarch

PackageKit-yum-1.0.7-5.e17.x86_64

2.卸载上面的rpm包:

rpm -e yum-langpacks-0.4.2-4.el7.noarch --nodeps

后面的卸载方式依照上面。

3.更改yum仓库:

cd /etc/yum.repos.d/

wget  http://mirrors.163.com/.help/CentOS7-Base-163.repo

下載文件:

http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

其他对应即可。

下载centos 的rpm包:

对应你卸载的rpm包下载:(我卸载了这些所以我下载这些)

yum-langpacks-0.4.2-4.el7.noarch

yum-metadata-parser-1.1.4-10.el7.x86_64

yum-3.4.3-132.el7.centos.0.1.noarch

yum-utils-1.1.31-34.el7.noarch

yum-plugin-fastestmirror-1.1.31-34.el7.noarch

yum-rhn-plugin-2.0.1-5.el7.noarch

PackageKit-yum-1.0.7-5.e17.x86_64

下载地址:

http://mirrors.163.com/centos/7/os/x86_64/Packages/

4.安装rpm包:

rpm -ivh yum-3.4.3-132.el7.centos.0.1.noarch.rpm yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm

上面两个包要一起安装,不然会有依赖错误

在安装其他的rpm包

5.清除缓存:

yum clean all

6.建立緩存:

yum makecache

如果出現一下報錯:

[root@localhost ~]# yum makecache

Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-

: manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Could not retrieve mirrorlist http://mirrorlist.centos.org/7=$releasever&arch=x86_64&repo=os error was

14: HTTP Error 404 - Not Found

http://mirrors.163.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found

Trying other mirror.

To address this issue please refer to the below knowledge base article

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

One of the configured repositories failed (CentOS-$releasever - Base - 163.com),

and yum doesn't have enough cached data to continue. At this point the only

safe thing yum can do is fail. There are a few ways to work "fix" this:

1. Contact the upstream for the repository and get them to fix the problem.

2. Reconfigure the baseurl/etc. for the repository, to point to a working

upstream. This is than is supported by the repository (and the

packages for the previous distribution release still work).

3. Disable the repository, so yum won't use it by default. Yum will then

just ignore the repository until you permanently enable it again or use

--enablerepo for temporary usage:

yum-config-manager --disable base

4. Configure the failing repository to be skipped, if it is unavailable.

Note that yum will try to contact the repo. when it runs most commands,

so will have to try and fail each time (and thus. yum will be be much

slower). If it is a very temporary problem though, this is often a nice

compromise:

yum-config-manager --save --setopt=base.skip_if_unavailable=true

failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.

http://mirrors.163.com/centos/$releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found most often useful if you are using a newer

distribution release than is supported by the repository (and the

packages for the previous distribution release still work).

3. Disable the repository, so yum won't use it by default. Yum will then

just ignore the repository until you permanently enable it again or use

--enablerepo for temporary usage:

yum-config-manager --disable base

4. Configure the failing repository to be skipped, if it is unavailable.

Note that yum will try to contact the repo. when it runs most commands,

so will have to try and fail each time (and thus. yum will be be much

slower). If it is a very temporary problem though, this is often a nice

compromise:

yum-config-manager --save --setopt=base.skip_if_unavailable=true

failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.

http://mirrors.163.com/centos/$releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found

将/etc/yum.repos.d/CentOS7-Base-163.repo 文件中的$releasever替换成你的系统版本号即可。

到此yum已经替换好了。

可以用yum安装软件了:

[root@localhost ~]# yum install telnet

Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-

: manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile

Resolving Dependencies

--> Running transaction check

---> Package telnet.x86_64 1:0.17-59.el7 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================

Package            Arch                Version                      Repository        Size

===============================================================================================

Installing:

telnet              x86_64              1:0.17-59.el7                base              63 k

Transaction Summary

===============================================================================================

Install  1 Package

Total download size: 63 k

Installed size: 113 k

Is this ok [y/d/N]: y

Downloading packages:

telnet-0.17-59.el7.x86_64.rpm                                          |  63 kB  00:00:02

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Installing : 1:telnet-0.17-59.el7.x86_64

Verifying  : 1:telnet-0.17-59.el7.x86_64

Installed:

telnet.x86_64 1:0.17-59.el7

Complete!

附上我的yum仓库文件:

# 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-$releasever - Base - 163.com

#mirrorlist=http://mirrorlist.centos.org/7=$releasever&arch=$basearch&repo=os

baseurl=http://mirrors.163.com/centos/7/os/$basearch/

gpgcheck=1

gpgkey=

#released updates

[updates]

name=CentOS-$releasever - Updates - 163.com

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

baseurl=http://mirrors.163.com/centos/7/updates/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras - 163.com

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

baseurl=http://mirrors.163.com/centos/7/extras/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus - 163.com

baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

欢迎大家指正错误!!

更多YUM相关教程见以下内容:

红帽企业linux7 u盘安装,RedHat企业版7 “yum”重装 CentOS7 “yum”相关推荐

  1. 优盘安装红帽linux系统,从U盘安装 redhat linux 6.0及centos 6.4

    从U盘安装 redhat linux 6.0及centos 6.4 (2013-09-20 19:17:05) 标签: 从u盘安装linux 以前我使用linuxlive usb creator.Ut ...

  2. 无光驱安装redhat企业版

    终于把redhat企业版给装上了,其间差点就去买个刻录机了.现在和大家分享下如何无光驱安装redhat企业版. 下载Universal-USB-Installer.exe,选择try some oth ...

  3. ThinkServer RD640 上安装redhat企业版6.5

    yum报错,提醒没有注册. 考虑省钱省心,自己把yum源改成centOS的yum,步骤如下 1 删除redhat自带的yum包 rpm -qa|grep yum|xargs rpm -e --node ...

  4. 红帽企业Linux发行日期

    下表列出了Red Hat Enterprise Linux的主要和次要更新,发行日期以及随附的内核版本. 红帽通常不会透露未来的发布时间表. 有关红帽企业版Linux生命周期的详细信息,请参考< ...

  5. U盘安装Redhat5 总结

    原文转自:http://blog.csdn.net/cang_rong2046/article/details/5549950 网络文献参考方法一: 借助于unetbootin,可以快速的将你的U盘制 ...

  6. 【系统运维-Linux】使用U盘安装Linux

    转载自:http://www.xiaobaixitong.com/jiaocheng/13194.html 最近关于用u盘安装redhat的问题实在是太火了,很多朋友都想要学习u盘装redhat的方法 ...

  7. U盘安装Windows 10 系统教程

    系统出现问题,Win系统如何重装呢?如果系统不能够正常进入的情况下,建议采用U盘安装Win的方法来重装系统,下面我们来看下U盘装Win系统的详细步骤.安装此系统前需制作好装机版U盘启动盘,可在软件目录 ...

  8. mac装linux iso不用u盘安装,在任何mac上用u盘安装OSX和Windows10双系统的方法(支持老电脑、不用Bootcamp)...

    Win10是微软主推的,兼容性做的还不错,安装工具做的适应性好. 而且很多Mac机上的Bootcamp不支持u盘安装. 1.先安装OSX,一般电脑自带(建议升级到最新版).如果装了新的ssd,重新安装 ...

  9. linux红帽网页中文乱码解决,【linux学习笔记】安装redhat时中文显示乱码(小方框)解决方法...

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 ------------------------------------- 防抽------------------------------------- ...

  10. U6 Redhat系统的U盘安装-孙宇彤-专题视频课程

    U6 Redhat系统的U盘安装-2139人已学习 课程介绍         本课程是<U盘分区与启动>课程的深化,聚焦于企业中广泛应用的Redhat系统,介绍用U盘来启动和安装Redha ...

最新文章

  1. 远程为服务器安装Windows 2008 Server
  2. react 动态添加class_02.react进阶指南
  3. 各种优秀依赖库,大赞
  4. istio回归「单体应用」对我们的启发
  5. 2014年JAVA省赛B组---第四题---大衍数列
  6. 【渝粤题库】陕西师范大学201381 国际经济法作业
  7. 合并果子(Vijos P1097)
  8. Java 调用 Python 方法学习笔记
  9. 【腾讯优测干货分享】使用多张图片做帧动画的性能优化
  10. crontab关于 >/dev/null 2>1输出重定向问题
  11. 计算机网络安全 第一章绪论
  12. opencv4 python电子书_OpenCV轻松入门面向Python下载-OpenCV轻松入门面向Python电子书pdf免费版-精品下载...
  13. html编写学生注册表,IT之家网友分享:如何自己编写一个注册表文档
  14. cat3 utp是不是网线_五类100对屏蔽双绞线UTPCAT3
  15. Omni-ID 推出2款有源RFID标签
  16. 万字长文 | 面向k8s编程,如何写一个Operator
  17. 看过来,u盘删除的文件还能找回吗?两种方法教给你
  18. java实现的聊天程序
  19. DATAGUARD原理
  20. C++课程--设计设计思想、方法与模式(李建忠老师)

热门文章

  1. maya python 游戏与影视编程指南_Maya Python 游戏与影视编程指南
  2. HTML创建几个边框,使用HTML5创建多个边框
  3. mysql创建jdbc数据库_创建本地数据库mySQL并连接JDBC
  4. 19. Django进阶:分页
  5. Oracle 11g ora 15018,OracleASM错误之--ORA-15031、ORA-15014
  6. 论文笔记_S2D.58_2018-ICRA-基于直接法的使用LiDAR稀疏深度的视觉-激光雷达SLAM
  7. opencv程序在未安装opencv环境下运行方法总结
  8. CVPR 2022 Oral | 目标检测新工作!南大开源AdaMixer:快速收敛的基于查询的目标检测器...
  9. 实操教程:Android部署Nanodet模型完成实时高效的物体检测
  10. App客户端性能测试点总结