zoukankan      html  css  js  c++  java
  • CentOS 6.5 下离线安装nginx

    一、由于linux下安装nginx 需要 

    zlib zlib-devel openssl openssl-devel pcre pcre-devel gcc
    这些依赖,而这些依赖打安装包在我们系统的光盘里有一个packages目录,里边包含这些依赖,所以我们挂载我们打CentOS.iso文件,并将其packages目录搭建为yum仓库:
    [root@all /]# mkdir /mnt/cdrom
    [root@all /]# mount /dev/cdrom  /mnt/cdrom

    二、搭建yum仓库

    yum使用仓库保存管理rpm的软件包、仓库的配置文件保存在/etc/yum.repos.d/目录下格式如下:
    [LinuxCast]    #仓库的名字 
    name = 对名字的解释      #描述仓库的基本信息 
    baseurl = 仓库的地址 #本地的或者以http、ftp、file、ntfs 
    enable = 1              #是否启用 
    gpgcheck = 1            #是否校验

    [root@all /]# mkdir /home/yum.repos.d/
    [root@all /]# mv /etc/yum.repos.d/* /home/yum.repos.d/
    [root@all /]# vi /etc/yum.repos.d/centos.repo

    这里我的centos.repo配置文件如下:

    [centos]    #仓库的名字 
    name = centos     #描述仓库的基本信息 
    baseurl = file:///mnt/cdrom/packages
    enable = 1              #是否启用 
    gpgcheck = 1            #是否校验

    注意:这里由于系统自带了许多yum仓库,但又是需要联网的,所有需要把/etc/yum.repos.d/目录下其他文件都删除。

    三、测试yum仓库环境

    [root@all /]# yum repolist
    会看到如下信息:

    Loaded plugins: fastestmirror, security
    Loading mirror speeds from cached hostfile
    base | 4.0 kB 00:00 ...
    repo id repo name status
    base CentOs 6.5 6,367
    repolist: 6,367

    这时表示你配置成功了。

     四、配置nginx,并安装依赖

    第一步:从http://nginx.org/download/上下载相应的版本(或者wget http://nginx.org/download/nginx-1.5.9.tar.gz直接在Linux上用命令下载)

    第二步:解压 tar -zxvf nginx-1.5.9.tar.gz 

    第三步:设置一下配置信息 

    ./configure --with-http_ssl_module 
    --with-http_stub_status_module 
    --with-http_gzip_static_module 
    --with-mail 
    --with-mail_ssl_module 

    第四步:

    make 编译 (make的过程是把各种语言写的源码文件,变成可执行文件和各种库文件)

    make install 安装 (make install是把这些编译出来的可执行文件和库文件复制到合适的地方)

    在配置信息的时候,也就是在第三步,出现了一下错误:

    错误为:./configure: error: the HTTP rewrite module requires the PCRE library.

    安装pcre-devel解决问题
    yum -y install pcre-devel

    还有可能出现:

    错误提示:./configure: error: the HTTP cache module requires md5 functions
    from OpenSSL library.   You can either disable the module by using
    --without-http-cache option, or install the OpenSSL library into the system,
    or build the OpenSSL library statically from the source with nginx by using
    --with-http_ssl_module --with-openssl=<path> options.

    解决办法:

    yum -y install openssl openssl-devel

  • 相关阅读:
    Best Time to Buy and Sell Stock
    Remove Nth Node From End of List
    Unique Paths
    Swap Nodes in Pairs
    Convert Sorted Array to Binary Search Tree
    Populating Next Right Pointers in Each Node
    Maximum Subarray
    Climbing Stairs
    Unique Binary Search Trees
    Remove Duplicates from Sorted Array
  • 原文地址:https://www.cnblogs.com/duwanjiang/p/5943631.html
Copyright © 2011-2022 走看看