Zabbix is an open source distributed network service monitoring tool that has many unique features and is highly customizable. Zabbix is capable of serving the medium and large networks of existing businesses with a moderate investment cost. Zabbix is designed to monitor and monitor the operating status of network infrastructure (network), servers (servers), applications (applications) in real time. Developed in a client-server model, zabbix can collect different types of data to create statistical graphs about the performance or load trends of monitored objects.
In today’s article, I will guide you to install Zabbix Server version 5.0 on Centos 7 operating system.
Step 1: Configure SELinux to permissive mode
1 2 | setenforce 0 && sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config |
Step 2: Install Zabbix server
- Install Zabbix repository
1 2 3 | rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm yum clean all |
- Install Zabbix Server & Zabbix Agent
1 2 | yum install zabbix-server-mysql zabbix-agent |
- Install Zabbix frontend
1 2 | yum install -y centos-release-scl |
Edit the zabbix.repo file to enable installation of zabbix-frontend from the responsitory
1 2 | vi /etc/yum.repos.d/zabbix.repo |
Set enable = 1 in [zabbix-frontend] Then proceed to install Zabbix frontend from repository
1 2 | yum install zabbix-web-mysql-scl zabbix-apache-conf-scl |
Step 3: Install MariaDB
- Add the MariaDB installation repository MariaDB, you can install from the repo or from the tar package, here I will install from the repo To add the repository to install MariaDB we proceed to create the mariadb.repo file as follows:
1 2 | vi /etc/yum.repos.d/mariadb.repo |
Copy and paste the following text and save the file:
1 2 3 4 5 6 7 8 | # MariaDB 10.5 CentOS repository list - created 2021-08-31 10:52 UTC # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.5/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 |
- Install MariaDB Server and MariaDB Client
1 2 | yum install MariaDB-server MariaDB-client -y |
- Start MariaDB Service
1 2 3 | systemctl enable mariadb systemctl start mariadb |
- Reset password for database Secure mysql by changing default password for Mysql root:
1 2 3 4 5 6 7 8 9 10 11 | mysql_secure_installation Enter current password for root (enter for none): Nhấn Enter Set root password? [Y/n]: Y New password: <Nhập root DB password> Re-enter new password: <Nhập lại root DB password> Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]: Y Reload privilege tables now? [Y/n]: Y |
Note: from MariaDB version 10.04 onwards you can login without entering password
1 2 | mysql -uroot |
- Create User and Database for Zabbix
1 2 3 4 5 | create database zabbix character set utf8 collate utf8_bin; create user zabbix@localhost identified by 'password'; grant all privileges on zabbix.* to zabbix@localhost; quit; |
- Import Zabbix database Temporarily configure innodb_strict_mode = OFF to avoid Mysql error “ERROR 1118 (42000) at line 1284: Row size too large (> 8126)”
1 2 | mysql -uroot -p'rootDBpass' zabbix -e "set global innodb_strict_mode='OFF';" |
When you run the import data and schema command you will be asked for a password, enter the password you created in the previous step
1 2 | zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix |
Reconfigure innodb_strict_mode = ON
1 2 | mysql -uroot -p'rootDBpass' zabbix -e "set global innodb_strict_mode='ON';" |
Step 4: Configure Zabbix Server Edit the file zabbix_server.conf
1 2 | vi /etc/zabbix/zabbix_server.conf |
Parameters to pay attention to:
- DBHost=localhost (Database Host)
- DBName=zabbix (Database Name)
- DBUser=zabbix (Database Username)
- DBPassword=password (Database Password)
Step 5: Configure PHP Open the file zabbix.conf uncomment ; php_value[date.timezone] = Europe/Riga and change to Asia/Ho_Chi_Minh
1 2 3 4 | vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf php_value[date.timezone] = Asia/Ho_Chi_Minh |
Step 6: Start Zabbix Server and Agent
1 2 3 | systemctl restart zabbix-server zabbix-agent systemctl enable zabbix-server zabbix-agent |
Step 7: Restart the Apache web server
1 2 3 | systemctl restart httpd rh-php72-php-fpm systemctl enable httpd rh-php72-php-fpm |
Step 8: Set up firewall
1 2 3 4 | firewall-cmd --add-service={http,https} --permanent firewall-cmd --add-port={10051/tcp,10050/tcp} --permanent firewall-cmd --reload |
Step 9: Set up Zabbix Dashboard After completing the above steps, we proceed to open the browser and enter the address http://ip_server/zabbix
After the setup is complete, log in to Zabbix Dashboard with the default Admin/zabbix account
Dashboard interface on Zabbix server
Remember to change the password of the administrator account (Admin) to ensure security, go to Administrator -> Users -> Admin to “change password”
So the process of performing the steps to install Zabbix on Centos has been completed.