Skip to content

Instantly share code, notes, and snippets.

@juliandunn
Last active May 31, 2022 08:02
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save juliandunn/866bd3bf299c9290b718 to your computer and use it in GitHub Desktop.
Save juliandunn/866bd3bf299c9290b718 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# aixsetup.sh: Set up an AIX 6.1 server to have all the prerequisites to run Omnibus.
#
# Authors: Scott Hain (<shain@getchef.com>), Julian Dunn (<jdunn@getchef.com>)
#
# Notes:
# 1. /bin/sh is actually ksh. Your bashisms ain't gonna work here, sonny!
# 2. Run this script as superuser.
# 3. I've tried to be clear about what requires GNU Make and what requires BSD make
# (calls to "gmake" versus "make") but yes, gmake should work across the board.
# 4. You need to have installed the IBM XL C/C++ compiler, version 13.1.0, before
# running this script.
# Make sure to get rid of any gcc stragglers. We're not in Hurdland, Dorothy
rpm -e libstdc++ libstdc++-devel libgcc gcc-c++ gcc gcc-locale
# We definitely don't want pkg-config anywhere near our system, 'cause it interferes with the Ruby build
rpm -e pkg-config
# Base tools
rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/wget/wget-1.9.1-1.aix5.1.ppc.rpm
rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/sudo/sudo-1.6.9p23-2noldap.aix5.3.ppc.rpm
rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/bash/bash-4.2-1.aix6.1.ppc.rpm
# Often zlib and zlib-devel are already on the base system, so that's why
# we are -U the thing
rpm -U ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/zlib/zlib-1.2.7-1.aix6.1.ppc.rpm
rpm -U ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/zlib/zlib-devel-1.2.7-1.aix6.1.ppc.rpm
# gtar
rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/tar/tar-1.22-1.aix6.1.ppc.rpm
# Limits
chsec -f /etc/security/limits -s default -a "data=-1"
chsec -f /etc/security/limits -s default -a "rss=-1"
chsec -f /etc/security/limits -s default -a "nofiles=50000"
# Allow bash as a shell
chsec -f /etc/security/login.cfg -s usw -a "shells=/bin/sh,/bin/bsh,/bin/csh,/bin/ksh,/bin/tsh,/bin/ksh93,/usr/bin/sh,/usr/bin/bsh,/usr/bin/csh,/usr/bin/ksh,/usr/bin/tsh,/usr/bin/ksh93,/usr/bin/rksh,/usr/bin/rksh93,/usr/sbin/uucp/uucico,/usr/sbin/sliplogin,/usr/sbin/snappd,/usr/bin/bash"
# Set new path with XLC
export PATH=/opt/IBM/xlC/13.1.0/bin:/opt/IBM/xlc/13.1.0/bin:/usr/bin:/etc:/usr/sbin:/usr/local/bin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:
# Moar tools
rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/make/make-3.81-1.aix6.1.ppc.rpm
rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/coreutils/coreutils-5.2.1-2.aix5.1.ppc.rpm
# Install new wget
wget http://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz
gtar xzf wget-1.15.tar.gz
cd wget-1.15
CC=xlc_r ./configure --with-ssl=openssl --enable-largefile
CC=xlc_r make
CC=xlc_r make install
rpm -e wget
cd ..
# OpenSSL
wget --no-check-certificate https://www.openssl.org/source/openssl-1.0.1i.tar.gz
gtar xf openssl-1.0.1i.tar.gz
cd openssl-1.0.1i
./Configure aix64-cc
make depend
make
make test
make install
cd ..
# Get the default cacert bundle
wget -O /usr/local/ssl/certs/cacert.pem http://curl.haxx.se/ca/cacert.pem
# Get us a curl that doesn't suck and make sure to link against
# the OpenSSL we just built
wget http://curl.haxx.se/download/curl-7.37.1.tar.gz
gtar xf curl-7.37.1.tar.gz
cd curl-7.37.1
./configure --with-ssl=/usr/local/ssl --with-ca-bundle=/usr/local/ssl/certs/cacert.pem
make
make install
cd ..
# sed
rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/sed/sed-4.1.1-1.aix5.1.ppc.rpm
# expat - needed for Git - might already be installed, so upgrade it if so
rpm -U ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/expat/expat-2.0.1-2.aix5.3.ppc.rpm
rpm -U ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/expat/expat-devel-2.0.1-2.aix5.3.ppc.rpm
# git
wget --no-check-certificate https://git-core.googlecode.com/files/git-1.9.0.tar.gz
gtar xf git-1.9.0.tar.gz
cd git-1.9.0
./configure --with-curl=/usr/local --without-tcltk
sed -e 's#^INSTALL = install#INSTALL = /opt/freeware/bin/install#' Makefile > Makefile.new
gmake
gmake -f Makefile.new install
cd ..
# patch - for Omnibus toolchain
rpm -i ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/patch/patch-2.5.4-4.aix4.3.ppc.rpm
# libffi
wget ftp://sourceware.org/pub/libffi/libffi-3.1.tar.gz
gtar xf libffi-3.1.tar.gz
cd libffi-3.1
INSTALL=/opt/freeware/bin/install ./configure
make
make install
cd ..
# ruby
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
gtar xf ruby-2.1.2.tar.gz
cd ruby-2.1.2
# disable rdoc 'cause otherwise it'll suck up all the CPU and memory
# for no reason as we don't care about docs
LDFLAGS="-L/usr/local/lib" CFLAGS="-qlanglvl=extc99 -I/usr/local/include -I/usr/local/lib/libffi-3.1/include" ./configure --disable-install-rdoc
make
make install
cd ..
# need bundler to run Omnibus projects
/usr/local/bin/gem install bundler --no-ri --no-rdoc
# gawk is needed for libedit during an omnibus build - it doesn't know how to deal with BSD AWK
rpm -i ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gawk/gawk-3.1.3-1.aix5.1.ppc.rpm
# -30-
# you should now be in a good situation where you can Omnibus.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment