【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
相关推荐
leoufung4 分钟前
vim 多个关键字高亮插件介绍
linux·编辑器·vim
Karoku0661 小时前
【CI/CD】CI/CD环境搭建流程和持续集成环境配置
运维·ci/cd·docker·容器·kubernetes·prometheus
Nerd Nirvana3 小时前
软考—系统架构设计(案例 | 论文)
linux·系统架构·软件工程·软考·计算机基础
勤奋的凯尔森同学4 小时前
webmin配置终端显示样式,模仿UbuntuDesktop终端
linux·运维·服务器·ubuntu·webmin
希忘auto7 小时前
详解Redis在Centos上的安装
redis·centos
技术小齐8 小时前
网络运维学习笔记 016网工初级(HCIA-Datacom与CCNA-EI)PPP点对点协议和PPPoE以太网上的点对点协议(此处只讲华为)
运维·网络·学习
ITPUB-微风8 小时前
Service Mesh在爱奇艺的落地实践:架构、运维与扩展
运维·架构·service_mesh
打不了嗝 ᥬ᭄8 小时前
Linux的权限
linux
落幕9 小时前
C语言-进程
linux·运维·服务器
深度Linux9 小时前
C++程序员内功修炼——Linux C/C++编程技术汇总
linux·项目实战·c/c++