Building Zabbix server - linux-on-ibm-z/docs GitHub Wiki

Building Zabbix server

Below versions of Zabbix server are available in respective distributions at the time of creation of these build instructions:

  • RHEL (8.10, 9.6, 9.7, 10.0, 10.1) have 7.0.25
  • SLES 15 SP7 has 6.0.33
  • Ubuntu 22.04 has 5.0.17

The instructions provided below specify the steps to build Zabbix server version 7.0.25 on Linux on IBM Z for following distributions:

  • SLES 15 SP7
  • Ubuntu (22.04, 24.04)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.

  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

1. Build using script

If you want to build Zabbix server using manual steps, go to STEP 2.

Use the following commands to build Zabbix server using the build script. Please make sure you have wget installed.

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Zabbix/7.0.25/build_zabbixserver.sh

# Build Zabbix server
bash build_zabbixserver.sh

2. Install dependencies

export SOURCE_ROOT=/<source_root>/
cd $SOURCE_ROOT

2.1. Install Basic Dependencies

  • SLES 15 SP7

    sudo zypper install -y wget tar curl vim gcc make net-snmp net-snmp-devel net-tools git apache2 apache2-devel mariadb \
        libmariadbd-devel apache2-mod_php8 php8 php8-mysql php8-xmlreader php8-xmlwriter php8-gd php8-bcmath php8-mbstring \
        php8-ctype php8-sockets php8-gettext libcurl-devel libxml2-2 libxml2-devel openldap2-devel php8-ldap unixODBC-devel \ 
        libevent-devel pcre-devel pcre2-devel awk gzip automake cmake libyaml-devel perl-YAML-LibYAML perl-Path-Tiny perl-IPC-Run3 \
        glibc-locale
    export LC_CTYPE="en_US.UTF-8"
    
  • Ubuntu 22.04

    sudo apt-get update
    sudo apt-get -y install wget curl vim gcc make pkg-config snmp snmptrapd ceph locales libmariadbd-dev libxml2-dev \
        libsnmp-dev libcurl4 libcurl4-openssl-dev git apache2 php php-mysql libapache2-mod-php mysql-server php8.1-xml php8.1-gd \
        php-bcmath php-mbstring php8.1-ldap libevent-dev libpcre3-dev libpcre2-dev automake pkg-config libcmocka-dev unixodbc-dev \
        libyaml-dev libyaml-libyaml-perl libpath-tiny-perl libipc-run3-perl build-essential
    
  • Ubuntu 24.04

    sudo apt-get update
    sudo apt-get -y install wget curl vim gcc make pkg-config snmp snmptrapd ceph locales libmariadbd-dev libxml2-dev libsnmp-dev \
        libcurl4 libcurl4-openssl-dev git apache2 php php-mysql libapache2-mod-php mysql-server php8.3-xml php8.3-gd php-bcmath \
        php-mbstring php8.3-ldap libevent-dev libpcre3-dev libpcre2-dev automake pkg-config libcmocka-dev unixodbc-dev \
        libyaml-dev libyaml-libyaml-perl libpath-tiny-perl libipc-run3-perl build-essential
    

2.2. Set locale (Ubuntu Only)

sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure -f noninteractive locales  
export LANG='en_US.UTF-8'
export LANGUAGE='en_US.UTF-8'

2.3. Build and install cmocka (SLES 15.x)

cd "$SOURCE_ROOT"
git clone -b cmocka-1.1.7 https://gitlab.com/cmocka/cmocka.git
cd cmocka
mkdir -p build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
sudo make install

3. Download and install Zabbix server

  • Create a zabbix user required to start Zabbix server daemon

    • SLES

      sudo groupadd --system zabbix
      sudo useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix
      
    • Ubuntu

      sudo addgroup --system --quiet zabbix
      sudo adduser --quiet --system --disabled-login --ingroup zabbix --home /var/lib/zabbix --no-create-home zabbix
      
  • Download Zabbix server

    cd $SOURCE_ROOT
    git clone -b 7.0.25 --depth 1 https://github.com/zabbix/zabbix.git
    cd zabbix
    export CFLAGS="-std=gnu99"
    ./bootstrap.sh tests
    
  • Build and install Zabbix server

    cd $SOURCE_ROOT/zabbix
    ./configure --enable-server --enable-agent --enable-proxy --with-mysql --with-unixodbc --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-libpcre2
    make -j$(nproc)
    make dbschema -j$(nproc)
    sudo make install
    
  • Run Tests (optional)

    cd $SOURCE_ROOT/zabbix
    make tests
    

Note: Following Test Case zbx_mock_test_entry for macro_functions might fail since these tests are written for Europe/Riga time zone. Run the following command to make the test case pass - TZ=Europe/Riga tests/tests_run.pl --suite macro_functions.

4.Start Zabbix server (Optional)

Follow the official guide given here to verify the installation.

References: