Installing Zabbix 4.0 on CentOS 6.8

Disable SELinux permanently and temporarily:

sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0

Remove any existing MySQL installation and install MySQL 5.6:

rpm -ivh https://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum -y install mysql-server

Edit /etc/my.cnf and add the following under [mysqld]:

innodb_file_per_table=1

Start MySQL and initialize the database for Zabbix:

/etc/init.d/mysqld start
mysql -e "CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;"
mysql -e "GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost' IDENTIFIED BY 'zabbix';"

Install a newer PHP version (5.6) since CentOS 6.8 ships with an outdated one:

rpm -ivh https://repo.webtatic.com/yum/el6/latest.rpm
yum -y install httpd php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap

Adjust PHP settings in /etc/php.ini:

post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1

Configure Apache by editing /etc/httpd/conf/httpd.conf:

ServerName 127.0.0.1
DirectoryIndex index.html index.php

Start Apache:

/etc/init.d/httpd start

Create a dedicated system user for Zabbix:

groupadd zabbix
useradd -g zabbix zabbix

Install required development libraries:

yum -y install gcc mysql-community-devel libxml2-devel unixODBC-devel net-snmp-devel \
libcurl-devel libssh2-devel OpenIPMI-devel openssl-devel openldap-devel

Download and extract Zabbix 4.0.1 source code:

wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.0.1/zabbix-4.0.1.tar.gz
tar -zxvf zabbix-4.0.1.tar.gz
cd zabbix-4.0.1/database/mysql/

Import the initial database schema:

mysql -uzabbix -pzabbix zabbix < schema.sql
mysql -uzabbix -pzabbix zabbix < images.sql
mysql -uzabbix -pzabbix zabbix < data.sql

Compile and install Zabbix from source:

cd /zabbix-4.0.1
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 \
--with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 \
--with-openipmi --with-openssl --prefix=/usr/local/zabbix
make install

Configure the Zabbix server by editing /usr/local/zabbix/etc/zabbix_server.conf:

DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

Set up the web frontend:

mkdir -p /var/www/html/zabbix
cp -r /zabbix-4.0.1/frontends/php/* /var/www/html/zabbix/
chown -R apache:apache /var/www/html/zabbix
chmod +x /var/www/html/zabbix/conf/

Install init scripts and enable services:

cp /zabbix-4.0.1/misc/init.d/fedora/core/zabbix_server /etc/init.d/
cp /zabbix-4.0.1/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
chmod +x /etc/init.d/zabbix_*

chkconfig --add zabbix_server
chkconfig --add zabbix_agentd
chkconfig httpd on
chkconfig mysqld on
chkconfig zabbix_server on
chkconfig zabbix_agentd on

Fix the base directory path in both init scripts:

sed -i 's|BASEDIR=/usr/local|BASEDIR=/usr/local/zabbix|' /etc/init.d/zabbix_server
sed -i 's|BASEDIR=/usr/local|BASEDIR=/usr/local/zabbix|' /etc/init.d/zabbix_agentd

If encountering libpcre.so.1 not found, create a symbolic link:

ln -sf /usr/lib64/libpcre.so.1 /lib64/

Start Zabbix services:

/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start

Access the web interface at http://<server-ip>/zabbix. Complete the setup wizard using database credentials (zabbix/zabbix). The final configuration file will be saved as /var/www/html/zabbix/zabbix.conf.php.

Default login credentials:

  • Username: Admin
  • Password: zabbix

Tags: Zabbix centos monitoring Linux installation

Posted on Tue, 03 Nov 2026 16:16:36 +0000 by dsainteclaire