美文网首页OpenResty实战分享
centos7下安装openresty步骤

centos7下安装openresty步骤

作者: cherishpf | 来源:发表于2019-03-11 16:57 被阅读0次

    1、安装依赖包

    # yum install readline-devel pcre-devel openssl-devel gcc curl

    Loaded plugins: fastestmirror

    Determining fastest mirrors

    Could not retrieve mirrorlisthttp://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stockerror was

    14: curl#6 - "Could not resolve host:mirrorlist.centos.org;Unknown error"

    Could not get metalinkhttps://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=x86_64error was

    14: curl#6 - "Could not resolve host:mirrors.fedoraproject.org;Unknown error"

    Could not retrieve mirrorlisthttp://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stockerror was

    这是由于DNS服务器错误。修改一下 /etc/resolv.conf 文件,添加一个nameserver 8.8.8.8完成

    # yum install readline-devel pcre-devel openssl-devel gcc curl

    Loaded plugins: fastestmirror

    Existing lock /var/run/yum.pid: another copy is running as pid 121648.

    Another app is currently holding the yum lock; waiting for it to exit...

     The other application is: yum

       Memory :  25 M RSS (1.4 GB VSZ)

       Started: Thu Feb 28 09:05:55 2019 - 05:44 ago

       State  : Traced/Stopped, pid: 121648

    执行yum时报错,进程已被占用,执行以下命令,强制删除yum进程

    # rm -r /var/run/yum.pid

    rm: remove regular file ‘/var/run/yum.pid’? y

    2、下载Openresty安装包

    # wget https://openresty.org/download/openresty-1.13.6.1.tar.gz

    # tar -zxvf openresty-1.13.6.1.tar.gz

    3、安装LuaJIT

    # cd openresty-1.13.6.1/bundle/LuaJIT-2.1-20171103/

    # make clean && make && make install

    # ln -sf luajit-2.1.0-beta3 /usr/local/bin/luajit

    4、安装openresty1.13.6.1

    # cd openresty-1.13.6.1/

    # ./configure  -j2  --prefix=/usr/local/openresty  --with-pcre  --with-luajit

    (注: --prefix是配置Openresty的安装路径,默认是安装在/usr/local/openresty目录)

    # gmake

    # gmake install

    5、配置环境变量

    Add the following line to your ~/.bashrc or ~/.bash_profile file. 

    Finally, you need to add the command-line utilities provided by OpenResty to your PATH environment, as in

    # vim ~/.bash_profile

    export PATH=/usr/local/openresty/bin:/usr/local/openresty/nginx/sbin:$PATH

    # source ~/.bash_profile

    6、测试配置是否正确

    # nginx  -v

    nginx version: openresty/1.13.6.1

    # nginx  -t

    nginx: the configuration file /usr/local/openresty/nginx/conf/nginx.conf syntax is ok

    nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test is successful

    相关文章

      网友评论

        本文标题:centos7下安装openresty步骤

        本文链接:https://www.haomeiwen.com/subject/idvbpqtx.html