1. 检查是否安装yum包
[root@node1 rpms]# rpm -qa|grep yum

2. 删除自带的yum包
[root@node1 rpms]# rpm -qa|grep yum|xargs rpm -e --nodeps
因为一些包之间可能会有依赖关系,所以我们需要加上参数 --nodeps 无视依赖关系。

3. 下载yum包
Yum包下载地址http://mirrors.163.com/centos/
在这个网站里,你可以自己选择需要下载的文件,进入形如5/或者6/的文件下载,其他的无法下载。

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

4. 安装yum包
[root@node1 rpms]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
[root@node1 rpms]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
[root@node1 rpms]# rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

或者用以下命令
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm --force --nodeps

5. 替换yum源

[root@node2 /]# cd /etc/yum.repos.d/
[root@node2 yum.repos.d]# cat CentOS6-Base-163.repo
# 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-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

如果wget http://mirrors.163.com/.help/CentOS6-Base-163.repo 下载的,需要修改下里面的变量。

6. 清除缓存:
[root@node2 /]# yum clean all

7. 加载缓存:
[root@node2 /]# yum makecache

8. 更新软件:
[root@node2 /]# yum update

以上方法也是Red Hat Enterprise Linux Server(RHEL) yum安装软件时This system is not registered with RHN. RHN support will be disabled. 的解决方法
Red Hat Enterprise Linux Server(RHEL) 的yum服务是付费的,因为没有付费,所以无法使用yum安装软件,如RHEL想安装LNMP必须要先按此教程设置好yum,并可以正常使用后才可以安装LNMP一键安装包,会提示如下错误:This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. 或如下错误信息:This system is not registered with RHN. RHN support will be disabled.

最新文章

  1. Windows下ActiveMQ下载、安装部署
  2. redis 源码阅读 内部数据结构--字符串
  3. JQuery Easy Ui DataGrid
  4. August 23rd 2016 Week 35th Tuesday
  5. 如何把项目部署到OSChina上
  6. Javascript中理解发布--订阅模式
  7. dedecms列表页如何让文章列表里面的文章每隔五篇就隔开一段空间
  8. Kali vmtools
  9. POJ2302
  10. APNs-远程推送
  11. JAVA实现Shell排序
  12. photo
  13. Demo3
  14. (转载)dotnet core 中文乱码 codepages
  15. 嵌入式开发之hi3519---lvds ,mipi,camera sensor,/DVI/HDMI Interface
  16. linux上udev的配置(转载)
  17. HDU6113
  18. Java继承关系概述
  19. [代码审计]phpshe开源商城后台两处任意文件删除至getshell
  20. ASP.NET MVC:UrlHelper.cs

热门文章

  1. Docker学习总结(一)
  2. Nginx 反向代理&负载均衡
  3. 初识Celery
  4. [刷题]算法竞赛入门经典(第2版) 5-16/UVa212 - Use of Hospital Facilities
  5. 【SoDiaoEditor电子病历编辑器】阶段性更新啦
  6. SQLite 之 C#版 System.Data.SQLite 使用
  7. URI结构
  8. OpenStack云平台的网络模式及其工作机制
  9. Akka(3): Actor监管 - 细述BackoffSupervisor
  10. v$session & v$session_wait