首頁 >後端開發 >php教程 >CentOS65下安裝Nginx

CentOS65下安裝Nginx

WBOY
WBOY原創
2016-07-29 09:15:181215瀏覽

本次示範是在CentOS6.5/' target='_blank'>CentOS6.5作業系統下安裝Nginx

作業系統:getCOSc> CentOS6.5-x86-64

Nginx版本:nginx-release-centos-6-0.el6.ngx.noarch.rpm

Nginx版本:nginx-release-centos-6-0.el6.ngx.noarch.rpm

.html#stable

Epel版本:epel-release-6-8.noarch.rpm

Epel套件下載網址:http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6 -8.noarch.rpm

Epel來源鏡像位址:http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/

1、安裝EPEL套件

因安裝nginx需設定EPEL來源,所以先安裝EPEL的rpm包,到epel-release-6-8.noarch.rpm的目錄下,安裝EPEL:

[root@localhost tmp]# rpm -ivh epel-release-6-8.noarch.rpm

warning: epel-release-6-8.noarch.rpm: HeaderV3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...               ########################################### [100%]
  1:epel-release          ########################################### [100%]
2、配置EPEL源

因此次演示沒有聯網,所以nginx需要的EPEL源的檔案需要自行下載,並進行來源設定:

[root@localhost tmp]# vi  /etc/yum.repos.d/epel.repo
修改:(這裡需要的EPEL來源套件放置/tmp/epel目錄下)

baseurl=file:///tmp/epel

註解:

#mirrorlist

附:這是安裝nginx所需的EPEL來源的檔案(/tmp/epel目錄下)

(鏡像位址:http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/)

<p>CentOS6<img src=331的rpm包
[root@localhost tmp]# rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm

warning:nginx-release-centos-6-0.el6.ngx.noarch.rpm: Header V4 RSA/SHA1 Signature, keyID 7bd9bf62: NOKEY
Preparing...               ########################################### [100%]
  1:nginx-release-centos  ########################################### [100%]

2)刪除nginx來源

[root@localhost yum.repos.d]# pwd

/etc/yum.repos.d


[root@localhost yum.repos.d]# rm nginx.repo

rm: remove regular file `nginx.repo'? y

3)安裝Nginx
[root@localhost yum.repos.d]# yum install nginx

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package nginx.x86_640:1.0.15-12.el6 will be installed

--> Processing Dependency:nginx-filesystem = 1.0.15-12.el6 for package: nginx-1.0.15-12.el6.x86_64

--> Processing Dependency:nginx-filesystem for package: nginx-1.0.15-12.el6.x86_64

--> Processing Dependency: gd forpackage: nginx-1.0.15-12.el6.x86_64

--> Processing Dependency: GeoIP forpackage: nginx-1.0.15-12.el6.x86_64

--> Processing Dependency:libgd.so.2()(64bit) for package: nginx-1.0.15-12.el6.x86_64

--> Processing Dependency:libGeoIP.so.1()(64bit) for package: nginx-1.0.15-12.el6.x86_64

--> Running transaction check

---> Package GeoIP.x86_64 0:1.6.5-1.el6will be installed

--> Processing Dependency: geoipupdatefor package: GeoIP-1.6.5-1.el6.x86_64

--> Processing Dependency: GeoIP-datafor package: GeoIP-1.6.5-1.el6.x86_64

---> Package gd.x86_64 0:2.0.35-11.el6will be installed

--> Processing Dependency:libXpm.so.4()(64bit) for package: gd-2.0.35-11.el6.x86_64

---> Package nginx-filesystem.noarch0:1.0.15-12.el6 will be installed

--> Running transaction check

---> Package GeoIP-GeoLite-data.noarch0:2015.04-2.el6 will be installed

--> Processing Dependency:GeoIP-GeoLite-data-extra = 2015.04-2.el6 for package:GeoIP-GeoLite-data-2015.04-2.el6.noarch

---> Package geoipupdate.x86_640:2.2.1-2.el6 will be installed

---> Package libXpm.x86_640:3.5.10-2.el6 will be installed

--> Running transaction check

---> PackageGeoIP-GeoLite-data-extra.noarch 0:2015.04-2.el6 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================================

 Package                           Arch            Version                  Repository     Size

================================================================================================

Installing:

 nginx                             x86_64          1.0.15-12.el6            epel          404 k

Installing for dependencies:

 GeoIP                             x86_64          1.6.5-1.el6              epel          113 k

 GeoIP-GeoLite-data                noarch          2015.04-2.el6            epel          343 k

 GeoIP-GeoLite-data-extra          noarch          2015.04-2.el6            epel           23 M

 gd                                x86_64          2.0.35-11.el6            base          142 k

 geoipupdate                       x86_64          2.2.1-2.el6              epel           28 k

 libXpm                            x86_64          3.5.10-2.el6             base           51 k

 nginx-filesystem                  noarch          1.0.15-12.el6            epel          8.1 k

 

Transaction Summary

================================================================================================

Install       8 Package(s)

 

Total download size: 24 M

Installed size: 50 M

Is this ok [y/N]: y

Downloading Packages:

------------------------------------------------------------------------------------------------

Total                                                           61 MB/s |  24 MB     00:00    

warning: rpmts_HdrFromFdno: Header V3RSA/SHA256 Signature, key ID 0608b895: NOKEY

Retrieving key fromfile:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

Importing GPG key 0x0608B895:

 Userid : EPEL (6)<epel>

 Package: epel-release-6-8.noarch (installed)

 From   :/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Warning: RPMDB altered outside of yum.

 Installing : GeoIP-GeoLite-data-extra-2015.04-2.el6.noarch                                1/8

 Installing : GeoIP-GeoLite-data-2015.04-2.el6.noarch                                      2/8

 Installing : geoipupdate-2.2.1-2.el6.x86_64                                               3/8

 Installing : GeoIP-1.6.5-1.el6.x86_64                                                    4/8

 Installing : libXpm-3.5.10-2.el6.x86_64                                                  5/8

 Installing : gd-2.0.35-11.el6.x86_64                                                     6/8

 Installing : nginx-filesystem-1.0.15-12.el6.noarch                                        7/8

 Installing : nginx-1.0.15-12.el6.x86_64                                                  8/8

  Verifying : nginx-filesystem-1.0.15-12.el6.noarch                                        1/8

 Verifying  :GeoIP-1.6.5-1.el6.x86_64                                                    2/8

 Verifying  :GeoIP-GeoLite-data-2015.04-2.el6.noarch                                     3/8

 Verifying  :libXpm-3.5.10-2.el6.x86_64                                                  4/8

 Verifying  :geoipupdate-2.2.1-2.el6.x86_64                                              5/8

 Verifying  : GeoIP-GeoLite-data-extra-2015.04-2.el6.noarch                                6/8

 Verifying  :nginx-1.0.15-12.el6.x86_64                                                  7/8

 Verifying  :gd-2.0.35-11.el6.x86_64                                                     8/8

 

Installed:

 nginx.x86_64 0:1.0.15-12.el6                                                                 

 

Dependency Installed:

 GeoIP.x86_64 0:1.6.5-1.el6                       GeoIP-GeoLite-data.noarch 0:2015.04-2.el6 

 GeoIP-GeoLite-data-extra.noarch 0:2015.04-2.el6   gd.x86_64 0:2.0.35-11.el6                 

 geoipupdate.x86_64 0:2.2.1-2.el6                  libXpm.x86_640:3.5.10-2.el6              

 nginx-filesystem.noarch 0:1.0.15-12.el6         

 

Complete!</epel>

4)運作檢查
4、登入查看,成功

<br>CentOS6<p>5下安裝Nginx</p><br><p>
                
                
                </p>
                    以上就介紹了CentOS65下方安裝Nginx,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。 <br>
                <p align=
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn