问题描述:

安装nginx时运行#yum install nginx,出现以下错误

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.cqu.edu.cn
 * extras: mirrors.163.com
 * updates: mirrors.aliyun.com
base                                                                                | 3.6 kB  00:00:00     
extras                                                                              | 3.4 kB  00:00:00     
updates                                                                             | 3.4 kB  00:00:00     
No package nginx available.
Error: Nothing to do

 

问题原因:

nginx位于第三方的yum源里面,而不在centos官方yum源里面

解决方法:

安装epel(Extra Packages for Enterprise Linux)

https://fedoraproject.org/wiki/EPEL下载跟你服务器相对应的rpm文件

 yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm