Skip to content

Instantly share code, notes, and snippets.

@ChrisMcKee
Last active August 29, 2015 14:03
Show Gist options
  • Save ChrisMcKee/058a5c9aeab856127c5b to your computer and use it in GitHub Desktop.
Save ChrisMcKee/058a5c9aeab856127c5b to your computer and use it in GitHub Desktop.
Upgrade Src Install of HAProxy
#!/bin/bash
### VARIABLES ###
PRE_PACK="openssl-devel pcre-devel make gcc"
VER="1.5.1"
# Setup Colours
black='\E[30;40m'
red='\E[31;40m'
green='\E[32;40m'
yellow='\E[33;40m'
blue='\E[34;40m'
magenta='\E[35;40m'
cyan='\E[36;40m'
white='\E[37;40m'
boldblack='\E[1;30;40m'
boldred='\E[1;31;40m'
boldgreen='\E[1;32;40m'
boldyellow='\E[1;33;40m'
boldblue='\E[1;34;40m'
boldmagenta='\E[1;35;40m'
boldcyan='\E[1;36;40m'
boldwhite='\E[1;37;40m'
Reset="tput sgr0" # Reset text attributes to normal
#+ without clearing screen.
cecho () # Coloured-echo.
# Argument $1 = message
# Argument $2 = color
{
message=$1
color=$2
echo -e "$color$message" ; $Reset
return
}
clear
cecho "Installing/upgrading your web server..." $boldgreen
yum -y -q install $PRE_PACK > /dev/null
mkdir -p /src
cd /src
wget -q http://www.haproxy.org/download/1.5/src/haproxy-$VER.tar.gz
tar xzf haproxy-$VER.tar.gz && rm -f haproxy*.tar.gz;
cd haproxy-$VER
cecho "Configuring and Making HAPROXY" $boldgreen
make TARGET=linux2628 CPU=x86_64 USE_OPENSSL=1 USE_ZLIB=1 USE_PCRE=1 # compiles it with compression and ssl support; use CPU=x86_64 for CentOS x64 or i686 where approriate
cecho "Installing HAPROXY" $boldgreen
make install
cecho "Creating config and Adding Daemon" $boldgreen
cp /usr/local/sbin/haproxy* /usr/sbin/ # copy binaries to /usr/sbin
echo "reset haproxy"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment