Linux安装yum

Linux环境安装Docker

环境

系统centos7

步骤

如果只是需要更换镜像文件,可直接跳转第4步。

  1. 使用rpm删除yum文件
rpm -qa | grep yum | xargs rpm -e --nodeps
  1. 下载如下安装包
    如果有wget工具,则直接运行如下命令,如果下载失败,请自行去https://mirrors.aliyun.com/centos/7/os/x86_64/Packages查找新版本的rpm包,并更改版本号下载。
    如果没有wget工具,只能自己去上面那个网页下载包啦。
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm
  1. 安装
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-3.4.3-168.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm yum-utils-1.1.31-54.el7_8.noarch.rpm python-urlgrabber-3.10-10.el7.noarch.rpm --force --nodeps
  1. 下载阿里云镜像并替换原配置文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  1. 修改下载的文件,替换$releaserver7
:%s/$releasever/7/g
  1. 运行如下命令完成安装
yum clean all 
yum makecache
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值