一、场景介绍

1、centos7在安装软件包时命令报错,报错界面如下

yum -y install unzip

2、不能安装的原因是7月centos7已经停服,官方仓库里已无可用软件包

二、解决方法

1、选用国内的软件仓库,这边以阿里仓库作为案例(网址:https://developer.aliyun.com/mirror/),网址内有仓库的详细配置方法

2、将自带的仓库文件删除

rm -rf /etc/yum.repos.d/*

3、配置阿里仓库,两个仓库任选

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

4、通过yum repolist enabled查看可用仓库

5、再次安装unzip软件包显示成功安装

yum -y install unzip