【CentOS7】下载nginx报错:No package nginx available. Error: Nothing to do

错误展示

复制代码
[root@localhost ~]# yum install -y nginx
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: ftp.sjtu.edu.cn
 * extras: ftp.sjtu.edu.cn
 * updates: mirrors.shu.edu.cn
No package nginx available.
Error: Nothing to do

出现这个的原因是因为本地yum源中没有nginx。

解决办法

法1 :创建一个/etc/yum.repos.d/nginx.repo的文件,新增一个yum源。

bash 复制代码
vim /etc/yum.repos.d/nginx.repo
复制代码
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

法2:安装epel

EPEL (Extra Packages for Enterprise Linux)基于Fedora的一个项目,为"红帽系"的操作系统提供额外的软件包。

bash 复制代码
yum -y install epel-release 

然后再安装nginx

bash 复制代码
yum install -y nginx
相关推荐
少妇的美梦19 小时前
logstash教程
运维
chen94520 小时前
k8s集群部署vector日志采集器
运维
chen94520 小时前
aws ec2部署harbor,使用s3存储
运维
轻松Ai享生活1 天前
5 节课深入学习Linux Cgroups
linux
christine-rr1 天前
linux常用命令(4)——压缩命令
linux·服务器·redis
三坛海会大神5551 天前
LVS与Keepalived详解(二)LVS负载均衡实现实操
linux·负载均衡·lvs
東雪蓮☆1 天前
深入理解 LVS-DR 模式与 Keepalived 高可用集群
linux·运维·服务器·lvs
qq_264220891 天前
LVS负载均衡群集和LVS+Keepalived群集
运维·负载均衡·lvs
乌萨奇也要立志学C++1 天前
【Linux】进程概念(二):进程查看与 fork 初探
linux·运维·服务器
雨落Liy1 天前
Nginx 从入门到进阶:反向代理、负载均衡与高性能实战指南
运维·nginx·负载均衡