Starting with a base install of Ubuntu 12 with openssh installed
As HAProxy will be built from source, there are some pre-reqs
sudo apt-get install build-essential libssl-dev libpopt-dev git libpcre3-dev |
sudo apt-get install build-essential libssl-dev libpopt-dev git libpcre3-dev
now get the haproxy source and build it
git clone http://git.1wt.eu/git/haproxy.git/ haproxy
cd haproxy
make TARGET=linux2628 CPU=native USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1
sudo make install |
git clone http://git.1wt.eu/git/haproxy.git/ haproxy
cd haproxy
make TARGET=linux2628 CPU=native USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1
sudo make install
link it from /usr/local/sbin to /usr/sbin
sudo ln -s /usr/local/sbin/haproxy /usr/sbin/haproxy |
sudo ln -s /usr/local/sbin/haproxy /usr/sbin/haproxy
Create the directory to use
sudo mkdir /usr/share/haproxy |
sudo mkdir /usr/share/haproxy
now configure HAProxy to start automatically, create the init file as per attached file init.d.haproxy.txt
sudo nano /etc/init.d/haproxy |
sudo nano /etc/init.d/haproxy
make it executable
sudo chmod +x /etc/init.d/haproxy |
sudo chmod +x /etc/init.d/haproxy
now set the runlevels
sudo update-rc.d haproxy defaults |
sudo update-rc.d haproxy defaults
Now create the file that enables it
sudo nano /etc/default/haproxy |
sudo nano /etc/default/haproxy
# Set ENABLED to 1 if you want the init script to start haproxy.
ENABLED=1
# Add extra flags here.
#EXTRAOPTS="-de -m 16" |
# Set ENABLED to 1 if you want the init script to start haproxy.
ENABLED=1
# Add extra flags here.
#EXTRAOPTS="-de -m 16"
add a haproxy user
sudo adduser --system haproxy |
sudo adduser --system haproxy
copy the rest of the files into place
sudo mkdir /etc/haproxy
sudo mkdir /etc/haproxy/errors
sudo cp ~/haproxy/examples/errorfiles/* /etc/haproxy/errors |
sudo mkdir /etc/haproxy
sudo mkdir /etc/haproxy/errors
sudo cp ~/haproxy/examples/errorfiles/* /etc/haproxy/errors
The build can be updated with
cd ~/haproxy
git pull
make clean
make TARGET=linux2628 CPU=native USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1
sudo make install |
cd ~/haproxy
git pull
make clean
make TARGET=linux2628 CPU=native USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1
sudo make install
Then restarting haproxy to use the updated version
sudo service haproxy restart |
sudo service haproxy restart