redhat 7 -安装阿里的YUM源
环境:Red Hat Enterprise Linux Server release 7.3 (Maipo)
1、查看本系统安装的yum的包
[root@localhost yum.repos.d]# rpm -qa |grep yum
yum-rhn-plugin-2.0.1-6.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-150.el7.noarch
更新前的YUM包
[root@localhost bak]# rpm -qa | grep yum
yum-3.4.3-168.el7.centos.noarch
yum-langpacks-0.4.2-7.el7.noarch
yum-utils-1.1.31-54.el7_8.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-rhn-plugin-2.0.1-10.el7.noarch
这是已经更新yum 后的包
2、手动先下载这些包
下载地址:http://pub.mirrors.aliyun.com/centos/7/os/x86_64/Packages/
python-urlgrabber-3.10-10.el7.noarch.rpm
PackageKit-yum-1.1.10-2.el7.centos.x86_64.rpm
yum-3.4.3-168.el7.centos.noarch
yum-langpacks-0.4.2-7.el7.noarch
yum-utils-1.1.31-54.el7_8.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-rhn-plugin-2.0.1-10.el7.noarch
3、删除原有的YUM
rpm -qa|grep yum|xargs rpm -e --nodeps #删除yum包
python-urlgrabber 先卸载掉python-urlgrabber。安装yum包才会成功
rpm -qa|grep yum|xargs rpm -e --nodeps
4、安装yum 包
上传下专的7个包
rpm -ivh python-urlgrabber-3.10-10.el7.noarch.rpm
rpm -ivh yum-* #安装不成功就使用下面的强行安装
rpm -ivh yum-* --force --nodeps
5、下载Centos yum源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
修改Centos-7.repo
sed -i 's/$releasever/7/g' /etc/yum.repos.d/Centos-7.repo
或进入vi centos-7.repo
:%s/$releaserver/7/g
6、使用
yum clean all
yum repolist
测试
[root@localhost bak]# yum install -y wget
已加载插件: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.
正在解决依赖关系
--> 正在检查事务
---> 软件包 wget.x86_64.0.1.14-18.el7_6.1 将被 安装
--> 解决依赖关系完成
依赖关系解决
========================================================================================================================================================================================
Package 架构 版本 源 大小
========================================================================================================================================================================================
正在安装:
wget x86_64 1.14-18.el7_6.1 base 547 k
事务概要
========================================================================================================================================================================================
安装 1 软件包
总下载量:547 k
安装大小:2.0 M
Downloading packages:
警告:/var/cache/yum/x86_64/$releasever/base/packages/wget-1.14-18.el7_6.1.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY ] 146 kB/s | 435 kB 00:00:00 ETA
wget-1.14-18.el7_6.1.x86_64.rpm 的公钥尚未安装
wget-1.14-18.el7_6.1.x86_64.rpm | 547 kB 00:00:00
从 http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
用户ID : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
指纹 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
来自 : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
** 发现 4 个已存在的 RPM 数据库问题, 'yum check' 输出如下:
yum-3.4.3-168.el7.centos.noarch 有缺少的需求 rpm >= ('0', '4.11.3', '22')
yum-3.4.3-168.el7.centos.noarch 有缺少的需求 yum-plugin-fastestmirror
yum-langpacks-0.4.2-7.el7.noarch 有缺少的需求 langtable-python
yum-utils-1.1.31-54.el7_8.noarch 有缺少的需求 python-kitchen
正在安装 : wget-1.14-18.el7_6.1.x86_64 1/1
验证中 : wget-1.14-18.el7_6.1.x86_64 1/1
已安装:
wget.x86_64 0:1.14-18.el7_6.1
完毕!