RHEL更换为centros的yum

1、首先查看redhat 7.0系统本身所安装的那些yum 软件包:
[root@pan ~]# rpm -qa | grep yum yum-utils-1.1.31-24.el7.noarch yum-langpacks-0.4.2-3.el7.noarch yum-metadata-parser-1.1.4-10.el7.x86_64 yum-rhn-plugin-2.0.1-4.el7.noarch PackageKit-yum-0.8.9-11.el7.x86_64 yum-3.4.3-118.el7.noarch
2、卸载这些软件包;
[root@pan ~]# rpm -e yum-3.4.3-118.el7.noarch –nodeps [root@pan ~]# rpm -e yum-utils-1.1.31-24.el7.noarch –nodeps [root@pan ~]# rpm -e yum-rhn-plugin-2.0.1-4.el7.noarch –nodeps
[root@pan ~]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 –nodeps
[root@pan ~]# rpm -e PackageKit-yum-0.8.9-11.el7.x86_64 –nodeps
3、保证本机电脑能上网;
[root@pan ~]# ping www.baidu.com
PING www.a.shifen.com (163.177.151.110) 56(84) bytes of data. 64 bytes from 163.177.151.110: icmp_seq=1 ttl=49 time=13.1 ms 64 bytes from 163.177.151.110: icmp_seq=2 ttl=49 time=6.80 ms 64 bytes from 163.177.151.110: icmp_seq=3 ttl=49 time=6.77 ms ^C
— www.a.shifen.com ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2007ms rtt min/avg/max/mdev = 6.777/8.917/13.168/3.006 ms
4、进入以下网站上面查看软件包的版本是否升级或者找到自己系统所对应的文件包版本更新;

网易163网络源地址:http://mirrors.163.com/
CentOS网络源地址:http://centos.ustc.edu.cn/centos/

5、找到自己所需要的版本下载:
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-150.el7.centos.noarch.rpm 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-40.el7.noarch.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-40.el7.noarch.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm

我到163的镜像网站上找了一下:
http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm
http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/yum-utils-1.1.31-42.el7.noarch.rpm
http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/yum-updateonboot-1.1.31-42.el7.noarch.rpm
http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
6、查看下载完成结果;
[root@pan ~]# ls

7、安装软件包:
[root@pan ~]# rpm -ivh yum-* –nodeps
[root@localhostyum_setup]# rpm -ivh yum-*
警告:yum-3.4.3-154.el7.centos.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY 准备中… #################### [100%] 正在升级/安装…
1:yum-metadata-parser-1.1.4-10.el7 ################### [ 20%]
3:yum-3.4.3-154.el7.centos ################ [ 60%]
4:yum-updateonboot-1.1.31-42.el7 ################ [ 80%]
5:yum-utils-1.1.31-42.el7 ############ [100%]
8、是原作者安装的包依赖有问题,我从163的mirrors上下的7.4.1708版本目录里的的没事,安装正常。
9、新建repo 配置文件;

#CentOS-Base.repo#
#ThemirrorsystemusestheconnectingIPaddressoftheclientandthe#updatestatusofeachmirrortopickmirrorsthatareupdatedtoand#geographicallyclosetotheclient.YoushouldusethisforCentOSupdates#unlessyouaremanuallypickingothermirrors.#
#Ifthemirrorlist=doesnotworkforyou,asafallbackyoucantrythe#remarkedoutbaseurl=lineinstead.

#
#
[base]
name=CentOS-$7-Base-163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#releasedupdates
[updates]
name=CentOS-$7-Updates-163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&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

#additionalpackagesthatmaybeuseful
[extras]
name=CentOS-$7-Extras-163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&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

#additionalpackagesthatextendfunctionalityofexistingpackages
[centosplus]
name=CentOS-$7-Plus-163.com
baseurl=http://mirrors.163.com/centos/7.4.1708/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 

10、清除缓存:

[root@pan ~]# yum clean all
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Cleaning repos: base extras updates Cleaning up everything

我执行时提示出下:表示正常。
[root@localhostyum_setup]# yum clean all
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register. 正在清理软件源:base extras updates

Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
11、测试安装是否正常;

[root@pan ~]# yum -y install lftp

我执行后的提示如下,运行正常:
[root@localhostyum_setup]# yum -y install lftp
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00 (1/4): extras/x86_64/primary_db | 110 kB 00:00:00 (2/4): base/x86_64/group_gz | 156 kB 00:00:00 (3/4): updates/x86_64/primary_db | 2.7 MB 00:00:00 (4/4): base/x86_64/primary_db | 5.7 MB 00:00:01
Determining fastest mirrors
正在解决依赖关系 –>正在检查事务
—>软件包 lftp.x86_64.0.4.4.8-8.el7_3.2 将被安装 –>解决依赖关系完成
依赖关系解决

======================================================================================================================================================================== Package 架构版本源大小

正在安装:
lftp x86_64 4.4.8-8.el7_3.2 base 751 k
事务概要
======================================================================================================================================================================== 安装 1 软件包

总下载量:751 k 安装大小:2.4 M
Downloading packages:
警告:/var/cache/yum/x86_64/$releasever/base/packages/lftp-4.4.8-8.el7_3.2.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
lftp-4.4.8-8.el7_3.2.x86_64.rpm 的公钥尚未安装
lftp-4.4.8-8.el7_3.2.x86_64.rpm | 751 kB 00:00:00
http://mirrors.163.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.163.com/centos/RPM-GPG-KEY-CentOS-7 Running transaction check Running transaction test Transaction test succeeded Running transaction
警告:RPM 数据库已被非 yum 程序修改。
** 发现 2 个已存在的 RPM 数据库问题, ‘yum check’ 输出如下: PackageKit-1.1.5-1.el7.x86_64 有缺少的需求PackageKit-backend
rhn-check-2.0.2-17.el7.noarch 有缺少的需求 yum-rhn-plugin >= (‘0’, ‘1.6.4’, ‘1’) 正在安装 : lftp-4.4.8-8.el7_3.2.x86_64 1/1 验证中 : lftp-4.4.8-8.el7_3.2.x86_64 1/1
已安装:
lftp.x86_64 0:4.4.8-8.el7_3.2
完毕!

posted @ 2017-12-19 14:00  lllini  阅读(272)  评论(0编辑  收藏  举报