Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'No package nginx available' error CentOS 6.5

I'm trying to install nginx on CentOS 6.5, then I added these lines on file /etc/yum.repos.d/nginx.repo enter image description here

Then install nginx by:
enter image description here

And I've got a message error: No package nginx available How can I fix it? I would greatly appreciate any help you can give me in working this problem!

like image 244
Thơ Hoàng Avatar asked Dec 02 '14 08:12

Thơ Hoàng


6 Answers

nginx is not a part of base CentOS repository.

But you can install EPEL repositiry to get nginx:

yum install epel-release

and then

yum install nginx

like image 70
gexly Avatar answered Sep 27 '22 16:09

gexly


This should work well for oraclelinux7

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

Dockerfile to install nginx on oraclelinux:

FROM oraclelinux:7-slim
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y install nginx && yum clean all && rm -rf /var/cache/yum
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]
like image 21
Mic Avatar answered Sep 27 '22 17:09

Mic


Your repo url is having an error. It is necessary to manually replace $releasever with either "5" (for 5.x) or "6" (for 6.x), depending upon your OS version. Similarly you have to edit the $basearch also. After that do the following command

yum clean all

yum install nginx

An alternative option is to install the epel repository and install nginx from there.

yum install epel-release

yum clean all

yum install nginx

like image 23
Amal G Jose Avatar answered Sep 27 '22 18:09

Amal G Jose


What worked for me (CentOS 7.1) was removing epel first:

yum remove epel-release
yum install epel-release
yum update
yum install nginx
like image 43
Marc Avatar answered Sep 27 '22 16:09

Marc


Install nginx first! Run the following commands to first add the EPEL repository (Extra Packages for Enterprise Linux) and then install nginx.

yum install epel-release
yum install nginx
like image 23
antony_sebastian Avatar answered Sep 27 '22 18:09

antony_sebastian


Try to disable plugins for yum:

vim /etc/yum.conf

set plugins=0, and re-install epel-release:

yum remove epel-release
yum install epel-release
yum install nginx

this works for me, good luck!

like image 35
LI ZHE Avatar answered Sep 27 '22 17:09

LI ZHE