Installing Zabbix from Source Code

1. Zabbix Server Installation

First, install the required dependencies for compiling Zabbix from source:

yum install libxml2-devel net-snmp-devel libevent-devel curl-devel pcre* mariadb-devel php-fpm

Configure and compile Zabbix with the necessary options:

./configure --prefix=/usr/local/zabbix --enable-server --enable-agent \
    --enable-proxy --with-mysql=/usr/local/mysql/bin/mysql_config --enable-ipv6 \
    --with-net-snmp --with-libcurl --with-libxml2

Database Setup:

Create a dedicated user and database for Zabbix:

groupadd zabbix
useradd -g zabbix zabbix
mysql> create database zabbix character set utf8;
mysql> grant all on zabbix.* to zabbix@localhost identified by 'zabbix@qaz';
mysql> flush privileges;

Server Configuraton:

Edit the Zabbix server configuration file at /usr/local/zabbix/etc/zabbix_server.conf:

LogFile=/usr/local/zabbix/log/zabbix_server.log
PidFile=/usr/local/zabbix/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix@qaz
DBSocket=/var/lib/mysql/mysql.sock
DBPort=3306
Timeout=4
LogSlowQueries=3000

Create the log directory and set proper ownership:

mkdir /usr/local/zabbix/log
chown -R zabbix.zabbix /usr/local/zabbix/log

Starting the Server:

chown zabbix.zabbix /usr/local/zabbix/
/usr/local/zabbix/sbin/zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf

Web Interface Setup:

Copy the web interface files to your web server directory:

cp -r /root/zabbix-5.0.0/ui/ /var/www/
chown -R www:www /var/www

2. Installing PHP-FPM 7.2

Method 1: Compile from Source

yum install openssl openssl-devel curl curl-devel libjpeg libjpeg-devel libpng \
   libpng-devel freetype freetype-devel pcre pcre-devel libxslt libxslt-devel bzip2 bzip2-devel

./configure --prefix=/usr/local/php --with-curl --with-freetype-dir --with-gd \
  --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 \
  --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql \
  --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc \
  --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath \
  --enable-libxml --enable-inline-optimization --enable-mbregex \
  --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap \
  --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip

make && make install

Method 2: Install via YUM Repository

yum install epel-release -y
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum remove php*
yum install php72w php72w-cli php72w-fpm php72w-common php72w-devel \
            php72w-mysql php72w-bcmath php72w-mbstring php72w-gd php72w-xml php72w-ldap

Configure PHP-FPM in /etc/php-fpm.d/www.conf:

listen = /var/run/phpfpm.sock
listen.owner = www
listen.group = www
listen.mode = 0660

Restart the PHP-FPM service:

systemctl restart php-fpm

3. Nginx Configuration

Configure Nginx to serve the Zabbix web interface:

user  www;
worker_processes  auto;

server {
    listen       80;
    server_name  zabbix.c.com;

    autoindex off;
    index index.php;
    root /var/www/ui;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/phpfpm.sock;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

4. Initial Login

Access the web interface at: http://your-domain

Default credenitals:

  • Username: Admin
  • Password: zabbix

5. Fixing Font Display Issues

If Chinese characters appear incorrectly rendered, follow these steps:

  1. Download the SimSun font file (simsun.ttc) and rename it to simsun.ttf
  2. Copy the font file to /var/www/ui/assets/fonts/
  3. Edit the file ui/include/defines.inc.php and modify the following lines:
define('ZBX_GRAPH_FONT_NAME',       'simsun');
define('ZBX_FONT_NAME',             'simsun');

Refresh the web interface to apply the changes.

Tags: Zabbix monitoring source-installation Linux nginx

Posted on Sun, 17 May 2026 23:54:46 +0000 by paul_so40