1、首先查看redhat 7.1系统本身所安装的那些yum 软件包:
[root@localhost ~]# rpm -qa | grep yum
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-125.el7.noarch
yum-rhn-plugin-2.0.1-5.el7.noarch
2、删除这些软件包:
用这个命令:rpm -e yum --nodeps
rpm -e yum-metadata-parser --nodeps
rpm -e yum-rhn-plugin --nodeps
rpm -e yum-plugin-fastestmirror --nodeps
rpm -e python-urlgrabber --nodeps
rpm -qa | grep libxml2-python
python-kitchen
rpm -e nginx --nodeps
3.进入以下网站上面查看软件包的版本是否升级或者找到自己系统所对应的文件包版本更新;
网易163网络源地址:http://mirrors.163.com/ CentOS网络源地址:http://centos.ustc.edu.cn/centos/ |
4.找到自己所需要的版本下载:
先下载 http://mirrors.163.com/centos/7/os/x86_64/Packages/wget-1.14-15.el7.x86_64.rpm
上传服务器安装
rpm -ivh wget-*
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-45.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
5.安装软件包:
rpm -ivh yum-*
这时会报错
[root@localhost rpmsource]# rpm -ivh yum-*
警告:yum-3.4.3-154.el7.centos.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
错误:依赖检测失败:
python-urlgrabber >= 3.10-8 被 yum-3.4.3-154.el7.centos.noarch 需要
rpm >= 0:4.11.3-22 被 yum-3.4.3-154.el7.centos.noarch 需要
python-kitchen 被 yum-utils-1.1.31-42.el7.noarch 需要
依赖软件包版本不兼容
从上面的网络源下载
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-libs-4.11.3-32.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-build-libs-4.11.3-32.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-python-4.11.3-32.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-chardet-2.2.1-1.el7_1.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm
安装python
rpm -ivh python-*
rpm -ivh libxml*
升级rpm到4.11.3-25版本
rpm -Uvh rpm*
安装yum
rpm -ivh yum-*
6.新建repo 配置文件;
[root@localhost ~]# vi /etc/yum.repos.d/CentOS-Base.repo
或
cd /etc/yum.repos.d
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
7.更新yum源
yum clean all
yum makecache