Created
August 14, 2019 12:31
-
-
Save jamesbjackson/205308ca3dfc6c2f65e63f3d0de891a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
#--------------------------------------------------------------------------------------------------- | |
# Variables | |
#--------------------------------------------------------------------------------------------------- | |
#Set the software versions to be downloaded and installed. | |
openresty_version="1.11.2.2" | |
#---------------------------------------------------------------------------------------------------------------------------- | |
# Initial Setup | |
#---------------------------------------------------------------------------------------------------------------------------- | |
# Install Required Packages | |
sudo apt-get update | |
sudo apt-get install -y \ | |
g++ \ | |
zip \ | |
curl \ | |
perl \ | |
make \ | |
libc6 \ | |
unzip \ | |
cmake \ | |
zlib1g \ | |
openssl \ | |
libgcc1 \ | |
libxml2 \ | |
libpcre3 \ | |
pcregrep \ | |
autoconf \ | |
git-core \ | |
libc6-dev \ | |
libpq-dev \ | |
libkrb5-3 \ | |
libstdc++6 \ | |
libssl-dev \ | |
zlib1g-dev \ | |
libssl-dev \ | |
libxml2-dev \ | |
libyaml-dev \ | |
libxslt-dev \ | |
libssl1.0.0 \ | |
libgmp3-dev \ | |
libgeoip-dev \ | |
libpcre3-dev \ | |
libxslt1-dev \ | |
libreadline6 \ | |
libgcc-4.8-dev \ | |
libgd2-xpm-dev \ | |
libncurses5-dev \ | |
build-essential \ | |
libreadline-dev \ | |
libreadline6-dev \ | |
libgssapi-krb5-2 | |
# Create required Directories | |
mkdir -p /tmp/build | |
# Install Ruby Version Manager | |
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 | |
curl -sSL https://rvm.io/mpapis.asc | gpg --import - | |
curl -sSL https://get.rvm.io | bash -s stable --ruby | |
source /home/vagrant/.rvm/scripts/rvm | |
gem update --system --no-doc | |
# Install Global Ruby Gems | |
#gem install fpm | |
#---------------------------------------------------------------------------------------------------------------------------- | |
# OpenResty | |
#---------------------------------------------------------------------------------------------------------------------------- | |
# Download the OpenResty Package (If not already done) | |
if [ ! -f /tmp/build/openresty-${openresty_version}.tar.gz ]; then | |
wget --quiet http://openresty.org/download/openresty-${openresty_version}.tar.gz -P /tmp/build | |
fi | |
# Extract the OpenResty Package (If not already done) | |
# NO_WARNING_CHECKS=yes ./configure \ | |
if [ ! -d /tmp/build/openresty-${openresty_version} ]; then | |
tar -zxf /tmp/build/openresty-${openresty_version}.tar.gz -C /tmp/build | |
cd /tmp/build/openresty-${openresty_version} | |
./configure \ | |
--with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' \ | |
--with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' \ | |
--prefix=/usr/share/nginx \ | |
--sbin-path=/usr/sbin/nginx \ | |
--conf-path=/etc/nginx/nginx.conf \ | |
--http-log-path=/var/log/nginx/access.log \ | |
--error-log-path=/var/log/nginx/error.log \ | |
--lock-path=/var/lock/nginx.lock \ | |
--pid-path=/run/nginx.pid \ | |
--http-client-body-temp-path=/var/lib/nginx/body \ | |
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \ | |
--http-proxy-temp-path=/var/lib/nginx/proxy \ | |
--http-scgi-temp-path=/var/lib/nginx/scgi \ | |
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \ | |
--with-ipv6 \ | |
--with-mail \ | |
--with-threads \ | |
--with-stream \ | |
--with-file-aio \ | |
--with-pcre-jit \ | |
--with-http_v2_module \ | |
--with-mail_ssl_module \ | |
--with-http_ssl_module \ | |
--with-http_sub_module \ | |
--with-http_dav_module \ | |
--with-http_flv_module \ | |
--with-http_xslt_module \ | |
--with-stream_ssl_module \ | |
--with-http_geoip_module \ | |
--with-http_realip_module \ | |
--with-http_gunzip_module \ | |
--with-http_addition_module \ | |
--with-http_stub_status_module \ | |
--with-http_secure_link_module \ | |
--with-http_gzip_static_module \ | |
--with-http_image_filter_module \ | |
--with-http_auth_request_module \ | |
--with-http_random_index_module | |
make | |
make install DESTDIR=/tmp/openresty | |
mkdir -p /tmp/openresty/var/lib/nginx | |
fi | |
# Create the deb if not done so already | |
cd ~/output | |
rm -f *.deb | |
fpm -s dir -t deb -n openresty -v ${openresty_version} --iteration 1 -C /tmp/openresty \ | |
--description "openresty ${openresty_version}" \ | |
-d libxslt1.1 \ | |
-d libgd2-xpm \ | |
-d libgeoip1 \ | |
-d libpcre3 \ | |
-d libxml2 \ | |
-d libc6 \ | |
-d libc6 \ | |
-d zlib1g \ | |
-d "nginx-common (>= 1.2.0)" \ | |
--conflicts nginx-extras \ | |
--conflicts nginx-full \ | |
--conflicts nginx-light \ | |
run usr var | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment