如何在Amazon Linux Disto上安装Nginx 1.9.15 [英] How to install nginx 1.9.15 on amazon linux disto

查看:351
本文介绍了如何在Amazon Linux Disto上安装Nginx 1.9.15的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在新的Amazon Linux上安装最新版本的nginx(> = 1.9.5),以使用http2.我按照此处描述的说明进行操作-> http://nginx.org/en/linux_packages.html

I try to install the latest version of nginx (>= 1.9.5) on a fresh amazon linux to make use of http2. I followed the instructions that are described here -> http://nginx.org/en/linux_packages.html

我创建了一个具有以下内容的回购文件/etc/yum.repos.d/nginx.repo:

I created a repo file /etc/yum.repos.d/nginx.repowith this content:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1

如果我运行yum updateyum install nginx,我会得到:

If I run yum update and yum install nginx I get this:

nginx x86_64 1:1.8.1-1.26.amzn1 amzn-main 557 k

似乎它仍从amzn-main存储库中获取.如何安装较新版本的Nginx?

It seems that it fetches still from the amzn-main repo. How do I install a newer version of nginx?

-编辑- 我在nginx.repo文件中添加了"priority = 10",现在我可以用yum install nginx安装1.9.15了,结果是:

-- edit -- I added "priority=10" to the nginx.repo file and now I can install 1.9.15 with yum install nginx with this result:

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

推荐答案

如果使用的是AWS Linux2,则必须从AWS其他存储库"中安装nginx.要查看可用软件包的列表,请执行以下操作:

If you're using AWS Linux2, you have to install nginx from the AWS "Extras Repository". To see a list of the packages available:

# View list of packages to install
amazon-linux-extras list

您会看到类似于以下内容的列表:

You'll see a list similar to:

0  ansible2   disabled  [ =2.4.2 ]
1  emacs   disabled  [ =25.3 ]
2  memcached1.5   disabled  [ =1.5.1 ]
3  nginx1.12   disabled  [ =1.12.2 ]
4  postgresql9.6   disabled  [ =9.6.6 ]
5  python3   disabled  [ =3.6.2 ]
6  redis4.0   disabled  [ =4.0.5 ]
7  R3.4   disabled  [ =3.4.3 ]
8  rust1   disabled  [ =1.22.1 ]
9  vim   disabled  [ =8.0 ]
10  golang1.9   disabled  [ =1.9.2 ]
11  ruby2.4   disabled  [ =2.4.2 ]
12  nano   disabled  [ =2.9.1 ]
13  php7.2   disabled  [ =7.2.0 ]
14  lamp-mariadb10.2-php7.2   disabled  [ =10.2.10_7.2.0 ]

使用amazon-linux-extras install命令进行安装,例如:

Use the amazon-linux-extras install command to install it, like:

sudo amazon-linux-extras install nginx1.12

更多详细信息在这里: https://aws.amazon.com/amazon- linux-2/faqs/.

More details are here: https://aws.amazon.com/amazon-linux-2/faqs/.

这篇关于如何在Amazon Linux Disto上安装Nginx 1.9.15的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆