Amazon linux 2023 install openresty

1,165 阅读1分钟

编译安装的过程主要会遇到geoip和openssl的问题

- geioip的问题

由于amazon linux 2023已经把geoip包删除,不能再通过yum install geoip geoip-devel进行安装了,找到了下面的rpm包可以直接安装。

rpm -ivh https://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/x86_64/os/Packages/g/GeoIP-devel-1.6.12-14.fc39.x86_64.rpm https://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/x86_64/os/Packages/g/GeoIP-1.6.12-14.fc39.x86_64.rpm https://rpmfind.net/linux/opensuse/distribution/leap/15.4/repo/oss/noarch/GeoIP-data-1.6.12-6.3.1.noarch.rpm

- openssl的问题

make install_sw LIBDIR=lib Operating system: x86_64-whatever-linux2 Can't locate FindBin.pm in @INC (you may need to install the FindBin module) (@INC contains: /usr/local/lib64/perl5/5.32 /usr/local/share/perl5/5.32 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at ./Configure line 15. BEGIN failed--compilation aborted at ./Configure line 15. Can't locate FindBin.pm in @INC (you may need to install the FindBin module) (@INC contains: /usr/local/lib64/perl5/5.32 /usr/local/share/perl5/5.32 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at ./Configure line 15. BEGIN failed--compilation aborted at ./Configure line 15. This system (linux-x86_64) is not supported. See file INSTALL for details. make[2]: *** [objs/Makefile:3421: /opt/openssl-1.1.1u/.openssl/include/openssl/ssl.h] Error 1

需要安装下面的包

 yum install perl-devel perl-FindBin 

下面是完整的安装步骤

  • 安装依赖包
 yum install gzip git wget make gcc pcre pcre-devel zlib-devel gd gd-devel  diffutils openssl procps
 git clone https://github.com/yzprofile/ngx_http_dyups_module.git
 git clone https://github.com/yaoweibin/nginx_upstream_check_module.git
 git clone https://github.com/vozlt/nginx-module-vts.git
 wget https://www.openssl.org/source/openssl-1.1.1u.tar.gz
 
  • 编译安装
./configure --prefix=/opt/openresty --with-http_realip_module  --with-http_v2_module --with-http_image_filter_module --with-http_iconv_module  --with-stream_realip_module --with-stream --with-stream_ssl_module --with-stream_geoip_module --with-http_slice_module --with-http_sub_module --add-module=/opt/ngx_http_dyups_module --add-module=/opt/nginx_upstream_check_module --with-http_stub_status_module   --with-http_gzip_static_module --add-module=/opt/nginx-module-vts --with-openssl=/opt/openssl-1.1.1u --add-dynamic-module=/opt/ngx_http_geoip2_module --with-stream --with-pcre-jit --with-ipv6
make && make install

参考:

docs.aws.amazon.com/linux/al202…