Esta sección muestra cómo compilar los binarios del agente de Zabbix para macOS desde el código fuente con o sin TLS.
Necesitará herramientas de desarrollo de línea de comandos (Xcode no es necesario), Automake, pkg-config y PCRE (v8.x) o PCRE2 (v10.x). Si desea compilar binarios del agente con TLS, también necesitará OpenSSL o GnuTLS.
Para instalar Automake y pkg-config, necesitará un gestor de paquetes Homebrew de https://brew.sh/. Para instalarlo, abra la terminal y ejecute el siguiente comando:
Luego instale Automake y pkg-config:
La preparación de las bibliotecas PCRE, OpenSSL y GnuTLS depende de la forma en que se vayan a vincular al agente.
Si tiene la intención de ejecutar binarios del agente en una máquina macOS que ya tiene estas bibliotecas, puede utilizar las bibliotecas precompiladas que proporciona Homebrew. Estas suelen ser máquinas macOS que utilizan Homebrew para compilar binarios del agente Zabbix o para otros fines.
Si los binarios del agente se van a utilizar en máquinas macOS que no tienen la versión compartida de las bibliotecas, debe compilar bibliotecas estáticas desde el código fuente y vincular el agente Zabbix con ellas.
Instale PCRE2 (reemplace pcre2 por pcre en los comandos a continuación, si es necesario):
Al compilar con TLS, instale OpenSSL y/o GnuTLS:
Descargue el código fuente de Zabbix:
Compile el agente sin TLS:
cd zabbix ./bootstrap.sh ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 make make installCompile el agente con OpenSSL:
cd zabbix ./bootstrap.sh ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-openssl=/usr/local/opt/openssl make make installCompile el agente con GnuTLS:
cd zabbix-source/ ./bootstrap.sh ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-gnutls=/usr/local/opt/gnutls make make installSupongamos que las bibliotecas estáticas de PCRE se instalarán en $HOME/static-libs. Usaremos PCRE2 10.39.
Descargue y compile PCRE con soporte para propiedades Unicode:
mkdir static-libs-source cd static-libs-source curl --remote-name https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.gz tar xf pcre2-10.39.tar.gz cd pcre2-10.39 ./configure --prefix="$PCRE_PREFIX" --disable-shared --enable-static --enable-unicode-properties make make check make installDescargue el código fuente de Zabbix y compile el agente:
git clone https://git.zabbix.com/scm/zbx/zabbix.git cd zabbix ./bootstrap.sh ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-libpcre2="$PCRE_PREFIX" make make installAl compilar OpenSSL, se recomienda ejecutar make test después de una compilación exitosa. Incluso si la compilación fue exitosa, a veces las pruebas fallan. Si este es el caso, se deben investigar y resolver los problemas antes de continuar.
Supongamos que las bibliotecas estáticas de PCRE y OpenSSL se instalarán en $HOME/static-libs. Usaremos PCRE2 10.39 y OpenSSL 1.1.1a.
Compilaremos las bibliotecas estáticas en static-libs-source:
Descargue y compile PCRE con soporte para propiedades Unicode:
curl --remote-name https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.gz tar xf pcre2-10.39.tar.gz cd pcre2-10.39 ./configure --prefix="$PCRE_PREFIX" --disable-shared --enable-static --enable-unicode-properties make make check make install cd ..Descargue y compile OpenSSL:
curl --remote-name https://www.openssl.org/source/openssl-1.1.1a.tar.gz tar xf openssl-1.1.1a.tar.gz cd openssl-1.1.1a ./Configure --prefix="$OPENSSL_PREFIX" --openssldir="$OPENSSL_PREFIX" --api=1.1.0 no-shared no-capieng no-srp no-gost no-dgram no-dtls1-method no-dtls1_2-method darwin64-x86_64-cc make make test make install_sw cd ..Descargue el código fuente de Zabbix y compile el agente:
git clone https://git.zabbix.com/scm/zbx/zabbix.git cd zabbix ./bootstrap.sh ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-libpcre2="$PCRE_PREFIX" --with-openssl="$OPENSSL_PREFIX" make make installGnuTLS depende del backend criptográfico Nettle y de la biblioteca aritmética GMP. En lugar de usar la biblioteca GMP completa, esta guía usará mini-gmp que está incluida en Nettle.
Al compilar GnuTLS y Nettle, se recomienda ejecutar make check después de una compilación exitosa. Incluso si la compilación fue exitosa, las pruebas a veces fallan. Si este es el caso, se deben investigar y resolver los problemas antes de continuar.
Supongamos que las bibliotecas estáticas de PCRE, Nettle y GnuTLS se instalarán en $HOME/static-libs. Usaremos PCRE2 10.39, Nettle 3.4.1 y GnuTLS 3.6.5.
PCRE_PREFIX="$HOME/static-libs/pcre2-10.39" NETTLE_PREFIX="$HOME/static-libs/nettle-3.4.1" GNUTLS_PREFIX="$HOME/static-libs/gnutls-3.6.5"Compilaremos las bibliotecas estáticas en static-libs-source:
Descargar y compilar Nettle:
curl --remote-name https://ftp.gnu.org/gnu/nettle/nettle-3.4.1.tar.gz tar xf nettle-3.4.1.tar.gz cd nettle-3.4.1 ./configure --prefix="$NETTLE_PREFIX" --enable-static --disable-shared --disable-documentation --disable-assembler --enable-x86-aesni --enable-mini-gmp make make check make install cd ..Descargar y compilar GnuTLS:
curl --remote-name https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.5.tar.xz tar xf gnutls-3.6.5.tar.xz cd gnutls-3.6.5 PKG_CONFIG_PATH="$NETTLE_PREFIX/lib/pkgconfig" ./configure --prefix="$GNUTLS_PREFIX" --enable-static --disable-shared --disable-guile --disable-doc --disable-tools --disable-libdane --without-idn --without-p11-kit --without-tpm --with-included-libtasn1 --with-included-unistring --with-nettle-mini make make check make install cd ..Descargar el código fuente de Zabbix y compilar el agente:
git clone https://git.zabbix.com/scm/zbx/zabbix.git cd zabbix ./bootstrap.sh CFLAGS="-Wno-unused-command-line-argument -framework Foundation -framework Security" \ > LIBS="-lgnutls -lhogweed -lnettle" \ > LDFLAGS="-L$GNUTLS_PREFIX/lib -L$NETTLE_PREFIX/lib" \ > ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-libpcre2="$PCRE_PREFIX" --with-gnutls="$GNUTLS_PREFIX" make make install