yum 安装 更新源

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/a12345676abc/article/details/90447255

         在使用Linux系统时,有时候需要用到yum进行软件安装,但自带yum 工具需要注册,极大不便,这里介绍如何替换自带的yum工具,安装使用免费的yum工具。

一,卸载旧yum工具

首先查询已安装的yum相关软件包。

rpm -qa | grep yum
 
 

例如:

依次,删除软件包


 
 
  1. rpm -e yum-utils-1 .1 .31-50 .el7 .noarch --nodeps
  2. rpm -e PackageKit-yum-1 .1 .5-1 .el7 .x86_64 --nodeps
  3. rpm -e yum-langpacks-0 .4 .2-7 .el7 .noarch --nodeps
  4. rpm -e yum-3 .4 .3-154 .el7 .noarch --nodeps
  5. rpm -e yum-metadata-parser-1 .1 .4-10 .el7 .x86_64 --nodeps
  6. rpm -e yum-rhn-plugin-2 .0 .1-9 .el7 .noarch --nodeps

二  下载新的软件包


 
 
  1. wget http:/ /mirrors.aliyun.com/centos /7/os /x86_64/Packages/python-kitchen- 1.1. 1- 5.el7.noarch.rpm
  2. wget http:/ /mirrors.aliyun.com/centos /7/os /x86_64/Packages/python-chardet- 2.2. 1- 1.el7_1.noarch.rpm
  3. wget http:/ /mirrors.aliyun.com/centos /7/os /x86_64/Packages/yum- 3.4. 3- 161.el7.centos.noarch.rpm
  4. wget http:/ /mirrors.aliyun.com/centos /7/os /x86_64/Packages/yum-metadata-parser- 1.1. 4- 10.el7.x86_64.rpm
  5. wget http:/ /mirrors.aliyun.com/centos /7/os /x86_64/Packages/yum-utils- 1.1. 31- 50.el7.noarch.rpm
  6. wget http:/ /mirrors.aliyun.com/centos /7/os /x86_64/Packages/yum-updateonboot- 1.1. 31- 50.el7.noarch.rpm
  7. wget http:/ /mirrors.aliyun.com/centos /7/os /x86_64/Packages/yum-plugin-fastestmirror- 1.1. 31- 50.el7.noarch.rpm

安装新软件包:


 
 
  1. rpm -ivh python-*
  2. rpm -ivh yum-*

三, 下载.repo文件,创建缓存


 
 
  1. curl -o /etc/yum.repos.d/CentOS-Base.repo http: //mirrors.aliyun.com/repo/Centos-7.repo
  2. 或者
  3. wget -O /etc/yum.repos.d/CentOS-Base.repo http: //mirrors.aliyun.com/repo/Centos-7.repo

修改  CentOS-Base.repo 内容,


 
 
  1. # CentOS-Base.repo
  2. #
  3. # The mirror system uses the connecting IP address of the client and the
  4. # update status of each mirror to pick mirrors that are updated to and
  5. # geographically close to the client. You should use this for CentOS updates
  6. # unless you are manually picking other mirrors.
  7. #
  8. # If the mirrorlist= does not work for you, as a fall back you can try the
  9. # remarked out baseurl= line instead.
  10. #
  11. #
  12. [base]
  13. name=CentOS -7 - Base - mirrors.aliyun.com
  14. failovermethod=priority
  15. baseurl=http: //mirrors.aliyun.com/centos/7/os/$basearch/
  16. http: //mirrors.aliyuncs.com/centos/7/os/$basearch/
  17. http: //mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
  18. gpgcheck= 1
  19. gpgkey=http: //mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  20. #released updates
  21. [updates]
  22. name=CentOS -7 - Updates - mirrors.aliyun.com
  23. failovermethod=priority
  24. baseurl=http: //mirrors.aliyun.com/centos/7/updates/$basearch/
  25. http: //mirrors.aliyuncs.com/centos/7/updates/$basearch/
  26. http: //mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/
  27. gpgcheck= 1
  28. gpgkey=http: //mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  29. #additional packages that may be useful
  30. [extras]
  31. name=CentOS -7 - Extras - mirrors.aliyun.com
  32. failovermethod=priority
  33. baseurl=http: //mirrors.aliyun.com/centos/7/extras/$basearch/
  34. http: //mirrors.aliyuncs.com/centos/7/extras/$basearch/
  35. http: //mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/
  36. gpgcheck= 1
  37. gpgkey=http: //mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  38. #additional packages that extend functionality of existing packages
  39. [centosplus]
  40. name=CentOS -7 - Plus - mirrors.aliyun.com
  41. failovermethod=priority
  42. baseurl=http: //mirrors.aliyun.com/centos/7/centosplus/$basearch/
  43. http: //mirrors.aliyuncs.com/centos/7/centosplus/$basearch/
  44. http: //mirrors.cloud.aliyuncs.com/centos/7/centosplus/$basearch/
  45. gpgcheck= 1
  46. enabled= 0
  47. gpgkey=http: //mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  48. #contrib - packages by Centos Users
  49. [contrib]
  50. name=CentOS -7 - Contrib - mirrors.aliyun.com
  51. failovermethod=priority
  52. baseurl=http: //mirrors.aliyun.com/centos/7/contrib/$basearch/
  53. http: //mirrors.aliyuncs.com/centos/7/contrib/$basearch/
  54. http: //mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/
  55. gpgcheck= 1
  56. enabled= 0
  57. gpgkey=http: //mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

启动yum, 生成缓存

 yum clean all  &&  yum makecache fast 
 
 

调试,  可以自己尝试安装需要的软件

yum install -y kinstall
 
 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值