linux - 当我尝试安装 NGINX 时出现错误

标签 linux nginx amazon-ec2 installation amazon-linux

我正在尝试安装 nginx 亚马逊 Linux AMI

但是当我尝试运行命令时

sudo yum install nginx

错误如下

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

最佳答案

我遇到了完全相同的问题。检查您是否有类似 /etc/yum.repos.d/nginx.repo 的文件。

Nginx install instructions告诉我们创建这样一个文件,它应该如下所示:

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

那些指令也告诉我们

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.

因此您需要将 $releasever 替换为您操作系统的适当版本。但是当使用 Amazon Linux AMI(或者,在我的例子中是 Azure 版本)时,很难分辨这是什么。

我发现 sudo yum install nginx 只有在我将 $releasever 替换为 7 时才有效。 当我使用 6 代替,我得到了和你一样的错误。希望这对您有所帮助!

关于linux - 当我尝试安装 NGINX 时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50292023/

相关文章:

c++ - 找不到包 'gdk-pixbuf-2.0'

Nginx 与 default_server 和一个 ipaddress 上的多个域

python - 如何将 Python Flask 应用程序部署到在 Amazon Linux EC2 实例上运行的 Apache (Httpd)

linux - 使: no rule to make target

c++ - 如何在带有 GDB GUI 前端的 ARM gdbserver 的 PC 上执行远程 gdb session ?

linux - 使用 nginx 上传文件导致 408/EAGAIN

ruby-on-rails - 用户启动Passenger(使用Nginx)

amazon-web-services - 关于免费套餐上简单 AWS CLI 预置的建议

python - 如何使用 Boto 获取已启动实例的 IP 地址

c - Linux 串行读取抛出错误