1. 检查是否安装yum包
[root@node1 rpms]# rpm -qa|grep yumnode
2. 删除自带的yum包
[root@node1 rpms]# rpm -qa|grep yum|xargs rpm -e --nodeps
由于一些包之间可能会有依赖关系,因此咱们须要加上参数 --nodeps 无视依赖关系。python
3. 下载yum包
Yum包下载地址http://mirrors.163.com/centos/
在这个网站里,你能够本身选择须要下载的文件,进入形如5/或者6/的文件下载,其余的没法下载。centos
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.rpmless
或者用如下命令
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源this
[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.
#url
[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 下载的,须要修改下里面的变量。ip
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.