我正在尝试安装 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/