HAProxy community

How to compile HAProxy

Hi
I hve tried to compile HAProxy after what I have found by googling a round
make TARGET=linux-glibc CPU=native USE_STATIC_PCRE=1 USE_OPENSSL=1.1.1 USE_ZLIB=1
sudo make install

sudo touch /etc/init.d/haproxy
sudo chmod +x /etc/init.d/haproxy
sudo nano /etc/init.d/haproxy

sudo mkdir /etc/haproxy
sudo nano /etc/haproxy/haproxy.cfg

At this stage I have not seen any errors.
Then I run
sudo service haproxy start
Failed to start haproxy.service: Unit haproxy.service not found.

Any suggestions how to fix this. And also are there and official guide to compile HAProxy?

HAProxy -vv output do not shows any problemsadministrator@HAProxy:/$ haproxy -vv
HA-Proxy version 2.2.2 2020/07/31 - https://haproxy.org/
Status: long-term supported branch - will stop receiving fixes around Q2 2025.
Known bugs: http://www.haproxy.org/bugs/bugs-2.2.2.html
Running on: Linux 5.8.0-050800-generic #202008022230 SMP Sun Aug 2 22:33:21 UTC 2020 x86_64
Build options :
TARGET = linux-glibc
CPU = native
CC = gcc
CFLAGS = -O2 -march=native -g -Wall -Wextra -Wdeclaration-after-statement -fwrapv -Wno-address-of-packed-member -Wno-unused-label -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wno-missing-field-initializers -Wno-stringop-overflow -Wno-cast-function-type -Wtype-limits -Wshift-negative-value -Wshift-overflow=2 -Wduplicated-cond -Wnull-dereference
OPTIONS = USE_STATIC_PCRE=1 USE_OPENSSL=1.1.1 USE_ZLIB=1

Feature list : +EPOLL -KQUEUE +NETFILTER -PCRE -PCRE_JIT -PCRE2 -PCRE2_JIT +POLL -PRIVATE_CACHE +THREAD -PTHREAD_PSHARED +BACKTRACE +STATIC_PCRE -STATIC_PCRE2 +TPROXY +LINUX_TPROXY +LINUX_SPLICE +LIBCRYPT +CRYPT_H +GETADDRINFO +OPENSSL -LUA +FUTEX +ACCEPT4 +ZLIB -SLZ +CPU_AFFINITY +TFO +NS +DL +RT -DEVICEATLAS -51DEGREES -WURFL -SYSTEMD -OBSOLETE_LINKER +PRCTL +THREAD_DUMP -EVPORTS

Default settings :
bufsize = 16384, maxrewrite = 1024, maxpollevents = 200

Built with multi-threading support (MAX_THREADS=64, default=4).
Built with OpenSSL version : OpenSSL 1.1.1f 31 Mar 2020
Running on OpenSSL version : OpenSSL 1.1.1f 31 Mar 2020
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports : TLSv1.0 TLSv1.1 TLSv1.2 TLSv1.3
Built with network namespace support.
Built with zlib version : 1.2.11
Running on zlib version : 1.2.11
Compression algorithms supported : identity(“identity”), deflate(“deflate”), raw-deflate(“deflate”), gzip(“gzip”)
Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT IP_FREEBIND
Built with PCRE version : 8.39 2016-06-14
Running on PCRE version : 8.39 2016-06-14
PCRE library supports JIT : no (USE_PCRE_JIT not set)
Encrypted password support via crypt(3): yes
Built with gcc compiler version 9.3.0

Available polling systems :
epoll : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result OK
Total: 3 (3 usable), will use epoll.

Available multiplexer protocols :
(protocols marked as cannot be specified using ‘proto’ keyword)
fcgi : mode=HTTP side=BE mux=FCGI
: mode=HTTP side=FE|BE mux=H1
h2 : mode=HTTP side=FE|BE mux=H2
: mode=TCP side=FE|BE mux=PASS

Available services : none

Regards
Henning

What’s the OS? Do you have systemd?

Hi
Ubuntu 20.04 and upgrade to 5.8
Have tried something systemd but that didnot work out. But I am not sure how to do systemd

Regards
Henning

If you have systemd you need to use systemd, not obsolete init.d scripts.

Please see:

Also, use the systemctl command to start/enable and stop system units.

Hi
Thanks for your answers. I will need to look into how to do this.

Regards
Henning

The link posted above guides you through it step by step.

But if you are on Ubuntu, why are you going to all this trouble anyway?

If you just want uptodate haproxy packages on ubuntu, just use Vincent’s builds from:

https://haproxy.debian.net/

Hi
Because I first found the link when I was in the proccess of compiling it. As the default version for Ubuntu is very old. And yes I think I will start all over and go that way insted.
Thanks againg