设为首页 收藏本站
查看: 1414|回复: 0

[经验分享] redhati企业版7 "yum"重装 centos7 “yum”

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-10-8 09:00:12 | 显示全部楼层 |阅读模式
   默认情况下红帽的yum是需要注册的,据我所知要钱。
而centos与redhat几乎是一样的,所以redhat的软件centos也可用,
      于是上网查资料没想到还真是可以,所以写了一个备忘录。万一以后还要用到呢。
      也希望本文可以帮到有需要的人。
1.查看系统预装的yum rpm包:
1
2
  
rpm - qa | grep yum




以下是我的系统预装的软件(我的是redhat7):
1
2
3
4
5
6
7
8
[iyunv@localhost ~]# rpm -qa|grep yum
yum-langpacks-0.4.2-4.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-132.el7.centos.0.1.noarch
yum-utils-1.1.31-34.el7.noarch
yum-plugin-fastestmirror-1.1.31-34.el7.noarch
yum-rhn-plugin-2.0.1-5.el7.noarch
PackageKit-yum-1.0.7-5.e17.x86_64




2.卸载上面的rpm包:
  
1
2
3
rpm -e
yum-langpacks-0.4.2-4.el7.noarch
--nodeps




  后面的卸载方式依照上面。
3.更改yum仓库:
1
/etc/yum.repos.d/




下載文件:
1
http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm




其他版本对应版本号即可。
下载centos 的rpm包:
对应你卸载的rpm包下载:(我卸载了这些所以我下载这些)
1
2
3
4
5
6
7
yum-langpacks-0.4.2-4.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-132.el7.centos.0.1.noarch
yum-utils-1.1.31-34.el7.noarch
yum-plugin-fastestmirror-1.1.31-34.el7.noarch
yum-rhn-plugin-2.0.1-5.el7.noarch
PackageKit-yum-1.0.7-5.e17.x86_64




下载地址:
1
http://mirrors.163.com/centos/7/os/x86_64/Packages/




4.安装rpm包:
1
rpm -ivh *.rpm




5.清除缓存:
1
yum clean all




6.建立緩存:
1
yum makecache




如果出現一下報錯:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[iyunv@localhost ~]# yum makecache                              
Loaded plugins: fastestmirror, 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.
Could not retrieve mirrorlist http://mirrorlist.centos.org/7=$releasever&arch=x86_64&repo=os error was
14: HTTP Error 404 - Not Found
http://mirrors.163.com/centos/%2 ... epodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article
  
https://access.redhat.com/articles/1320623
  
If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/
  
  
  
One of the configured repositories failed (CentOS-$releasever - Base - 163.com),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
     1. Contact the upstream for the repository and get them to fix the problem.
  
     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is than is supported by the repository (and the
        packages for the previous distribution release still work).
  
     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:
  
            yum-config-manager --disable base
  
     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:
  
            yum-config-manager --save --setopt=base.skip_if_unavailable=true




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
http://mirrors.163.com/centos/$releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).
  
     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:
  
            yum-config-manager --disable base
  
     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:
  
            yum-config-manager --save --setopt=base.skip_if_unavailable=true
  
failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
http://mirrors.163.com/centos/$releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found




将/etc/yum.repos.d/CentOS7-Base-163.repo 文件中的$releasever替换成你的系统版本号即可。
到此yum已经替换好了。
可以用yum安装软件了:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
[iyunv@localhost ~]# yum install telnet
Loaded plugins: fastestmirror, 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.
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package telnet.x86_64 1:0.17-59.el7 will be installed
--> Finished Dependency Resolution
  
Dependencies Resolved
  
===============================================================================================
Package             Arch                Version                       Repository         Size
===============================================================================================
Installing:
telnet              x86_64              1:0.17-59.el7                 base               63 k
  
Transaction Summary
===============================================================================================
Install  1 Package
  
Total download size: 63 k
Installed size: 113 k
Is this ok [y/d/N]: y
Downloading packages:
telnet-0.17-59.el7.x86_64.rpm                                           |  63 kB  00:00:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:telnet-0.17-59.el7.x86_64      
  Verifying  : 1:telnet-0.17-59.el7.x86_64                                                
  Installed:
  telnet.x86_64 1:0.17-59.el7                                                                  
  
Complete!




  
附上我的yum仓库文件:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/7=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=
#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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
  
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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
  
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7



欢迎大家指正错误!!



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-282854-1-1.html 上篇帖子: linux系统 用户和组管理类命令的使用方法 下篇帖子: linux两个虚拟机的key认证问题 企业版
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表