Thursday, June 11, 2020

How to install Zabbix on Centos-7

Procedure: Here I have explained how to install zabbix on Centos-7

Prerequisites:
  • Centos 7 Sever 
  • Root Privileges
Steps:
Install Apache2/httpd : First we install http on centos server using below command.
  start and enable service after install. 

# yum -y install httpd
# systemctl start httpd
# systemctl enable httpd

Install PHP 7.2 on Centos 7: Before install php 7.2 we will install webtatic and the EPEL repository to the system.

# yum -y install epel-release
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Install PHP using below command


 # yum -y install mod_php72w php72w-cli php72w-common php72w-devel php72w-pear php72w-gd php72w-mbstring php72w-mysql php72w-xml php72w-bcmath

Once Installation complete make below changes on php.ini PHP configuration file locate on /etc/php.ini

 
# vi /etc/php.ini
max_execution_time = 600
max_input_time = 600
memory_limit = 256M
post_max_size = 32M
upload_max_filesize = 16M
date.timezone = Asia/Kolkata

Once file modified restart httpd service
# systemctl restart httpd

Install and Configure MariaDB: Zabbix supports many database including MySQL, PostgreSQL, SQLite, Oracle Database. We will install MariaDB as a database for Installation.

# yum -y install mariadb-server

After installation start and enable mariadb service

# systemctl start mariadb
# systemctl enable mariadb

Configure MariaDB using below command and setup root password
# mysql_secure_installation

Create Database and user for zabbix. Assigned rights for same.
# mysql -u root -p

create database zabbixdb;
grant all privileges on zabbixdb.* to zabbixuser@'localhost' identified by 'password';
grant all privileges on zabbixdb.* to zabbixuser@'%' identified by 'password';
flush privileges;

Install and Configure Zabbix 3.4

Add zabbix repository to Centos 7 and Install zabbix

 
# yum -y install http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm

# yum -y install zabbix-get zabbix-server-mysql zabbix-web-mysql zabbix-agent


Import Database: Import database from backup Zabbix database sample to our 'zabbix' database

# cd /usr/share/doc/zabbix-server-mysql-3.4.6/
# gunzip create.sql.gz
# mysql -u root -p zabbixdb < create.sql

Configure Zabbix: Configure zabbix by change below in configuration file.
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBPassword=password


Start and Enable Zabbix service using below command
 
# systemctl start zabbix-server
# systemctl enable zabbix-server

Allow Require port in firewall and reload it.
# firewall-cmd --add-service={http,https} --permanent
# firewall-cmd --add-port={10051/tcp,10050/tcp} --permanent
# firewall-cmd --reload
# firewall-cmd --list-all


  • Open browser and browse http://IP_Address/zabbix/ 
  • Setup database user and database configuration in setup
  • Once setup will completed open URL http://IP_Address/zabbix 
User Name : Admin 
Password : zabbix

No comments:

Post a Comment