-
Notifications
You must be signed in to change notification settings - Fork 56
Building Zabbix server
Below versions of Zabbix server are available in respective distributions at the time of creation of these build instructions:
- RHEL (8.8, 8.10, 9.2, 9.4) have
7.0.4
- SLES 15 SP5 has
4.0.50
- SLES 15 SP6 has
6.0.28
- Ubuntu 20.04 has
4.0.17
- Ubuntu 22.04 has
5.0.17
The instructions provided below specify the steps to build Zabbix server version 7.0.5 on Linux on IBM Z for following distributions:
- RHEL (8.8, 8.10, 9.2, 9.4)
- SLES (15 SP5, 15 SP6)
- Ubuntu (20.04, 22.04, 24.04)
-
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.
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.5/build_zabbixserver.sh
# Build Zabbix server
bash build_zabbixserver.sh
If the build completes successfully, go to STEP 7. In case of error, check logs
for more details or go to STEP 2 to follow manual build steps.
export SOURCE_ROOT=/<source_root>/
cd $SOURCE_ROOT
-
RHEL (8.8, 8.10)
sudo subscription-manager repos --enable=codeready-builder-for-rhel-8-s390x-rpms cat > MariaDB.repo <<'EOF' # MariaDB 10.11 RedHatEnterpriseLinux repository list - created 2023-07-14 14:59 UTC # https://mariadb.org/download/ [mariadb] name = MariaDB # rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details. # baseurl = https://rpm.mariadb.org/10.11/rhel/$releasever/$basearch baseurl = https://mirror.its.dal.ca/mariadb/yum/10.11/rhel/$releasever/$basearch module_hotfixes = 1 # gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB gpgkey = https://mirror.its.dal.ca/mariadb/yum/RPM-GPG-KEY-MariaDB gpgcheck = 1 EOF sudo mv MariaDB.repo /etc/yum.repos.d/ sudo yum install -y autoconf libtool cmake openssl-devel libcurl libcurl-devel libxml2 libxml2-devel readline \ libzip-devel libzip nginx openssl pkgconf zlib-devel bzip2 sqlite-libs sqlite-devel oniguruma oniguruma-devel libpq-devel \ gcc-toolset-10-gcc gcc-toolset-10-gcc-c++ binutils initscripts httpd tar wget curl vim pcre \ pcre-devel pcre2-devel make net-snmp net-snmp-devel httpd-devel git libxml2-devel libjpeg-devel libpng-devel freetype \ freetype-devel openldap openldap-devel libevent-devel libyaml-devel perl-IPC-Run3 bzip2-devel curl-devel enchant-devel \ gmp-devel krb5-devel postgresql-devel aspell-devel cyrus-sasl-devel libXpm-devel libxslt-devel recode-devel readline-devel \ gdbm-devel php-fpm libdb-devel automake patch pkgconfig perl-YAML-LibYAML perl-Path-Tiny ncurses-devel boost-devel check-devel \ perl-Test-Simple perl-Time-HiRes pam-devel hostname unixODBC-devel bison aspell MariaDB-server MariaDB-client mysql-devel
sudo yum groupinstall -y 'Development Tools' ```
-
RHEL (9.2, 9.4)
sudo dnf install -y initscripts httpd tar wget curl vim gcc make net-snmp net-snmp-devel php-mysqlnd mysql-libs git \ php libcurl-devel libxml2-devel php-xml php-gd php-bcmath php-mbstring php-ldap php-json libevent-devel unixODBC-devel \ pcre-devel pcre2-devel policycoreutils-python-utils automake pkgconfig libcmocka-devel libyaml-devel perl-YAML-LibYAML \ libpath_utils-devel perl-IPC-Run3 perl-Path-Tiny mariadb mariadb-server mysql-devel perl-Time-HiRes sudo yum groupinstall -y 'Development Tools'
-
SLES (15 SP5, 15 SP6)
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 20.04
sudo apt-get update sudo apt-get -y install wget curl perl vim make pkg-config snmp snmptrapd ceph locales libmariadbd-dev libxml2-dev \ libsnmp-dev libcurl4 libcurl4-openssl-dev git apache2 apache2-dev mysql-server libevent-dev libpcre3-dev \ libpcre2-dev automake pkg-config libcmocka-dev libyaml-dev libyaml-libyaml-perl libpng-dev libpath-tiny-perl \ libipc-run3-perl build-essential locales language-pack-de autoconf libtool libssl-dev libjpeg-dev libxpm-dev \ libreadline8 libreadline-dev libzip-dev libxslt1-dev nginx openssl zlib1g-dev libfreetype6-dev \ libsqlite3-dev libonig-dev libpq-dev unixodbc-dev gcc-10 g++-10 tar bzip2 #switch to GCC 10 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-10 40 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 40 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 40 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-10 40 export PATH=${PREFIX}/bin${PATH:+:${PATH}}
-
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
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'
cd "$SOURCE_ROOT"
git clone -b cmocka-1.1.5 https://gitlab.com/cmocka/cmocka.git
cd cmocka
mkdir -p build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
sudo make install
cd "$SOURCE_ROOT"
PHP_VERSION="8.3.9"
PHP_URL="https://www.php.net/distributions/php-${PHP_VERSION}.tar.gz"
wget -qO- $PHP_URL | tar xzf -
cd "$SOURCE_ROOT/php-${PACKAGE_VERSION}"
./configure --prefix=${PREFIX} --enable-zts \
--without-pcre-jit --without-pear \
--with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd \
--with-readline --with-gettext \
--with-apxs2=/usr/bin/apxs \
--enable-gd --with-jpeg \
--with-freetype --with-xpm --with-openssl \
--with-xsl --with-gmp --with-zip \
--with-mhash --enable-intl \
--enable-fpm --enable-exif --enable-xmlreader \
--enable-sockets --enable-ctype --enable-sysvsem \
--enable-sysvshm --enable-sysvmsg \
--enable-shmop --enable-pcntl --enable-mbstring \
--enable-soap --enable-bcmath --enable-calendar \
--enable-ftp --enable-zend-test=shared \
--with-curl=/usr --with-zlib --with-zlib-dir=/usr/local
make -j$(nproc)
sudo make install
sudo install -m644 php.ini-production ${PREFIX}/lib/php.ini
sudo sed -i "s@php/includes\"@&\ninclude_path = \".:/usr/local/lib/php\"@" /usr/local/lib/php.ini
sudo sed -i "s/;mysqli.allow_local_infile = On/mysqli.allow_local_infile = On/" /usr/local/lib/php.ini
sudo sed -i "s/;opcache.enable=1/opcache.enable=1/" /usr/local/lib/php.ini
sudo sed -i "s/;opcache.enable_cli=0/opcache.enable_cli=1/" /usr/local/lib/php.ini
sudo sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /usr/local/lib/php.ini
sudo sed -i 's/max_input_time = 60/max_input_time = 300/g' /usr/local/lib/php.ini
sudo sed -i 's/post_max_size = 8M/post_max_size = 16M/g' /usr/local/lib/php.ini
sudo sed -i 's/;date.timezone =/date.timezone = Asia\/Kolkata/g' /usr/local/lib/php.ini
-
RHEL
-
/etc/httpd/conf/httpd.conf
cd /etc/httpd/conf/ sudo chmod 766 httpd.conf cat <<EOF >> httpd.conf ServerName localhost AddType application/x-httpd-php .php <Directory /> DirectoryIndex index.php </Directory> EOF sudo chmod 644 httpd.conf
-
-
SLES
-
/etc/apache2/httpd.conf
cd /etc/apache2/ sudo chmod 766 httpd.conf cat <<EOF >> httpd.conf ServerName localhost AddType application/x-httpd-php .php <Directory /> DirectoryIndex index.php </Directory> LoadModule php_module /usr/lib64/apache2/mod_php8.so EOF sudo chmod 644 httpd.conf
-
-
Ubuntu
-
/etc/apache2/apache2.conf
cd /etc/apache2/ sudo chmod 766 apache2.conf cat <<EOF >> apache2.conf ServerName localhost AddType application/x-httpd-php .php <Directory /> DirectoryIndex index.php </Directory> EOF sudo chmod 644 apache2.conf
-
-
Create a
zabbix
user required to start Zabbix server daemon-
RHEL, 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.5 --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
.
-
Install Zabbix web interface
-
RHEL
cd $SOURCE_ROOT/zabbix/ui/ sudo mkdir -p /var/www/html/zabbix sudo cp -rf * /var/www/html/zabbix/ sudo chown -R apache:apache /var/www/html/zabbix/conf
-
SLES
cd $SOURCE_ROOT/zabbix/ui/ sudo mkdir -p /srv/www/htdocs/zabbix sudo cp -rf * /srv/www/htdocs/zabbix sudo chown -R wwwrun:www /srv/www/htdocs/zabbix/conf
-
Ubuntu
cd $SOURCE_ROOT/zabbix/ui/ sudo mkdir -p /var/www/html/zabbix sudo cp -rf * /var/www/html/zabbix/ sudo chown -R www-data:www-data /var/www/html/zabbix/conf
-
-
Start
httpd
andmysql or mariadb
servers-
RHEL
sudo service httpd start sudo service mariadb start # (RHEL 8.x, 9.x)
-
SLES
sudo service apache2 restart sudo service mariadb restart # (SLES 15 SP5, SLES 15 SP6)
-
Ubuntu
sudo service apache2 start sudo service mysql stop sudo usermod -d /var/lib/mysql/ mysql sudo service mysql start
-
-
Create database and grant privileges to
zabbix
user-
RHEL (8.x, 9.x), SLES, Ubuntu (22.04, 24.04)
sudo mysql -e "create user 'zabbix'@'localhost'" sudo mysql -e "create database zabbix character set utf8 collate utf8_bin" sudo mysql -e "grant all privileges on zabbix.* to 'zabbix'@'localhost'"
-
Ubuntu 20.04
sudo mysql -e "create user 'zabbix'@'localhost' identified with mysql_native_password" sudo mysql -e "create database zabbix character set utf8 collate utf8_bin" sudo mysql -e "grant all privileges on zabbix.* to 'zabbix'@'localhost'"
-
-
Populate database with initial load
cd $SOURCE_ROOT/zabbix/database/mysql sudo mysql -e "SET GLOBAL log_bin_trust_function_creators = 1" # (Ubuntu) sudo mysql -uzabbix zabbix < schema.sql sudo mysql -uzabbix zabbix < images.sql sudo mysql -uzabbix zabbix < data.sql
-
RHEL (9.x)
-
/etc/php.ini
sudo sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php.ini sudo sed -i 's/max_input_time = 60/max_input_time = 300/g' /etc/php.ini sudo sed -i 's/post_max_size = 8M/post_max_size = 16M/g' /etc/php.ini sudo sed -i 's/;date.timezone =/date.timezone = Asia\/Kolkata/g' /etc/php.ini
-
-
SLES (15 SP5, 15 SP6)
-
/etc/php8/apache2/php.ini
sudo sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php8/apache2/php.ini sudo sed -i 's/max_input_time = 60/max_input_time = 300/g' /etc/php8/apache2/php.ini sudo sed -i 's/post_max_size = 8M/post_max_size = 16M/g' /etc/php8/apache2/php.ini
-
-
Ubuntu 22.04
-
/etc/php/8.1/apache2/php.ini
sudo sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php/8.1/apache2/php.ini sudo sed -i 's/max_input_time = 60/max_input_time = 300/g' /etc/php/8.1/apache2/php.ini sudo sed -i 's/post_max_size = 8M/post_max_size = 16M/g' /etc/php/8.1/apache2/php.ini sudo sed -i 's/;date.timezone =/date.timezone = Asia\/Kolkata/g' /etc/php/8.1/apache2/php.ini
-
-
Ubuntu 24.04
-
/etc/php/8.3/apache2/php.ini
sudo sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php/8.3/apache2/php.ini sudo sed -i 's/max_input_time = 60/max_input_time = 300/g' /etc/php/8.3/apache2/php.ini sudo sed -i 's/post_max_size = 8M/post_max_size = 16M/g' /etc/php/8.3/apache2/php.ini sudo sed -i 's/;date.timezone =/date.timezone = Asia\/Kolkata/g' /etc/php/8.3/apache2/php.ini
-
-
Please edit
/usr/local/etc/zabbix_server.conf
and add the appropriate location depending on where the mysql or mariadb installation creates the socket.DBSocket=/<mysql_sock_location>/ # (e.g. DBSocket=/tmp/mysql.sock)
-
Restart http service and start Zabbix server
-
RHEL
sudo service httpd restart sudo service php-fpm restart zabbix_server
-
SLES
sudo service apache2 restart PATH=$PATH:/usr/local/sbin/ zabbix_server
-
Ubuntu
sudo service apache2 restart zabbix_server
-
-
After starting Zabbix server, direct your Web browser to the Zabbix Console by using the following URL:
http://<HOST_IP>/zabbix
-
Follow the prompts to finish configuration. Please take note of the following caveats.
-
Change
Database host
fromlocalhost
to127.0.0.1
if you get the error "Error connecting to database: No such file or directory". -
On RHEL, the firewall may be configured to not allow connections in. If you cannot connect to the site please change the firewall to allow those connections:
sudo firewall-cmd --add-service={http,https} --permanent sudo firewall-cmd --add-port={10051/tcp,10050/tcp} --permanent sudo firewall-cmd --reload
-
On RHEL, SELinux may get in the way of completing the web installation:
-
If the web installation is getting access denied on the database please run the following commands:
sudo setsebool -P httpd_can_connect_zabbix 1 sudo setsebool -P zabbix_can_network 1 sudo setsebool -P httpd_can_network_connect_db 1
-
If the web installation cannot create the config file try disabling SELinux temporarily:
sudo su # disable SELinux setenforce 0 && sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config exit
At this point, you should go back to the web installation, it should now be able to create the configuration file. Once that's done please follow these steps:
sudo su # re-enable SELinux setenforce 1 && sed -i 's/^SELINUX=.*/SELINUX=enforcing/g' /etc/selinux/config exit # create a policy with exceptions for the things zabbix needed and apply it sudo grep "denied.*zabbix" /var/log/audit/audit.log | audit2allow -M zabbix_policy sudo semodule -i zabbix_policy.pp
-
-
If you get an error 'DBType not set' after setup, click retry to reload config file. To avoid the error, wait 5 seconds before clicking 'finish' at the end.
-
Login to Zabbix using below default credentials.
User : Admin Password : zabbix
-
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.