-
Notifications
You must be signed in to change notification settings - Fork 59
Building OpenResty
The instructions provided below specify the steps to build OpenResty 1.29.2.5 on Linux on IBM Z for the following distributions:
- RHEL (8.10, 9.6, 9.7, 10.0, 10.1)
- SLES (15 SP7, 16)
- Ubuntu (22.04, 24.04, 25.10)
General Notes:
-
When following the steps below please use a standard permission user unless otherwise specified.
-
A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
If you want to build OpenResty using manual steps, go to Step 2.
Use the following commands to build OpenResty using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/OpenResty/1.29.2.5/build_openresty.sh
# Build OpenResty
bash build_openresty.sh [Provide -t option for executing build with tests]If the build completes successfully, go to STEP 8. In case of error, check logs for more details or go to STEP 2 to follow manual build steps.
export SOURCE_ROOT=/<source_root>/-
RHEL (8.10, 9.6, 9.7)
sudo yum install -y openssl-devel curl tar wget make gcc dos2unix perl patch pcre-devel zlib-devel perl-App-cpanminus git iproute
-
RHEL (10.0, 10.1)
sudo yum install -y openssl-devel openssl procps-ng curl tar wget make gcc dos2unix perl patch pcre2-devel zlib-devel perl-App-cpanminus git iproute
-
SLES (15 SP7, 16)
sudo zypper install -y binutils coreutils curl diffutils dos2unix findutils gawk gcc git gzip iproute2 make openssl openssl-devel procps patch pcre-devel perl perl-App-cpanminus tar wget which zlib-devel
-
Ubuntu (22.04, 24.04, 25.10)
sudo apt-get update sudo apt-get install -y openssl libssl-dev git curl tar wget make gcc build-essential dos2unix patch libpcre3-dev libpq-dev perl cpanminus zlib1g-dev iproute2 sudo ln -s /usr/bin/make /usr/bin/gmake # Only if /usr/bin/gmake doesn't exist
cd $SOURCE_ROOT
git clone -b v1.29.2.5 https://github.com/openresty/openresty.gitcd $SOURCE_ROOT/openresty
export PCRE_VER=10.47
export PCRE_PREFIX=/opt/pcre2
export PCRE_LIB=$PCRE_PREFIX/lib
export PCRE_INC=$PCRE_PREFIX/include
wget https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${PCRE_VER}/pcre2-${PCRE_VER}.tar.gz
tar -xzf pcre2-$PCRE_VER.tar.gz
cd pcre2-$PCRE_VER/
./configure --prefix=$PCRE_PREFIX --enable-jit --enable-utf --enable-unicode-properties
make -j$JOBS
sudo PATH=$PATH make installcd $SOURCE_ROOT/openresty
wget --no-check-certificate https://openresty.org/download/openresty-1.29.2.5.tar.gz
tar xvf openresty-1.29.2.5.tar.gzcd $SOURCE_ROOT/openresty/openresty-1.29.2.5
export PATH=$PATH:/sbin # Only on SLES
./configure --prefix=/usr/local/openresty \
--with-pcre-jit \
--with-cc-opt="-I/usr/local/include" \
--with-ld-opt="-L/usr/local/lib -Wl,-rpath,/usr/local/lib" \
--with-http_ssl_module \
--with-http_iconv_module \
--with-debug \
--with-http_realip_module \
--with-stream_realip_module \
-j$(nproc)
make -j$(nproc)
sudo make install
export PATH=/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin:$PATHsudo cpanm --notest Test::Nginx IPC::Run3cd $SOURCE_ROOT/openresty
find . -type f -exec sed -i 's/LuaJIT-2\.1-[0-9]\+/LuaJIT-2.1-20260415/g' {} +
find . -type f -exec sed -i 's/nginx-1\.[0-9]\+\.[0-9]\+/nginx-1.29.2/g' {} +
find . -type f -exec sed -i 's/ngx_lua-[0-9\.A-Za-z]\+/ngx_lua-0.10.31rc2/g' {} +
find . -type f -exec sed -i 's/ngx_stream_lua-[0-9\.A-Za-z]\+/ngx_stream_lua-0.0.19rc3/g' {} +
find . -type f -exec sed -i 's/lua-resty-core-[0-9\.A-Za-z]\+/lua-resty-core-0.1.34rc2/g' {} +cd $SOURCE_ROOT/openresty
prove -I. -r t/All the test cases should pass.
resty -V
resty -e 'print("hello, world")'The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue if you have any questions or feedback.