How to Install Zabbix Monitoring on CentOS 7

r00t September 20, 2017

Install Zabbix Monitoring on CentOS 7

In this tutorial we’ll learn how to install Zabbix Monitoring on CentOS 7. We will also install and configure its prerequisites. Zabbix is a free and open source network monitoring Software tool which is used to monitor and track the availability and performance of your IT infrastracture such as WEB monitoring, auto-discovery, and more.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an CentOS 7 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Zabbix Monitoring on CentOS 7

Step 1. First, ensure your system is fully up-to-date by running the following:

yum -y update
yum install epel-release

Step 2. Installing LAMP on CentOS 7.

You should check out this LAMP stack install tutorial for CentOS 7, if you haven’t installed LAMP yet. Once it’s installed, come back here and read on. We also will install the required packages for LAMP stack and the important PHP extension that Zabbix relies on:

yum install php70w php70w-dom php70w-mbstring php70w-gd php70w-pdo php70w-json php70w-xml php70w-zip php70w-curl php70w-mcrypt

Step 3. Installing Zabbix.

First, we need to enable the zabbix repository using this commands:

rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

Now use the below command to install Zabbix and necessary packages:

yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get zabbix-sender zabbix-java-gateway

Step 4. Configure Zabbix Server with MariaDB.

Next, we need to create a database for the Zabbix installation:

mysql -uroot -p

Run the following command to create a database for Zabbix:

create database zabbixdb character set utf8 collate utf8_bin;
grant all privileges on zabbixdb.* to zabbixuser@localhost identified by 'zabbixpassword';
quit;

Import zabbix database schema in newly created database:

cd /usr/share/doc/zabbix-server-mysql*/
zcat create.sql.gz | mysql -u zabbixuser -p zabbixdb

Now we need to edit database configuration in the zabbix server configuration file zabbix_server.conf:

nano /etc/zabbix/zabbix_server.conf

Make sure you set as follows:

...................................
DBHost=localhost
DBName=zabbixdb
DBUser=zabbixuser
DBPassword=zabbixpassword
...................................

After importing the zabbix database we need to enable and start zabbix-server service:

systemctl enable zabbix-server
systemctl enable httpd
systemctl enable mariadb

Step 5. Edit PHP timezone.

To begin using the Apache with Zabbix server. Zabbix configuration file needs to be updated with TimeZone:

nano /etc/httpd/conf.d/zabbix.conf

Update the following:

php_value date.timezone Asia/Kolkat

Save the file and don’t forget to reload the apache service using the below command:

systemctl reload httpd

Step 6. Set SELinux settings and adjust Firewall.

If you have SELinux enabled on your server, you need to run the following command to enable successful connection of Zabbix web frontend to the server:

setsebool -P httpd_can_network_connect=1
setsebool -P httpd_can_connect_zabbix=1
setsebool -P zabbix_can_network=1

Configure the firewall to allow Zabbix agent to reach Zabbix server:

firewall-cmd --permanent --add-port=10050/tcp
firewall-cmd --permanent --add-port=10051/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload
systemctl restart firewalld

Step 7. Accessing Zabbix Monitoring Web Installation.

Now you can access the Zabbix web install wizard in your browser by entering the domain-name/zabbix or http://your_ip/zabbix/ to continue your Zabbix installation. I suggest you read up on Zabbix documentation and specifically the concepts and definitions.

Congratulation’s! You have successfully install and configured Zabbix Monitoring on your CentOS 7 server. Thanks for using this tutorial for installing Zabbix on CentOS 7 system.

The Tags:

Leave a Comment

Comments are closed.