Top

Haproxy-Install

使用源码安装Haproxy

我的环境是Centos7.4!

1. 下载源码包解压

[root@server data]# wget https://www.haproxy.org/download/1.9/src/haproxy-1.9.5.tar.gz
[root@server data]# tar -zxf haproxy-1.9.5.tar.gz
[root@server data]# cd haproxy-1.9.5

2. 编译并安装

[root@server haproxy-1.9.5]# make PREFIX=/usr/local/haproxy TARGET=linux3100 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_SYSTEMD=1
[root@server haproxy-1.9.5]# make install PREFIX=/usr/local/haproxy
[root@server haproxy-1.9.5]# ln -s /usr/local/haproxy/sbin/haproxy /usr/sbin/
[root@server haproxy-1.9.5]# cp ./examples/haproxy.init /etc/init.d/haproxy
[root@server haproxy-1.9.5]# chmod 755 /etc/init.d/haproxy
[root@server haproxy-1.9.5]# sed -i s/\${NETWORKING}/\"\${NETWORKING}\"/g /etc/init.d/haproxy
[root@server haproxy-1.9.5]# cd contrib/systemd/
[root@server systemd]# make
[root@server systemd]# cp haproxy.service /usr/lib/systemd/system/