1.先安装wget,再进行备份/etc/yum.repos.d
yum install wget -y
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
2.No package XXX available.
出现这种问题的原因是要安装的软件包默认不在centos的光盘yum仓库中,因此我们需要配置 epel仓库
//配置epel源
yum install -y epel-release