Last active
January 19, 2018 20:04
-
-
Save arreyder/b2ab74584b79317b984589037dcb4768 to your computer and use it in GitHub Desktop.
Building Access Fabric Nginx Module on AWS Linux
This file contains hidden or 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 | |
# Tested on Amazon Linux AMI release 2017.09 | |
# Install necessary builddeps. | |
sudo yum install git wget pcre-devel zlib-devel libcurl-devel jansson-devel openssl-devel redhat-rpm-config rpm-build gperftools-devel GeoIP-devel gd-devel perl-devel libxslt-devel perl-ExtUtils-Embed -y | |
sudo yum groupinstall "Development Tools" -y | |
# Prepare local rpm build env. | |
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} | |
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros | |
# This spec file for libxjwt will work on Centos6 or AWS-Linux | |
wget https://gist.githubusercontent.com/arreyder/b444db3d950856aa4582d1e5aebfc98d/raw/73e84b4b13f363a6d2567ac62f5926fa52bfa605/libxjwt.spec | |
# Download the 1.0.2 source and build the libxjwt rpm using the spec file. | |
rpmbuild --undefine=_disable_source_fetch -bb ./libxjwt.spec | |
sudo rpm -i rpmbuild/RPMS/x86_64/libxjwt-1.0.2-1.amzn1.x86_64.rpm rpmbuild/RPMS/x86_64/libxjwt-devel-1.0.2-1.amzn1.x86_64.rpm | |
# Grab the nginx source rpm and extract it, so we can build our dynamic module against it's source. | |
yumdownloader --source nginx | |
rpm -ivh ./nginx-1.12.1-1.33.amzn1.src.rpm | |
# Grab the AWS-Linux specific patch for the stock nginx.spec file from the nginx rpm | |
wget https://gist.githubusercontent.com/arreyder/7270429c5b7e51e5787b7e4fc654b2b6/raw/b3a00738cd6bcac24d3e3d67a15366cdbb381ff3/nginx-aws-linux.spec.patch | |
cd ~/rpmbuild/SPECS/ | |
patch -p0 < ~/nginx-aws-linux.spec.patch | |
# Download the source for 1.0.0 of our module and build a rpm using the patched spec. | |
rpmbuild --undefine=_disable_source_fetch -ba nginx.spec | |
# Install the stock nginx rpm and the access fabric module we just built. | |
sudo yum install nginx -y | |
sudo rpm -i ~/rpmbuild/RPMS/x86_64/nginx-mod-http-auth-accessfabric-1.12.1-1.33.amzn1.x86_64.rpm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment