天天看點

nginxnginx的安裝方法 

nginx的安裝方法 

方法一: yum安裝

步驟一:安裝依賴軟體

[[email protected] www]# yum install -y  gcc gcc-c++ autoconf yum-utils
           

步驟二:配置nginx官方源

[[email protected] www]# vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
           

步驟三:下載下傳安裝

[[email protected] ~]#  yum install nginx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
nginx-stable                                          | 2.9 kB     00:00     
nginx-stable/7/x86_64/primary_db                        |  42 kB   00:01     
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.14.2-1.el7_4.ngx will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package    Arch        Version                      Repository         Size
=============================================================================
Installing:
 nginx      x86_64      1:1.14.2-1.el7_4.ngx         nginx-stable      754 k

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

Total download size: 754 k
Installed size: 2.6 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/nginx-stable/packages/nginx-1.14.2-1.el7_4.ngx.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY00:00:01 ETA 
Public key for nginx-1.14.2-1.el7_4.ngx.x86_64.rpm is not installed
nginx-1.14.2-1.el7_4.ngx.x86_64.rpm                                                                                                   | 754 kB  00:00:03     
Retrieving key from https://nginx.org/keys/nginx_signing.key
Importing GPG key 0x7BD9BF62:
 Userid     : "nginx signing key <[email protected]>"
 Fingerprint: 573b fd6b 3d8f bc64 1079 a6ab abf5 bd82 7bd9 bf62
 From       : https://nginx.org/keys/nginx_signing.key
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:nginx-1.14.2-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.14.2-1.el7_4.ngx.x86_64                                                                                                         1/1 

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

Complete!
[[email protected] ~]# 
           

注: yum安裝時 先确認使用源是否為nginx-stable 再确認安裝

如果源不是nginx-stable  先執行yum clean all  再進行安裝即可

繼續閱讀