altere5's blog

I thought what I'd do was, I'd pretend I was one of those deaf-mutes. ( or shou'd i ? )

yumを使ったnginxの導入

CentOS6(6.4)にyumを使ってnginxを導入する方法。
なお提供されるバージョンとしては「mainline(最新版)」と「stable(安定板)」があるが今回は「mainline」を選択。

手順のソースはコチラが正しいので要チェック。

(1) 「nginx」のリポジトリの追加

「nginx.repo」を「/etc/yum.repos.d/」配下に作成する。

vi /etc/yum.repos.d/nginx.repo

記述内容は下記の内容。

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

(2) インストールの実行

yum install nginx

以下インストール時のログ。

Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: ftp.kddilabs.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
nginx                                                    | 2.9 kB     00:00
nginx/primary_db                                         |  25 kB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 0:1.4.3-1.el6.ngx will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch            Version                    Repository      Size
================================================================================
Installing:
 nginx          x86_64          1.4.3-1.el6.ngx            nginx          311 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 311 k
Installed size: 770 k
Is this ok [y/N]: y
Downloading Packages:
nginx-1.4.3-1.el6.ngx.x86_64.rpm                         | 311 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : nginx-1.4.3-1.el6.ngx.x86_64                                 1/1
----------------------------------------------------------------------

Thanks for using nginx!

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

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

----------------------------------------------------------------------
  Verifying  : nginx-1.4.3-1.el6.ngx.x86_64                                 1/1

Installed:
  nginx.x86_64 0:1.4.3-1.el6.ngx

Complete!

(3) nginxの起動

service nginx start

(4) nginxのサービスへの追加

chkconfig nginx on

正常にアクセスできば導入完了。

番外編

設定ファイルの変更を行った場合

service nginx reload