13
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

yumでAmazonLinux2にnginxの最新版をインストールする

Last updated at Posted at 2019-01-28

##はじめに
nginxの最新版(1.15.8)をAmazonLinux2にインストールしたかったのですが、
普通にyum install nginxとするとパッケージがないと言われ、
amazon-linux-extrasだと1.12.2しか選択できない(2019/1/28現在)ので、
最新版をインストールする方法。

##環境
AmazonLinuxは以下のAMIを使用。
amzn2-ami-hvm-2.0.20190115-x86_64-gp2 (ami-0d7ed3ddb85b521a6)

##リポジトリの設定
/etc/yum.repos.d/nginx.repoを作成して以下を書き込む

/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key

##インストール

$ sudo yum install nginx -y
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.15.8-1.el7_4.ngx will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                              Arch                                                  Version                                                               Repository                                            Size
=============================================================================================================================================================================================================================================
Installing:
 nginx                                                x86_64                                                1:1.15.8-1.el7_4.ngx                                                  nginx                                                762 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install  1 Package

Total download size: 762 k
Installed size: 2.7 M
Downloading packages:
nginx-1.15.8-1.el7_4.ngx.x86_64.rpm                                                                                                                                                                                   | 762 kB  00:00:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:nginx-1.15.8-1.el7_4.ngx.x86_64                                                                                                                                                                                         1/1 
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* http://nginx.org/en/docs/

Please subscribe to nginx-announce mailing list to get
the most important news about nginx:
* http://nginx.org/en/support.html

Commercial subscriptions for nginx are available on:
* http://nginx.com/products/

----------------------------------------------------------------------
  Verifying  : 1:nginx-1.15.8-1.el7_4.ngx.x86_64                                                                                                                                                                                         1/1 

Installed:
  nginx.x86_64 1:1.15.8-1.el7_4.ngx                                                                                                                                                                                                          

Complete!

バージョン確認

$ nginx -v
nginx version: nginx/1.15.8
13
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?