5
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.

CentOSにnginxをインストールする方法

Last updated at Posted at 2017-08-04

基本

nginxのリポジトリが登録済みの場合はインストール可能

# yum install -y nginx

問題点

nginxのリポジトリが登録されてない場合、yum install nginxコマンドの結果がNo package nginx available.となりginxがインストールできない

# yum install -y nginx

Loaded plugins: fastestmirror
base                                                     | 3.6 kB     00:00
extras                                                   | 3.4 kB     00:00
updates                                                  | 3.4 kB     00:00
(1/4): base/7/x86_64/group_gz                              | 155 kB   00:00
(2/4): base/7/x86_64/primary_db                            | 5.6 MB   00:01
(3/4): updates/7/x86_64/primary_db                         | 7.8 MB   00:01
(4/4): extras/7/x86_64/primary_db                          | 191 kB   00:01
Determining fastest mirrors
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
No package nginx available.
Error: Nothing to do

解決方法

リポジトリを追加してからyum install nginxコマンドを実行する

# vi /etc/yum.repos.d/nginx.repo
/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
# yum install -y nginx
5
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
5
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?