Category Archives: Monitor

HOW TO INSTALL ZABBIX 3.2 SERVER ON CENTOS 7 / RHEL 7

[root@zabbix ~]# yum update -y
[root@zabbix ~]# yum install httpd -y
[root@zabbix ~]# yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml -y
[root@zabbix ~]# yum install mariadb-server -y
[root@zabbix ~]# systemctl enable httpd && systemctl start httpd
[root@zabbix ~]# systemctl enable mariadb && systemctl start mariadb

– Don’t forget to set a password for the root using mysql_secure_installtion, take a look to this tutorial: Securing MySQL server / Mariadb with mysql_secure_installation

Step 1 – Install Zabbix Server with MySQL

[root@zabbix ~]# rpm –import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX
[root@zabbix ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

[root@zabbix ~]# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get zabbix-sender zabbix-java-gateway -y

Step 2 – Edit PHP timezone

Open the file /etc/httpd/conf.d/zabbix.conf created by Zabbix with your favourite editer

[root@zabbix ~]# vi /etc/httpd/conf.d/zabbix.conf

It’s necessary to uncomment the “date.timezone” setting and set the right timezone for you.

php_value date.timezone Europe/Rome

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

 [root@zabbix ~]# systemctl reload httpd

Step 3 – Edit create and import initial zabbix database and user

First we need to create zabbix database (zabbixdb) and create a zabbix user (zabbixuser).

[root@zabbix ~]# mysql -u root -p

CREATE DATABASE zabbixdb CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON zabbixdb.* TO zabbixuser@localhost IDENTIFIED BY "Password";
FLUSH PRIVILEGES;

– After creating the zabbix database and user we need to import the zabbix initial database using the below commands (make sure to change zabbix-server-mysql-3.2.X to the correct version number):

[root@zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql-3.2.x/create.sql.gz | mysql -uroot -p zabbixdb

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

[root@zabbix ~]# vi /etc/zabbix/zabbix_server.conf

Specify the database name for zabbix , database user name and the password

DBHost=localhost
DBName=zabbixdb
DBUser=zabbixuser
DBPassword=Password

Step 4 – Set SELinux settings and adjust Firewall

[root@zabbix ~]# setsebool -P httpd_can_network_connect=1
[root@zabbix ~]# setsebool -P httpd_can_connect_zabbix=1
[root@zabbix ~]# setsebool -P zabbix_can_network=1

 

[root@zabbix ~]# firewall-cmd --permanent --add-service=http
success
[root@zabbix ~]# firewall-cmd --permanent --zone=public --add-port=10051/tcp
success
[root@zabbix ~]# firewall-cmd --permanent --zone=public --add-port=10050/tcp
success
[root@zabbix ~]# firewall-cmd --reload
success

After adjusting the Selinux settings and the firewall we need to enable and start zabbix service on boot using the bellow commands

[root@zabbix ~]# systemctl enable zabbix-server && systemctl start zabbix-server
[root@zabbix ~]# systemctl enable zabbix-agent && systemctl start zabbix-agent

Step 5 – Configure Zabbix via Web console

– Navigate to http://ip_address/zabbix or http://host_name/zabbix

Now you’ll be redirected to the zabbix web console page after finishing configuration. Enter the default username and password Admin/zabbix.

Last thing to do is to enable your server zabbix to be monitored: go to Configuration -> Hosts. Select the host (zabbix server) and click “Disabled”