centOS7安装nginx

centOS7装个nginx,搞了一天(怎么好意思说出来的),一直报“No package Nginx available”错误,网上的说法一致是使用epel安装,可是每次安装epel都提示已经是最新版本,实在没办法尝试重装yum后,成功解决问题。

1、重装yum

rpm包下载地址:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/

删除原来的yum

rpm -aq|grep yum|xargs rpm -e --nodeps

重装需要下载:

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/python-iniparse-0.4-9.el7.noarch.rpm

注意:一定要确认pachages中有货,上述包的版本号经常会更新,无法连接到对应的下载包,直接到packages中搜索

执行 rpm -ivh *.rpm 进行安装

2、备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

3、centOS7 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 

4、清缓存

yum clean all 

yum makecache 

5、安装epel 

yum install epel-release

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

6、最后 

yum install nginx

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容