我尝试在最新的亚马逊Linux上安装nginx(版本 >= 1.9.5),以便使用http2。我按照此处描述的说明进行了操作 -> http://nginx.org/en/linux_packages.html
我创建了一个repo文件/etc/yum.repos.d/nginx.repo
,其内容如下:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1
如果我运行yum update
和yum install nginx
,我会得到如下结果:
nginx x86_64 1:1.8.1-1.26.amzn1 amzn-main 557 k
看起来它仍然从amzn-main库中提取。我该如何安装更新的nginx版本?
-- 编辑 --
我在nginx.repo文件中添加了"priority=10",现在我可以使用yum install nginx
安装1.9.15,结果如下:Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.9.15-1.el7.ngx will be installed
--> Processing Dependency: systemd for package: 1:nginx-1.9.15-1.el7.ngx.x86_64
--> Processing Dependency: libpcre.so.1()(64bit) for package: 1:nginx-1.9.15-1.el7.ngx.x86_64
--> Finished Dependency Resolution
Error: Package: 1:nginx-1.9.15-1.el7.ngx.x86_64 (nginx)
Requires: libpcre.so.1()(64bit)
Error: Package: 1:nginx-1.9.15-1.el7.ngx.x86_64 (nginx)
Requires: systemd
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
systemctl start nginx
启动它。使用systemctl status nginx
检查状态。 - czeraszsystemctl start nginx
时,出现了错误。它说:`无法启动nginx.service:未提供任何.service文件的org.freedesktop.PolicyKit1名称。请参阅系统日志和'systemctl status nginx.service'以获取详细信息。结果我必须使用sudo systemctl start nginx
来解决这个问题! - Qasim