En el momento de escribir el artículo la versión de mod_jk es 1.2.48. Compilarlo es sencillo. Necesitaremos la utilidad apxs de Apache para compilar el conector. Si no la tenemos instalada, procedemos a hacerlo según nuestra distro:
# RHEL & derivadas yum install httpd-devel # Debian & derivadas apt install apache2-dev
Lo primero es descargar el código fuente de la web oficial
wget https://dlcdn.apache.org/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.48-src.tar.gz
Descomprimimos y nos situamos en el directorio native:
tar -zxvf tomcat-connectors-1.2.48-src.tar.gz cd tomcat-connectors-1.2.48-src/native
Procedemos a lanzar la configuración para compilar:
[root@jotadev native]# ./configure --with-apxs=/usr/bin/apxs checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking for a BSD-compatible install... /bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p ... checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating apache-2.0/Makefile config.status: creating apache-2.0/Makefile.apxs config.status: creating common/Makefile config.status: creating common/list.mk config.status: creating common/jk_types.h config.status: creating common/config.h config.status: executing depfiles commands config.status: executing libtool commands
Si todo termina bien, lanzamos make
para construir el binario:
[root@jotadev native]# make ... for i in $list; do \ echo "Making $target in $i"; \ if test "$i" != "."; then \ (cd $i && make $target) || exit 1; \ fi; \ done; Making all in common make[1]: Entering directory `/root/tomcat-connectors-1.2.48-src/native/common' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/root/tomcat-connectors-1.2.48-src/native/common' Making all in apache-2.0 make[1]: Entering directory `/root/tomcat-connectors-1.2.48-src/native/apache-2.0' ../scripts/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool --silent' mod_jk.la `pwd` /usr/lib64/apr-1/build/libtool --silent --mode=install cp mod_jk.la /root/tomcat-connectors-1.2.48-src/native/apache-2.0/ libtool: install: warning: remember to run `libtool --finish /usr/lib64/httpd/modules' make[1]: Leaving directory `/root/tomcat-connectors-1.2.48-src/native/apache-2.0'
Una vez finalizado podemos ver los binarios en el directorio apache-2.0:
[root@jotadev native]# ls -l apache-2.0/ total 4992 -rw-r--r-- 1 root bin 10350 Feb 20 2020 bldjk54.qclsrc -rw-r--r-- 1 root bin 9541 Feb 20 2020 bldjk.qclsrc -rw-r--r-- 1 root bin 1335 Feb 20 2020 config.m4 -rw-r--r-- 1 root root 3328 Jan 15 19:45 Makefile -rw-r--r-- 1 root root 1622 Jan 15 19:45 Makefile.apxs -rw-r--r-- 1 root bin 1434 Feb 20 2020 Makefile.apxs.in -rw-r--r-- 1 root bin 3068 Feb 20 2020 Makefile.in -rw-r--r-- 1 root bin 6947 Feb 20 2020 Makefile.vc -rw-r--r-- 1 root root 2945546 Jan 15 19:46 mod_jk.a -rw-r--r-- 1 root bin 146861 Feb 20 2020 mod_jk.c -rw-r--r-- 1 root root 920 Jan 15 19:46 mod_jk.la -rw-r--r-- 1 root root 270 Jan 15 19:46 mod_jk.lo -rw-r--r-- 1 root root 384176 Jan 15 19:46 mod_jk.o -rwxr-xr-x 1 root root 1565864 Jan 15 19:46 mod_jk.so
Dependiendo de la distro en la que estemos, tendremos que copiar el binario al directorio que corresponda:
# RHEL & derivadas cp mod_jk.so /usr/lib64/httpd/modules/ # Debian & derivadas cp mod_jk.so /usr/lib/apache2/
Finalmente, cargarlo en nuestra configuración en el fichero correspondiente con la directiva LoadModule, ej.:
LoadModule jk_module modules/mod_jk.so