码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx安装

时间:2016-06-18 01:24:26      阅读:573      评论:0      收藏:0      [点我收藏+]

标签:

Xshell 5 (Build 0964)
Copyright (c) 2002-2016 NetSarang Computer, Inc. All rights reserved.

Type `help to learn how to use Xshell prompt.
[c:\~]$ 

Connecting to 192.168.164.131:22...
Connection established.
To escape to local shell, press Ctrl+Alt+].

[root@localhost ~]# 平时-ef|grep gcc  #该命令输入中文了,错误
bash: 平时-ef: command not found...
[root@localhost ~]# ps-ef|grep gcc
bash: ps-ef: command not found...
[root@localhost ~]# ps -ef|grep gcc #安装nginx时需要先安装有gcc
root      13202  13077  0 11:36 pts/1    00:00:00 grep --color=auto gcc
[root@localhost ~]# rpm -e gcc #查找到的gcc进程不明白怎么回事,不过不用管
error: package gcc is not installed
[root@localhost ~]# yum -y install gcc
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 13030.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  41 M RSS (915 MB VSZ)
    Started: Fri Jun 17 11:35:07 2016 - 01:56 ago
    State  : Sleeping, pid: 13030
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  41 M RSS (915 MB VSZ)
    Started: Fri Jun 17 11:35:07 2016 - 01:59 ago
    State  : Sleeping, pid: 13030
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  41 M RSS (915 MB VSZ)
    Started: Fri Jun 17 11:35:07 2016 - 02:01 ago
    State  : Sleeping, pid: 13030
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  40 M RSS (915 MB VSZ)
    Started: Fri Jun 17 11:35:07 2016 - 02:03 ago
    State  : Running, pid: 13030
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  41 M RSS (918 MB VSZ)
    Started: Fri Jun 17 11:35:07 2016 - 02:05 ago
    State  : Running, pid: 13030
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  42 M RSS (918 MB VSZ)
    Started: Fri Jun 17 11:35:07 2016 - 02:07 ago
    State  : Uninterruptible, pid: 13030
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  42 M RSS (918 MB VSZ)
    Started: Fri Jun 17 11:35:07 2016 - 02:09 ago
    State  : Running, pid: 13030
yAnother app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  41 M RSS (916 MB VSZ)
    Started: Fri Jun 17 11:35:07 2016 - 02:11 ago
    State  : Running, pid: 13030
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  42 M RSS (918 MB VSZ)
    Started: Fri Jun 17 11:35:07 2016 - 02:13 ago
    State  : Sleeping, pid: 13030
^C

Exiting on user cancel.
[root@localhost ~]# kill -9 13030   #我是在vmware中安装的centos7里面进行的这些操作,安装完成重启之后,可能有一些后台进行在进行更新,占用了yum,在这里杀掉进程
[root@localhost ~]# yum -y install gcc #重新安装
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.yun-idc.com
 * updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.8.5-4.el7 will be installed
--> Processing Dependency: cpp = 4.8.5-4.el7 for package: gcc-4.8.5-4.el7.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-4.el7.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-4.el7.x86_64
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-4.el7 will be installed
---> Package glibc-devel.x86_64 0:2.17-106.el7_2.6 will be installed
--> Processing Dependency: glibc-headers = 2.17-106.el7_2.6 for package: glibc-devel-2.17-106.el7_2.6.x86_64
--> Processing Dependency: glibc = 2.17-106.el7_2.6 for package: glibc-devel-2.17-106.el7_2.6.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-106.el7_2.6.x86_64
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
--> Running transaction check
---> Package glibc.x86_64 0:2.17-105.el7 will be updated
--> Processing Dependency: glibc = 2.17-105.el7 for package: glibc-common-2.17-105.el7.x86_64
---> Package glibc.x86_64 0:2.17-106.el7_2.6 will be an update
---> Package glibc-headers.x86_64 0:2.17-106.el7_2.6 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-106.el7_2.6.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-106.el7_2.6.x86_64
--> Running transaction check
---> Package glibc-common.x86_64 0:2.17-105.el7 will be updated
---> Package glibc-common.x86_64 0:2.17-106.el7_2.6 will be an update
---> Package kernel-headers.x86_64 0:3.10.0-327.18.2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================
 Package                                         Arch                                    Version                                                Repository                                Size
===============================================================================================================================================================================================
Installing:
 gcc                                             x86_64                                  4.8.5-4.el7                                            base                                      16 M
Installing for dependencies:
 cpp                                             x86_64                                  4.8.5-4.el7                                            base                                     5.9 M
 glibc-devel                                     x86_64                                  2.17-106.el7_2.6                                       updates                                  1.0 M
 glibc-headers                                   x86_64                                  2.17-106.el7_2.6                                       updates                                  662 k
 kernel-headers                                  x86_64                                  3.10.0-327.18.2.el7                                    updates                                  3.2 M
 libmpc                                          x86_64                                  1.0.1-3.el7                                            base                                      51 k
Updating for dependencies:
 glibc                                           x86_64                                  2.17-106.el7_2.6                                       updates                                  3.6 M
 glibc-common                                    x86_64                                  2.17-106.el7_2.6                                       updates                                   11 M

Transaction Summary
===============================================================================================================================================================================================
Install  1 Package  (+5 Dependent packages)
Upgrade             ( 2 Dependent packages)

Total download size: 42 M
Downloading packages:
updates/7/x86_64/prestodelta                                                                                                                                            | 504 kB  00:00:01     
Delta RPMs reduced 3.6 M of updates to 687 k (81% saved)
warning: /var/cache/yum/x86_64/7/base/packages/cpp-4.8.5-4.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY                            ] 2.5 MB/s |  16 MB  00:00:09 ETA 
Public key for cpp-4.8.5-4.el7.x86_64.rpm is not installed
(1/8): cpp-4.8.5-4.el7.x86_64.rpm                                                                                                                                       | 5.9 MB  00:00:06     
(2/8): gcc-4.8.5-4.el7.x86_64.rpm                                                                                                                                       |  16 MB  00:00:09     
(3/8): glibc-2.17-105.el7_2.17-106.el7_2.6.x86_64.drpm                                                                                                                  | 687 kB  00:00:13     
(4/8): libmpc-1.0.1-3.el7.x86_64.rpm                                                                                                                                    |  51 kB  00:00:00     
Public key for glibc-headers-2.17-106.el7_2.6.x86_64.rpm is not installed        63% [=============================================                          ] 854 kB/s |  25 MB  00:00:17 ETA 
(5/8): glibc-headers-2.17-106.el7_2.6.x86_64.rpm                                                                                                                        | 662 kB  00:00:09     
(6/8): glibc-devel-2.17-106.el7_2.6.x86_64.rpm                                                                                                                          | 1.0 MB  00:00:19     
(7/8): kernel-headers-3.10.0-327.18.2.el7.x86_64.rpm                                                                                                                    | 3.2 MB  00:00:51     
(8/8): glibc-common-2.17-106.el7_2.6.x86_64.rpm                                                                                                                         |  11 MB  00:01:01     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                          654 kB/s |  39 MB  00:01:01     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-2.1511.el7.centos.2.10.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : glibc-2.17-106.el7_2.6.x86_64                                                                                                                                              1/10 
  Updating   : glibc-common-2.17-106.el7_2.6.x86_64                                                                                                                                       2/10 
  Installing : libmpc-1.0.1-3.el7.x86_64                                                                                                                                                  3/10 
  Installing : cpp-4.8.5-4.el7.x86_64                                                                                                                                                     4/10 
  Installing : kernel-headers-3.10.0-327.18.2.el7.x86_64                                                                                                                                  5/10 
  Installing : glibc-headers-2.17-106.el7_2.6.x86_64                                                                                                                                      6/10 
  Installing : glibc-devel-2.17-106.el7_2.6.x86_64                                                                                                                                        7/10 
  Installing : gcc-4.8.5-4.el7.x86_64                                                                                                                                                     8/10 
  Cleanup    : glibc-2.17-105.el7.x86_64                                                                                                                                                  9/10 
  Cleanup    : glibc-common-2.17-105.el7.x86_64                                                                                                                                          10/10 
  Verifying  : glibc-common-2.17-106.el7_2.6.x86_64                                                                                                                                       1/10 
  Verifying  : glibc-headers-2.17-106.el7_2.6.x86_64                                                                                                                                      2/10 
  Verifying  : gcc-4.8.5-4.el7.x86_64                                                                                                                                                     3/10 
  Verifying  : cpp-4.8.5-4.el7.x86_64                                                                                                                                                     4/10 
  Verifying  : glibc-devel-2.17-106.el7_2.6.x86_64                                                                                                                                        5/10 
  Verifying  : glibc-2.17-106.el7_2.6.x86_64                                                                                                                                              6/10 
  Verifying  : libmpc-1.0.1-3.el7.x86_64                                                                                                                                                  7/10 
  Verifying  : kernel-headers-3.10.0-327.18.2.el7.x86_64                                                                                                                                  8/10 
  Verifying  : glibc-2.17-105.el7.x86_64                                                                                                                                                  9/10 
  Verifying  : glibc-common-2.17-105.el7.x86_64                                                                                                                                          10/10 

Installed:
  gcc.x86_64 0:4.8.5-4.el7                                                                                                                                                                     

Dependency Installed:
  cpp.x86_64 0:4.8.5-4.el7    glibc-devel.x86_64 0:2.17-106.el7_2.6    glibc-headers.x86_64 0:2.17-106.el7_2.6    kernel-headers.x86_64 0:3.10.0-327.18.2.el7    libmpc.x86_64 0:1.0.1-3.el7   

Dependency Updated:
  glibc.x86_64 0:2.17-106.el7_2.6                                                            glibc-common.x86_64 0:2.17-106.el7_2.6                                                           

Complete!
[root@localhost ~]# yum -y install prce  
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.yun-idc.com
 * updates: mirror.bit.edu.cn
No package prce available.
Error: Nothing to do
[root@localhost ~]# yum -y install pcre   #nginx安装之前还需安装pcre
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.yun-idc.com
 * updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package pcre.x86_64 0:8.32-15.el7 will be updated
---> Package pcre.x86_64 0:8.32-15.el7_2.1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================
 Package                                   Arch                                        Version                                              Repository                                    Size
===============================================================================================================================================================================================
Updating:
 pcre                                      x86_64                                      8.32-15.el7_2.1                                      updates                                      420 k

Transaction Summary
===============================================================================================================================================================================================
Upgrade  1 Package

Total download size: 420 k
Downloading packages:
Delta RPMs reduced 420 k of updates to 62 k (85% saved)
pcre-8.32-15.el7_8.32-15.el7_2.1.x86_64.drpm                                                                                                                            |  62 kB  00:00:00     
Finishing delta rebuilds of 1 package(s) (420 k)
Running transaction checkrpms>                                                   100% [======================================================================]  0.0 B/s | 420 kB  --:--:-- ETA 
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : pcre-8.32-15.el7_2.1.x86_64                                                                                                                                                 1/2 
  Cleanup    : pcre-8.32-15.el7.x86_64                                                                                                                                                     2/2 
  Verifying  : pcre-8.32-15.el7_2.1.x86_64                                                                                                                                                 1/2 
  Verifying  : pcre-8.32-15.el7.x86_64                                                                                                                                                     2/2 

Updated:
  pcre.x86_64 0:8.32-15.el7_2.1                                                                                                                                                                

Complete!
[root@localhost ~]# yum -y install openssl   #安装openssl
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.yun-idc.com
 * updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package openssl.x86_64 1:1.0.1e-42.el7.9 will be updated
---> Package openssl.x86_64 1:1.0.1e-51.el7_2.5 will be an update
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-51.el7_2.5 for package: 1:openssl-1.0.1e-51.el7_2.5.x86_64
--> Running transaction check
---> Package openssl-libs.x86_64 1:1.0.1e-42.el7.9 will be updated
---> Package openssl-libs.x86_64 1:1.0.1e-51.el7_2.5 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================
 Package                                        Arch                                     Version                                               Repository                                 Size
===============================================================================================================================================================================================
Updating:
 openssl                                        x86_64                                   1:1.0.1e-51.el7_2.5                                   updates                                   712 k
Updating for dependencies:
 openssl-libs                                   x86_64                                   1:1.0.1e-51.el7_2.5                                   updates                                   952 k

Transaction Summary
===============================================================================================================================================================================================
Upgrade  1 Package (+1 Dependent package)

Total download size: 1.6 M
Downloading packages:
Delta RPMs reduced 1.6 M of updates to 509 k (69% saved)
(1/2): openssl-1.0.1e-42.el7.9_1.0.1e-51.el7_2.5.x86_64.drpm                                                                                                            | 323 kB  00:00:00     
(2/2): openssl-libs-1.0.1e-42.el7.9_1.0.1e-51.el7_2.5.x86_64.drpm                                                                                                       | 186 kB  00:00:00     
Finishing delta rebuilds of 2 package(s) (1.6 M)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                          172 kB/s | 509 kB  00:00:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 1:openssl-libs-1.0.1e-51.el7_2.5.x86_64                                                                                                                                     1/4 
  Updating   : 1:openssl-1.0.1e-51.el7_2.5.x86_64                                                                                                                                          2/4 
  Cleanup    : 1:openssl-1.0.1e-42.el7.9.x86_64                                                                                                                                            3/4 
  Cleanup    : 1:openssl-libs-1.0.1e-42.el7.9.x86_64                                                                                                                                       4/4 
  Verifying  : 1:openssl-libs-1.0.1e-51.el7_2.5.x86_64                                                                                                                                     1/4 
  Verifying  : 1:openssl-1.0.1e-51.el7_2.5.x86_64                                                                                                                                          2/4 
  Verifying  : 1:openssl-libs-1.0.1e-42.el7.9.x86_64                                                                                                                                       3/4 
  Verifying  : 1:openssl-1.0.1e-42.el7.9.x86_64                                                                                                                                            4/4 

Updated:
  openssl.x86_64 1:1.0.1e-51.el7_2.5                                                                                                                                                           

Dependency Updated:
  openssl-libs.x86_64 1:1.0.1e-51.el7_2.5                                                                                                                                                      

Complete!
[root@localhost ~]# cd /usr/local/ 
[root@localhost local]# ll
total 0
drwxr-xr-x. 2 root root  6 Aug 12  2015 bin
drwxr-xr-x. 2 root root  6 Aug 12  2015 etc
drwxr-xr-x. 2 root root  6 Aug 12  2015 games
drwxr-xr-x. 2 root root  6 Aug 12  2015 include
drwxr-xr-x. 2 root root  6 Aug 12  2015 lib
drwxr-xr-x. 2 root root  6 Aug 12  2015 lib64
drwxr-xr-x. 2 root root  6 Aug 12  2015 libexec
drwxr-xr-x. 2 root root  6 Aug 12  2015 sbin
drwxr-xr-x. 5 root root 46 Jun 17  2016 share
drwxr-xr-x. 2 root root  6 Aug 12  2015 src
[root@localhost local]# mkdir nginx
[root@localhost local]# 
[root@localhost local]# 
[root@localhost local]# ll
total 0
drwxr-xr-x. 2 root root  6 Aug 12  2015 bin
drwxr-xr-x. 2 root root  6 Aug 12  2015 etc
drwxr-xr-x. 2 root root  6 Aug 12  2015 games
drwxr-xr-x. 2 root root  6 Aug 12  2015 include
drwxr-xr-x. 2 root root  6 Aug 12  2015 lib
drwxr-xr-x. 2 root root  6 Aug 12  2015 lib64
drwxr-xr-x. 2 root root  6 Aug 12  2015 libexec
drwxr-xr-x. 2 root root  6 Jun 17 11:42 nginx
drwxr-xr-x. 2 root root  6 Aug 12  2015 sbin
drwxr-xr-x. 5 root root 46 Jun 17  2016 share
drwxr-xr-x. 2 root root  6 Aug 12  2015 src
[root@localhost local]# cd  nginx/
[root@localhost nginx]# yum -y install nginx #看网上说一般后期安装的软件都会放到/usr/local/下,所以我这里也安装到这个目录下,这个倒是无所谓,个人习惯
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.yun-idc.com
 * updates: mirror.bit.edu.cn
No package nginx available.
Error: Nothing to do
[root@localhost nginx]# yum list *nginx*  #这个没用
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.yun-idc.com
 * updates: mirror.bit.edu.cn
Available Packages
pcp-pmda-nginx.x86_64                                                                             3.10.6-2.el7                                                                             base
[root@localhost nginx]# rpm -e pcp-pmda-nginx.x86_64
error: package pcp-pmda-nginx.x86_64 is not installed
[root@localhost nginx]# ps -ef|grep nginx
root      13538  13077  0 11:46 pts/1    00:00:00 grep --color=auto nginx
[root@localhost nginx]# rpm -qa|grep nginx
[root@localhost nginx]# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm    #下载epel,可以不下载,下面安装了更高版本的
--2016-06-17 11:46:59--  https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Resolving dl.fedoraproject.org (dl.fedoraproject.org)... 209.132.181.23, 209.132.181.27, 209.132.181.24
Connecting to dl.fedoraproject.org (dl.fedoraproject.org)|209.132.181.23|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14432 (14K) [application/x-rpm]
Saving to: ‘epel-release-latest-7.noarch.rpm’

100%[=====================================================================================================================================================>] 14,432      67.0KB/s   in 0.2s   

2016-06-17 11:47:02 (67.0 KB/s) - ‘epel-release-latest-7.noarch.rpm’ saved [14432/14432]

[root@localhost nginx]# rpm -ivh epel-release-latest-7.noarch.rpm     #安装epel,不知道装这个有没有必要,因为下面有一个yum repolist的操作
warning: epel-release-latest-7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:epel-release-7-6                 ################################# [100%]
[root@localhost nginx]# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7-6.noarch.rpm   #可以忽略
--2016-06-17 11:47:30--  https://dl.fedoraproject.org/pub/epel/epel-release-latest-7-6.noarch.rpm
Resolving dl.fedoraproject.org (dl.fedoraproject.org)... 209.132.181.23, 209.132.181.27, 209.132.181.24
Connecting to dl.fedoraproject.org (dl.fedoraproject.org)|209.132.181.23|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2016-06-17 11:47:31 ERROR 404: Not Found.

[root@localhost nginx]# yum -y install epel-release-7-6.noarch  #可以忽略
Loaded plugins: fastestmirror, langpacks


 One of the configured repositories failed (Unknown),
 and yum doesnt have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Disable the repository, so yum wont use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>

     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again
[root@localhost nginx]# yum -y install nginx
Loaded plugins: fastestmirror, langpacks
base                                                                                                                                                                    | 3.6 kB  00:00:00     





 One of the configured repositories failed (Unknown),
 and yum doesnt have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Disable the repository, so yum wont use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>

     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again
[root@localhost nginx]# 
[root@localhost nginx]# 
[root@localhost nginx]# 
[root@localhost nginx]# rpm -Uvh http://mirrors.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm
Retrieving http://mirrors.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.UWaXVA: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                          ################################# [100%]
    package epel-release-7-6.noarch (which is newer than epel-release-6-8.noarch) is already installed
[root@localhost nginx]# repolist
bash: repolist: command not found...
[root@localhost nginx]# yum repolist 
Loaded plugins: fastestmirror, langpacks
base                                                             | 3.6 kB  00:00:00     
epel/x86_64/metalink                                             | 4.7 kB  00:00:00     
epel                                                             | 4.3 kB  00:00:00     
extras                                                           | 3.4 kB  00:00:00     
updates                                                          | 3.4 kB  00:00:00     
(1/3): epel/x86_64/group_gz                                      | 170 kB  00:00:00     
(2/3): epel/x86_64/updateinfo                                    | 565 kB  00:00:03     
epel/x86_64/primary_db         FAILED                                          7:22 ETA ==========                                                           ] 7.6 kB/s | 847 kB  00:09:06 ETA 
https://epel.mirror.angkasa.id/pub/epel/7/x86_64/repodata/fa1fb49257a4a4d9991ad387412c9438385ee68ff166ebcd4445e3ab6fa4623e-primary.sqlite.xz: [Errno 12] Timeout on https://epel.mirror.angkasa.id/pub/epel/7/x86_64/repodata/fa1fb49257a4a4d9991ad387412c9438385ee68ff166ebcd4445e3ab6fa4623e-primary.sqlite.xz: (28, ‘Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds‘)
Trying other mirror.
(3/3): epel/x86_64/primary_db                                                                                                                                           | 4.1 MB  00:00:08     
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * epel: mirrors.neusoft.edu.cn
 * extras: mirrors.yun-idc.com
 * updates: mirror.bit.edu.cn
repo id                                                                      repo name                                                                                                   status
base/7/x86_64                                                                CentOS-7 - Base                                                                                              9,007
epel/x86_64                                                                  Extra Packages for Enterprise Linux 7 - x86_64                                                              10,136
extras/7/x86_64                                                              CentOS-7 - Extras                                                                                              310
updates/7/x86_64                                                             CentOS-7 - Updates                                                                                           1,697
repolist: 21,150
[root@localhost nginx]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * epel: mirrors.neusoft.edu.cn
 * extras: mirrors.yun-idc.com
 * updates: mirror.bit.edu.cn
repo id                                                                      repo name                                                                                                   status
base/7/x86_64                                                                CentOS-7 - Base                                                                                              9,007
epel/x86_64                                                                  Extra Packages for Enterprise Linux 7 - x86_64                                                              10,136
extras/7/x86_64                                                              CentOS-7 - Extras                                                                                              310
updates/7/x86_64                                                             CentOS-7 - Updates                                                                                           1,697
repolist: 21,150
[root@localhost nginx]# yum -y install nginx
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * epel: mirrors.neusoft.edu.cn
 * extras: mirrors.yun-idc.com
 * updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.6.3-8.el7 will be installed
--> Processing Dependency: nginx-filesystem = 1:1.6.3-8.el7 for package: 1:nginx-1.6.3-8.el7.x86_64
--> Processing Dependency: nginx-filesystem for package: 1:nginx-1.6.3-8.el7.x86_64
--> Processing Dependency: GeoIP for package: 1:nginx-1.6.3-8.el7.x86_64
--> Processing Dependency: libGeoIP.so.1()(64bit) for package: 1:nginx-1.6.3-8.el7.x86_64
--> Running transaction check
---> Package GeoIP.x86_64 0:1.5.0-9.el7 will be installed
---> Package nginx-filesystem.noarch 1:1.6.3-8.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================
 Package                                             Arch                                      Version                                           Repository                               Size
===============================================================================================================================================================================================
Installing:
 nginx                                               x86_64                                    1:1.6.3-8.el7                                     epel                                    508 k
Installing for dependencies:
 GeoIP                                               x86_64                                    1.5.0-9.el7                                       base                                    709 k
 nginx-filesystem                                    noarch                                    1:1.6.3-8.el7                                     epel                                     15 k

Transaction Summary
===============================================================================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 1.2 M
Installed size: 3.0 M
Downloading packages:
(1/3): GeoIP-1.5.0-9.el7.x86_64.rpm                                                                                                                                     | 709 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/epel/packages/nginx-filesystem-1.6.3-8.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY               ] 237 kB/s | 864 kB  00:00:01 ETA 
Public key for nginx-filesystem-1.6.3-8.el7.noarch.rpm is not installed
(2/3): nginx-filesystem-1.6.3-8.el7.noarch.rpm                                                                                                                          |  15 kB  00:00:00     
(3/3): nginx-1.6.3-8.el7.x86_64.rpm                                                                                                                                     | 508 kB  00:00:01     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                          759 kB/s | 1.2 MB  00:00:01     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-6.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : GeoIP-1.5.0-9.el7.x86_64                                                                                                                                                    1/3 
  Installing : 1:nginx-filesystem-1.6.3-8.el7.noarch                                                                                                                                       2/3 
  Installing : 1:nginx-1.6.3-8.el7.x86_64                                                                                                                                                  3/3 
  Verifying  : 1:nginx-1.6.3-8.el7.x86_64                                                                                                                                                  1/3 
  Verifying  : 1:nginx-filesystem-1.6.3-8.el7.noarch                                                                                                                                       2/3 
  Verifying  : GeoIP-1.5.0-9.el7.x86_64                                                                                                                                                    3/3 

Installed:
  nginx.x86_64 1:1.6.3-8.el7                                                                                                                                                                   

Dependency Installed:
  GeoIP.x86_64 0:1.5.0-9.el7                                                               nginx-filesystem.noarch 1:1.6.3-8.el7                                                              

Complete!
[root@localhost nginx]# whereis nginx
nginx: /usr/sbin/nginx /etc/nginx /usr/local/nginx /usr/share/nginx /usr/share/man/man3/nginx.3pm.gz /usr/share/man/man8/nginx.8.gz
[root@localhost nginx]# ps -ef|grep nginx
root      13882  13077  0 11:59 pts/1    00:00:00 grep --color=auto nginx
[root@localhost nginx]# service nginx start
Redirecting to /bin/systemctl start  nginx.service #启动nginx
[root@localhost nginx]# ^C
[root@localhost nginx]# /systemctl start  nginx.service #启动nginx
-bash: /systemctl: No such file or directory
[root@localhost nginx]# ps -ef|grep nginx  #查看nginx是否成功启动,如出现下面信息,则启动成功
root      13936      1  0 11:59 ?        00:00:00 nginx: master process /usr/sbin/nginx
nginx     13938  13936  0 11:59 ?        00:00:00 nginx: worker process
root      14131  13077  0 12:00 pts/1    00:00:00 grep --color=auto nginx
[root@localhost nginx]# history 
    1  平时-ef|grep gcc
    2  ps-ef|grep gcc
    3  ps -ef|grep gcc
    4  rpm -e gcc
    5  yum -y install gcc
    6  kill -9 13030
    7  yum -y install gcc
    8  yum -y install prce
    9  yum -y install pcre
   10  yum -y install openssl
   11  cd /usr/local/
   12  ll
   13  mkdir nginx
   14  ll
   15  cd  nginx/
   16  yum -y install nginx
   17  yum list *nginx*
   18  rpm -e pcp-pmda-nginx.x86_64
   19  ps -ef|grep nginx
   20  rpm -qa|grep nginx
   21  wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
   22  rpm -ivh epel-release-latest-7.noarch.rpm 
   23  wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7-6.noarch.rpm
   24  yum -y install epel-release-7-6.noarch
   25  yum -y install nginx
   26  rpm -Uvh http://mirrors.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm
   27  repolist
   28  yum repolist
   29  yum -y install nginx
   30  whereis nginx
   31  ps -ef|grep nginx
   32  service nginx start
   33  /systemctl start  nginx.service
   34  ps -ef|grep nginx
   35  history 
[root@localhost nginx]# systemctl stop firewalld.service
[root@localhost nginx]# systemctl status firewalld.service  #关闭防火墙,以便在虚拟机外进行访问,验证nginx是否启动
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Fri 2016-06-17 12:04:36 EDT; 11s ago
 Main PID: 943 (code=exited, status=0/SUCCESS)

Jun 17 11:32:19 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Jun 17 11:32:29 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Jun 17 12:04:33 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Jun 17 12:04:36 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@localhost nginx]# 

以上为安装nginx的全过程,有些操作可能没有必要,先做个记录,以便以后安装的时候出现问题可以做个参考

如果出现下面信息,则表明nginx安装成功,浏览器中输入的是安装有nginx的虚拟机ip地址,nginx默认端口为80

技术分享

 

Nginx安装

标签:

原文地址:http://www.cnblogs.com/qq931399960/p/5595497.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!