Esta secci¨®n muestra como compilar los binarios del Áú»¢¶Ä²© macOS agent desde el c¨®digo fuente con o sin TLS.
Necesitar¨¢ herramientas de desarrollo de l¨ªnea de comandos (no se requiere Xcode), Automake, pkg-config y PCRE (v8.x) o PCRE2 (v10.x). Si quiere construir un agente binario con TLS, tambi¨¦n necesitar¨¢ OpenSSL o GnuTLS.
Para instalar Automake y pkg-config, necesitar¨¢ un administrador de paquetes Homebrew . 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 van a estar vinculadas al agente.
Si tiene intenci¨®n de ejecutar archivos binarios del agente en una m¨¢quina macOS que ya tiene estas bibliotecas, puede utilizar bibliotecas precompiladas proporcionadas por Homebrew. Suelen ser m¨¢quinas macOS que utilizan Homebrew para construir binarios del agente Áú»¢¶Ä²© o para otros fines.
Si los binarios del agente se utilizar¨¢n en m¨¢quinas macOS que no tienen la versi¨®n compartida de bibliotecas, debe compilar las bibliotecas est¨¢ticas desde las fuentes y vincular al agente Áú»¢¶Ä²© con ellas.
Instale PCRE2 (en caso de ser necesario, reemplace pcre2 con pcre en los siguientes comandos):
Cuando se compila con TLS, instale OpenSSL y/o GnuTLS:
Descargue el c¨®digo fuente de Áú»¢¶Ä²©:
Compilar el agente sin TLS:
cd zabbix
./bootstrap.sh
./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6
make
make install
Compilar 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 install
Compilar 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 install
Supongamos que las bibliotecas est¨¢ticas PCRE se instalaron en $HOME/static-libs
. Usaremos PCRE2 10.39.
Descargue y cree PCRE con soporte de 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 install
Descargue el c¨®digo fuente de Áú»¢¶Ä²© y el agente de compilaci¨®n:
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 install
Al compilar OpenSSL, se recomienda ejecutar "make test" despu¨¦s de la construcci¨®n exitosa. Incluso si la construcci¨®n fue exitosa, a veces las pruebas pueden fallar. Si este es el caso, los problemas deben investigarse y resolverse antes de continuar.
Supongamos que las bibliotecas est¨¢ticas PCRE y OpenSSL se instalaron en $HOME/static-libs`. Usaremos PCRE2 10.39 y OpenSSL 1.1.1a.
Construimos bibliotecas est¨¢ticas en static-libs-source
:
Descargue y cree PCRE con soporte de 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 cree 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 Áú»¢¶Ä²© y el agente de compilaci¨®n:
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 install
GnuTLS depende del backend criptogr¨¢fico Nettle y de la biblioteca aritm¨¦tica GMP. En lugar de utilizar la biblioteca GMP completa, esta gu¨ªa utilizar¨¢ mini-gmp, que est¨¢ incluido en Nettle.
Al compilar GnuTLS y Nettle, se recomienda ejecutar "make check" despu¨¦s de una construcci¨®n exitosa. Incluso si la construcci¨®n fue exitosa, las pruebas fallan a veces. Si este es el caso, los problemas deben ser investigados y resueltos antes de continuar.
Supongamos que las bibliotecas est¨¢ticas PCRE, Nettle y GnuTLS ser¨¢n instaladas 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"
Construimos las bibliotecas est¨¢ticas en static-libs-source
:
Descargue y cree 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 ..
Descargue y cree 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 ..
Descargue el c¨®digo fuente de Áú»¢¶Ä²© y cree 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