Zabbix is a very popular monitor tool used widely to collect metrics related to Networks, Physical or Virtual Servers, and IT infra. It also has GUI to display the collected metrics and it is released under the terms of General Public License version 2. Thus, It is a free-to-use software.
In this article, we will be going through the steps required to install and run Zabbix on CentOS 7
Installing Zabbix
Database and Webserver
We will be using Apache and MySQL as web and database servers respectively for this installation.
- Update and upgrade your system.
# sudo yum update -y
# sudo yum upgrade -y -
We need to disable or provide permissive permissions for SELinux. You can temporarily change the SELinux mode from
targeted
topermissive
with the following command.# sudo setenforce 0
Note: However, this change is valid for the current runtime session only.
- Install Apache along with the required PHP packages.
# sudo yum install -y httpd php php-mysqlnd php-ldap php-bcmath php-mbstring php-gd php-xml
- We need to modify php values to fine-tune with the Zabbix server.
Search and replace the following values in the php.ini file.# vi /etc/php.ini
You can select the timezone that is local to you. Check out the official zones for more information.post_max_size = 16M upload_max_filesize = 2M max_execution_time 300 max_input_time = 300 memory_limit 128M session.auto_start = 0 mbstring.func_overload = 0 date.timezone = Europe/Bucharest
- Restart the Apache server for the changes to be applied.
# sudo systemctl restart httpd.service
- Install Maria DB
# sudo yum install -y mariadb-server mariadb-client mariadb-devel
# sudo systemctl start mariadb
- Secure your database by running mysql_secure_installation.
# sudo mysql_secure_installation
- Create Zabbix Database and the user. Make sure you provide the respective password for the zabbix user.
# mysql -u root -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;
Installing Zabbix Server
- Install Zabbix.
# sudo rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
# sudo yum clean all - Install Zabbix server and agent.
# sudo yum install -y zabbix-server-mysql zabbix-agent
- Install Zabbix front end and enable the red hat software collection.
Edit file "/etc/yum.repos.d/zabbix.repo" and enable "zabbix-frontend" repository.# sudo yum install -y centos-release-scl
# vi /etc/yum.repos.d/zabbix.repo
Install Zabbix frontend packages.[zabbix-frontend] ... enabled=1 ...
# sudo yum install -y zabbix-web-mysql-scl zabbix-apache-conf-scl
-
On Zabbix server host, import the initial schema and data. You will be prompted to enter your newly created password.
# sudo zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
- Disable "log_bin_trust_function_creators" option after importing the database schema.
# mysql -u root -p mysql> set global log_bin_trust_function_creators = 0; mysql> quit;
- Configure Zabbix Database password.
Search and provide value for the DBPassword variable as shown below syntax.# sudo vi /etc/zabbix/zabbix_server.conf
DBPassword=yourpassword
- Restart Zabbix processes and Apache web server.
# sudo systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
# sudo systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpmAccess your Zabbix server at http://yourhost_IPv4/zabbix and finish the initialization steps.