HAproxy 2.4.3 编译安装

  • 官网
https://www.haproxy.org
https://github.com/haproxy/haproxy/releases
  • 下载
yum install make gcc gcc-c++ openssl openssl-devel -y
wget https://www.haproxy.org/download/2.4/src/haproxy-2.4.3.tar.gz
tar haproxy-2.4.3.tar.gz
make TARGET=linux-glic PREFIX=/srv/app/haproxy
  • 编辑Makefile
146 PREFIX = /srv/app/haproxy
157 TARGET = 指定内核类型
  • 安装
make install PREFIX=/srv/app/haproxy
  • 启动文件
cat /usr/lib/systemd/system/haproxy.service 
[Unit]
Description=HAProxy Load Balancer
After=network.target

[Service]
EnvironmentFile=-/etc/default/haproxy
EnvironmentFile=-/etc/sysconfig/haproxy
Environment="CONFIG=/data/haproxy/etc/haproxy.cfg" "PIDFILE=/run/haproxy.pid" "EXTRAOPTS=-S /run/haproxy-master.sock"
ExecStartPre=/data/haproxy/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS
ExecStart=/data/haproxy/sbin/haproxy -W -f $CONFIG -p $PIDFILE $EXTRAOPTS
ExecReload=/data/haproxy/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS
ExecReload=/bin/kill -USR2 $MAINPID
KillMode=mixed
Restart=always
SuccessExitStatus=143
Type=forking

[Install]
WantedBy=multi-user.target
上一篇:linux下查找和启动关闭nginx命令


下一篇:Linux(Centos) yum安装nginx