title: RedHat 7.3 更新yum源

time: 2018.3.15

  • 查看所有yum包
[root@bogon ~]# rpm -qa | grep yum
yum-rhn-plugin-2.0.1-6.el7.noarch
yum-3.4.3-150.el7.noarch
yum-utils-1.1.31-40.el7.noarch
PackageKit-yum-1.0.7-6.el7.x86_64
yum-langpacks-0.4.2-7.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
  • 删除原有yum包
[root@bogon ~]# rpm -e yum-rhn-plugin-2.0.1-6.el7.noarch yum-3.4.3-150.el7.noarch yum-utils-1.1.31-40.el7.noarch PackageKit-yum-1.0.7-6.el7.x86_64 yum-langpacks-0.4.2-7.el7.noarch yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
  1. 点击centos
  2. 点击7/
  3. 点击os/
  4. 点击x86_64/
  5. 点击Packages/
  6. ctrl+f 搜索需要的包, 如下:

yum-plugin-fastestmirror

yum-updateonboot

yum-utils

yum-metadata-parser

yum-3.4.3-150.el7

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-42.el7.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-42.el7.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-3.4.3-154.el7.centos.noarch.rpm
  • 安装软件包
rpm -ivh yum-*
# 报错, 依赖包的版本不符:
rpm >= 0:4.11.3-22 is needed by yum-3.4.3-154.el7.centos.noarch
  • 解决方法: 将所依赖的python-urlgrabber和rpm包升级
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-25.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
# 安装:
rpm -Uvh rpm-4.11.3-25.el7.x86_64.rpm --nodeps
rpm -Uvh python-urlgrabber-3.10-8.el7.noarch.rpm --nodeps
  • 重新安装软件包
rpm -ivh yum-*
  • 更新yum源
rm /etc/yum.repos.d/redhat.repo
vim /etc/yum.repos.d/CentOS-Base.repo
# 内容:
#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-$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 #released updates
[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 #additional packages that may be useful
[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 #additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$7 - 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
  • 清楚yum缓存
yum clean all
  • 生成缓存
yum makecache
  • 更新成功, 可以安装软件了
yum install tree
tree

顺便, 设置网络自动启动:

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-
ifcfg-ens33 ifcfg-lo
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33

修改末行ONBOOT=yes

最新文章

  1. BOM浏览器对象模型
  2. HDU 5122 K.Bro Sorting(2014北京区域赛现场赛K题 模拟)
  3. 代码导出Reporting Services报表文件
  4. Swift-11-协议(Protocols)
  5. centos 连不上网
  6. Git for Windows
  7. 动态规划之一ones
  8. 【老鸟学算法】大整数乘法——算法思想及java实现
  9. vmware克隆虚拟机后网卡名称及网络地址xiuf
  10. 强大的Resharp插件(转)
  11. 6.4 SpringData JPA的使用
  12. MySQL的复制机制
  13. 在CI (Jenkins) 从机(服务器)上使用bat批处理执行自动构建任务时,输出NuGet还原失败的解决方案
  14. Codeforces 382 D Permutations
  15. 1049: 贝贝的车牌问题(car)
  16. FZU2150(KB1-I)
  17. MyBatis -01- 初识 MyBatis + MyBatis 环境搭建
  18. e686. 显示打印窗口
  19. 如鹏网学习笔记(十一)JQuery
  20. HTTP完整请求过程

热门文章

  1. js使用defineProperty的一些坑
  2. SpringMvc Ant通配符的使用
  3. CodeForces - 551C 二分+贪心
  4. soj3129: windy和水星 -- 水星数学家 2
  5. Docker系统七:Docker数据管理
  6. python 小练习之生成手机号码
  7. SDP(9):MongoDB-Scala - data access and modeling
  8. 移动端-手机端-日历选择控件(支持Zepto和JQuery)
  9. 【前端】Vue2全家桶案例《看漫画》之七、webpack插件开发——自动替换服务器API-URL
  10. 一个可以自由定制外观、支持拖拽消除的MaterialDesign风格Android BadgeView