Zabbix Documentation 4.0

3.04.04.45.0 (current)| In development:5.2 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


manual:installation:install:win_agent

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Previous revision
manual:installation:install:win_agent [2018/11/20 09:38]
manual:installation:install:win_agent [2019/04/08 08:51] (current)
martins-v adding 'libressl' support
Line 1: Line 1:
 +==== Building Windows agent binaries with/​without TLS ====
  
 +=== Overview ===
 +
 +This section demonstrates how to build Windows agent binaries from sources with or without TLS.
 +
 +=== Compiling OpenSSL ===
 +
 +The following steps will help you to compile OpenSSL from sources on MS Windows 10 (64-bit).
 +
 +  - For compiling OpenSSL you will need on Windows machine:
 +    - C compiler (e.g. VS 2017 RC),
 +    - NASM (https://​www.nasm.us/​),​
 +    - Perl (e.g. Strawberry Perl from http://​strawberryperl.com/​),​
 +    - Perl module Text::​Template (cpan Text::​Template).
 +  - Get OpenSSL sources from https://​www.openssl.org/​. OpenSSL 1.1.1 is used here.
 +  - Unpack OpenSSL sources, for example, in E:​\openssl-1.1.1.
 +  - Open a commandline window e.g. the x64 Native Tools Command Prompt for VS 2017 RC.
 +  - Go to the OpenSSL source directory, e.g. E:​\openssl-1.1.1.
 +    - Verify that NASM can be found:<​code>​
 +e:​\openssl-1.1.1>​ nasm --version
 +NASM version 2.13.01 compiled on May  1 2017
 +</​code>​
 +  - Configure OpenSSL, for example:<​code>​
 +e:​\openssl-1.1.1>​ perl E:​\openssl-1.1.1\Configure VC-WIN64A no-shared no-capieng no-srp no-gost no-dgram no-dtls1-method no-dtls1_2-method ​ --api=1.1.0 --prefix=C:​\OpenSSL-Win64-111-static --openssldir=C:​\OpenSSL-Win64-111-static
 +</​code>​
 +    * Note the option '​no-shared':​ if '​no-shared'​ is used then the OpenSSL static libraries libcrypto.lib and libssl.lib will be '​self-sufficient'​ and resulting Zabbix binaries will include OpenSSL in themselves, no need for external OpenSSL DLLs. Advantage: Zabbix binaries can be copied to other Windows machines without OpenSSL libraries. Disadvantage:​ when a new OpenSSL bugfix version is released, Zabbix agent needs to recompiled and reinstalled.
 +    * If '​no-shared'​ is not used, then the static libraries libcrypto.lib and libssl.lib will be using OpenSSL DLLs at runtime. Advantage: when a new OpenSSL bugfix version is released, probably you can upgrade only OpenSSL DLLs, without recompiling Zabbix agent. Disadvantage:​ copying Zabbix agent to another machine requires copying OpenSSL DLLs, too.
 +  - Compile OpenSSL, run tests, install:<​code>​
 +e:​\openssl-1.1.1>​ nmake
 +e:​\openssl-1.1.1>​ nmake test
 +...
 +All tests successful.
 +Files=152, Tests=1152, 501 wallclock secs ( 0.67 usr +  0.61 sys =  1.28 CPU)
 +Result: PASS
 +e:​\openssl-1.1.1>​ nmake install_sw
 +</​code>'​install_sw'​ installs only software components (i.e. libraries, header files, but no documentation). If you want everything, use %%"​%%nmake install%%"​%%.
 +
 +=== Compiling PCRE ===
 +
 +  - Download PCRE library (new mandatory library for Zabbix 4.0) from pcre.org, version 8.XX; not pcre2 (ftp://​ftp.csx.cam.ac.uk/​pub/​software/​programming/​pcre/​pcre-8.41.zip)
 +  - Extract to directory //​E:​\pcre-8.41//​
 +  - Install CMake from https://​cmake.org/​download/,​ during install select: and ensure that cmake\bin is on your path (tested version 3.9.4).
 +  - Create a new, empty build directory, preferably a subdirectory of the source dir. For example, //​E:​\pcre-8.41\build//​.
 +  - Open a commandline window e.g. the x64 Native Tools Command Prompt for VS 2017 and from that shell environment run cmake-gui. Do not try to start Cmake from the Windows Start menu, as this can lead to errors.
 +  - Enter //​E:​\pcre-8.41//​ and //​E:​\pcre-8.41\build//​ for the source and build directories,​ respectively.
 +  - Hit the %%"​%%Configure%%"​%% button.
 +  - When specifying the generator for this project select %%"​%%NMake Makefiles%%"​%%.
 +  - Create a new, empty install directory. For example, //​E:​\pcre-8.41-install//​.
 +  - The GUI will then list several configuration options. Make sure the following options are selected:
 +    * **PCRE_SUPPORT_UNICODE_PROPERTIES** ON
 +    * **PCRE_SUPPORT_UTF** ON
 +    * **CMAKE_INSTALL_PREFIX** ​               //​E:​\pcre-8.41-install//​
 +  - Hit %%"​%%Configure%%"​%% again. The adjacent %%"​%%Generate%%"​%% button should now be active.
 +  - Hit %%"​%%Generate%%"​%%.
 +  - In the event that errors do occur, it is recommended that you delete the CMake cache before attempting to repeat the CMake build process. In the CMake GUI, the cache can be deleted by selecting %%"​%%File > Delete Cache%%"​%%.
 +  - The build directory should now contain a usable build system - //​Makefile//​.
 +  - Open a commandline window e.g. the x64 Native Tools Command Prompt for VS 2017 and navigate to the //​Makefile//​ mentioned above.
 +  - Run NMake command: <​code>​
 +E:​\pcre-8.41\build>​ nmake install
 +</​code>​
 +
 +
 +
 +=== Compiling Zabbix ===
 +
 +The following steps will help you to compile Zabbix from sources on MS Windows 10 (64-bit). When compiling Zabbix with/​without TLS support the only significant difference is in step 4.
 +
 +Support for OpenSSL 1.1.1 was added in 4.0.1, some additional fixes - in 4.0.2rc1.
 +
 +  - On a Linux machine check out the source from SVN:<​code>​
 +$ svn co svn://​svn.zabbix.com/​tags/​4.0.2
 +$ cd 4.0.2/
 +$ ./​bootstrap.sh
 +$ ./configure --enable-agent --enable-ipv6 --prefix=`pwd`
 +$ make dbschema
 +$ make dist
 +</​code>​
 +  - Copy and unpack the archive, e.g. zabbix-4.0.2.tar.gz,​ on a Windows machine.
 +  - Let's assume that sources are in e:​\zabbix-4.0.2. Open a commandline window e.g. the x64 Native Tools Command Prompt for VS 2017 RC. Go to E:​\zabbix-4.0.2\build\win32\project.
 +  - Compile zabbix_get, zabbix_sender and zabbix_agent.
 +    * without TLS: <​code>​
 +E:​\zabbix-4.0.2\build\win32\project>​ nmake /K PCREINCDIR=E:​\pcre-8.41-install\include PCRELIBDIR=E:​\pcre-8.41-install\lib
 +</​code>​
 +    * with TLS: <​code>​
 +E:​\zabbix-4.0.2\build\win32\project>​ nmake /K -f Makefile_get TLS=openssl TLSINCDIR=C:​\OpenSSL-Win64-111-static\include TLSLIBDIR=C:​\OpenSSL-Win64-111-static\lib PCREINCDIR=E:​\pcre-8.41-install\include PCRELIBDIR=E:​\pcre-8.41-install\lib
 +E:​\zabbix-4.0.2\build\win32\project>​ nmake /K -f Makefile_sender TLS=openssl TLSINCDIR="​C:​\OpenSSL-Win64-111-static\include TLSLIBDIR="​C:​\OpenSSL-Win64-111-static\lib"​ PCREINCDIR=E:​\pcre-8.41-install\include PCRELIBDIR=E:​\pcre-8.41-install\lib
 +E:​\zabbix-4.0.2\build\win32\project>​ nmake /K -f Makefile_agent TLS=openssl TLSINCDIR=C:​\OpenSSL-Win64-111-static\include TLSLIBDIR=C:​\OpenSSL-Win64-111-static\lib PCREINCDIR=E:​\pcre-8.41-install\include PCRELIBDIR=E:​\pcre-8.41-install\lib
 +</​code>​
 +  - New binaries are located in e:​\zabbix-4.0.2\bin\win64. Since OpenSSL was compiled with '​no-shared'​ option, Zabbix binaries contain OpenSSL within themselves and can be copied to other machines that do not have OpenSSL.
 +
 +=== Compiling Zabbix with LibreSSL ===
 +
 +The process is similar to compiling with OpenSSL, but you need to make small changes in files located in the ''​build\win32\project''​ directory:
 +    * In ''​Makefile_tls''​ delete ''/​DHAVE_OPENSSL_WITH_PSK''​. i.e. find <​code>​
 +CFLAGS = $(CFLAGS) /​DHAVE_OPENSSL /​DHAVE_OPENSSL_WITH_PSK</​code>​and replace it with <​code>​
 +CFLAGS = $(CFLAGS) /​DHAVE_OPENSSL</​code>​
 +    * In ''​Makefile_common.inc''​ add ''/​NODEFAULTLIB:​LIBCMT''​ i.e. find <​code>​
 +/​MANIFESTUAC:"​level='​asInvoker'​ uiAccess='​false'"​ /​DYNAMICBASE:​NO /​PDB:​$(TARGETDIR)\$(TARGETNAME).pdb</​code>​and replace it with <​code>​
 +/​MANIFESTUAC:"​level='​asInvoker'​ uiAccess='​false'"​ /​DYNAMICBASE:​NO /​PDB:​$(TARGETDIR)\$(TARGETNAME).pdb /​NODEFAULTLIB:​LIBCMT</​code>​