一、Installing haproxy-2.4.0 in CentOS 8.2 for use in Kubernetes Clusters
地址
二、安装lua
1 准备相关软件包
yum install gcc readline-devel openssl-devel systemd-devel pcre-devel -y
2 wget 下载
cd /opt/software/
wget http://www.lua.org/ftp/lua-5.4.3.tar.gz
3 解压
cd /opt/software
tar xf /opt/software/lua-5.4.3.tar.gz -C /opt && cd /opt/lua-5.4.3
[root@kube-master02 lua-5.4.3]# make linux
make[1]: Entering directory '/opt/lua-5.4.3/src'
make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl"
make[2]: Entering directory '/opt/lua-5.4.3/src'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/opt/lua-5.4.3/src'
make[1]: Leaving directory '/opt/lua-5.4.3/src'
[root@kube-master02 lua-5.4.3]# make linux test
make[1]: Entering directory '/opt/lua-5.4.3/src'
make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl"
make[2]: Entering directory '/opt/lua-5.4.3/src'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/opt/lua-5.4.3/src'
make[1]: Leaving directory '/opt/lua-5.4.3/src'
make[1]: Entering directory '/opt/lua-5.4.3/src'
./lua -v
Lua 5.4.3 Copyright (C) 1994-2021 Lua.org, PUC-Rio
make[1]: Leaving directory '/opt/lua-5.4.3/src'
三、安装haproxy
1 wget 下载
cd /opt/software/
wget https://github.com/haproxy/haproxy/archive/refs/tags/v2.4.0.tar.gz
2 解压
tar xf haproxy-2.4.0.tar.gz -C /opt/ && cd /opt/haproxy-2.4.0
3 编译
make ARCH=x86_64 TARGET=linux-glibc USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_SYSTEMD=1 USE_LUA=1 LUA_INC=/opt/lua-5.4.3/src LUA_LIB=/opt/lua-5.4.3/src
4 安装
[root@kube-master02 haproxy-2.4.0]# make install PREFIX=/usr/local/haproxy-2.4
install: creating directory '/usr/local/haproxy-2.4'
install: creating directory '/usr/local/haproxy-2.4/sbin'
'haproxy' -> '/usr/local/haproxy-2.4/sbin/haproxy'
install: creating directory '/usr/local/haproxy-2.4/share'
install: creating directory '/usr/local/haproxy-2.4/share/man'
install: creating directory '/usr/local/haproxy-2.4/share/man/man1'
'doc/haproxy.1' -> '/usr/local/haproxy-2.4/share/man/man1/haproxy.1'
install: creating directory '/usr/local/haproxy-2.4/doc'
install: creating directory '/usr/local/haproxy-2.4/doc/haproxy'
'doc/configuration.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/configuration.txt'
'doc/management.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/management.txt'
'doc/seamless_reload.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/seamless_reload.txt'
'doc/architecture.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/architecture.txt'
'doc/peers-v2.0.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/peers-v2.0.txt'
'doc/regression-testing.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/regression-testing.txt'
'doc/cookie-options.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/cookie-options.txt'
'doc/lua.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/lua.txt'
'doc/WURFL-device-detection.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/WURFL-device-detection.txt'
'doc/proxy-protocol.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/proxy-protocol.txt'
'doc/linux-syn-cookies.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/linux-syn-cookies.txt'
'doc/SOCKS4.protocol.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/SOCKS4.protocol.txt'
'doc/network-namespaces.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/network-namespaces.txt'
'doc/DeviceAtlas-device-detection.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/DeviceAtlas-device-detection.txt'
'doc/51Degrees-device-detection.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/51Degrees-device-detection.txt'
'doc/netscaler-client-ip-insertion-protocol.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/netscaler-client-ip-insertion-protocol.txt'
'doc/peers.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/peers.txt'
'doc/close-options.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/close-options.txt'
'doc/SPOE.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/SPOE.txt'
'doc/intro.txt' -> '/usr/local/haproxy-2.4/doc/haproxy/intro.txt
ln -s /usr/local/haproxy-2.4/ /usr/local/haproxy
5 查看版本
/opt/lua-5.4.3/src/lua -v
/usr/local/haproxy-2.4/sbin/haproxy -v
四、报错
[root@kube-master02 haproxy-2.4.0]# make ARCH=x86_64 TARGET=linux-glibc USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_SYSTEMD=1 USE_LUA=1 LUA_INC=/opt/lua-5.4.3/src LUA_LIB=/opt/lua-5.4.3/src
CC src/ev_poll.o
CC src/ev_epoll.o
CC src/cpuset.o
CC src/ssl_sample.o
In file included from include/haproxy/pattern-t.h:28,
from include/haproxy/acl-t.h:25,
from include/haproxy/acl.h:25,
from src/ssl_sample.c:23:
include/haproxy/regex-t.h:31:10: fatal error: pcre.h: No such file or directory
#include <pcre.h>
^~~~~~~~
compilation terminated.
make: *** [Makefile:945: src/ssl_sample.o] Error 1
解决
yum install pcre-devel -y
标签:haproxy,use,8.2,doc,usr,txt,local,2.4 From: https://www.cnblogs.com/huaxiayuyi/p/16834513.html