'No package nginx available' error CentOS 6.5
Asked Answered
D

10

15

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!

Dominick answered 2/12, 2014 at 8:3 Comment(0)
F
42

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

Fari answered 22/6, 2015 at 21:56 Comment(2)
No package epel-release available.Luong
@Luong After installing epel-release manually, it works! cyberciti.biz/faq/…Promptitude
N
15

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;"]
Nomen answered 20/3, 2018 at 18:58 Comment(0)
E
11

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

yum remove epel-release
yum install epel-release
yum update
yum install nginx
Exegete answered 25/2, 2020 at 11:40 Comment(1)
This works for me on CentOS release 6.10 (Final)Pothook
J
10

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

Jennijennica answered 2/12, 2014 at 8:13 Comment(0)
O
1

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
Orvilleorwell answered 28/5, 2017 at 5:29 Comment(0)
B
1

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!

Berty answered 24/1, 2019 at 6:41 Comment(0)
E
1

Check if it is excluded from the yum source:

  1. Use vi /etc/yum.conf
  2. Check the exclude option
Educational answered 11/10, 2022 at 13:2 Comment(0)
M
0

Although the otherwise-posted advice regarding manually setting the $releasever and $basearch values in the repo file will not hurt per se (at least while you stick to the software release referred to by the values you set), it is not strictly necessary.

I also have the exact contents you have posted, in a file named /etc/yum.repos.d/nginx.repo which functions correctly without having set the above values explicitly.

My advice would be to perform a yum updateprior to attempting to install (as it's possible that when you tried to install, yum had not queried all of the repo URLs from the files in /etc/yum.repos.d/ for the latest versions of their databases). Also make absolutely sure that your created file ends in .repo as otherwise it will be ignored by yum.

Failing that, check the SElinux security contexts on the files in that directory - or just go ahead and manually restore them by running restorecon -Rv '/etc/yum.repos.d' and check the file permissions on the manually created repo file(s), which should be owned by root:root and have show 644 as file permissions. To manually amend these, run chmod 644 /etc/yum.repos.d/nginx.repoand chown root:root /etc/yum.repos.d/nginx.repo

I hope that some part of the above resolves your issues!

Mantooth answered 2/12, 2014 at 12:31 Comment(0)
A
0

Check yum.conf file and it's exclude key

In addition to all above answers, Make sure nginx, httpd or any other package you want to install is not in the exclude list of yum.conf file.

  1. Open yum.conf file located at /etc/yum.conf

  2. Check the exclude key and remove nginx* if it's there

  3. Then try to install your package. in this case nginx:

    sudo yum install nginx

Aviate answered 5/10, 2022 at 10:23 Comment(0)
M
0

My problem was this line in /etc/yum.conf file:

exclude=apache* nginx* httpd* mod_* mysql* MySQL* mariadb* da_* *ftpd exim* sendmail* php* bind-chroot* dovecot*

I deleted nginx* and tried to install nginx:
yum install nginx

Martins answered 12/8, 2023 at 17:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.