Foram Sojitra
Foram Sojitra

Reputation: 408

NGINX is giving error when i try to install

I am trying to install nginx in Amazon Linux AMI

but when i try to run command

sudo yum install nginx

error is below

Loaded plugins: langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 0:1.14.0-1.el6.ngx will be installed
--> Processing Dependency: libpcre.so.0()(64bit) for package: nginx-1.14.0-1.el6.ngx.x86_64
--> Finished Dependency Resolution
Error: Package: nginx-1.14.0-1.el6.ngx.x86_64 (nginx)
           Requires: libpcre.so.0()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Upvotes: 0

Views: 4027

Answers (2)

Farhan Kathawala
Farhan Kathawala

Reputation: 271

I had this exact same problem. Check if you have a file like /etc/yum.repos.d/nginx.repo.

The Nginx install instructions tell us to create such a file and that it should look like this:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1

Those instructions also tell us

Due to differences between how CentOS, RHEL, and Scientific Linux populate the $releasever variable, it is necessary to manually replace $releasever with either 5 (for 5.x) or 6 (for 6.x), depending upon your OS version.

So you need to replace $releasever with the appropriate version of your OS. But when using Amazon Linux AMI (or, in my case, the Azure version), it's not easy to tell what this is.

I found that sudo yum install nginx only worked when I replaced $releasever with 7. When I used 6 instead, I got the exact error as you. Hope this helps!

Upvotes: 3

Vishal Patil
Vishal Patil

Reputation: 87

First run $ sudo yum update -y and after that try to install, if still facing same issue then try with $ sudo yum install nginx --skip-broken

Upvotes: 0

Related Questions