How To Install Zabbix Server on CentOS 8

Install zabbix server on centOS 8; Through this tutorial, we will learn how to install and configure zabbix server on CentOS 8.

How To Install Zabbix Server on CentOS 8

Just follow the following steps to install and configure zabbix server on centOS 8:

  • Step 1 – Disable SELinux
  • Step 2 – Install LAMP Server
  • Step 3 – Configure MariaDB Database
  • Step 4 – Install Zabbix Server
  • Step 5 – Configure Zabbix
  • Step 6 – Configure Firewall for Zabbix
  • Step 7 – Access Zabbix Web Interface

Step 1 – Disable SELinux

First of all, open terminal and execute the following command on terminal to disable SELinux by editing /etc/selinux/config:

nano /etc/selinux/config

Update the following line:

SELINUX=disabled

Save and close the file.

Step 2 – Install LAMP Server

Now, execute the following command on terminal install the Apache webserver, MariaDB database server, PHP and other required PHP extension to system:

dnf install -y httpd mariadb-server php php-cli php-common php-mbstring php-mysqlnd php-xml php-bcmath php-devel php-pear php-gd

Once the above commands are executed, then open php.ini file by execute the following command:

nano /etc/php.ini

Update the following values as per requirements:

memory_limit 256M
upload_max_filesize 16M
post_max_size 16M
max_execution_time 300
max_input_time 300
max_input_vars 10000
date.timezone = Asia/Kolkata

Save and close file.

Step 3 – Configure MariaDB Database

Execute the following command on terminal to secure the MariaDB:

mysql_secure_installation  

This script will set the MariaDB root password, remove anonymous users, disallow root login remotely and remove test database as shown below:

Enter current password for root (enter for none): Press Enter
Set root password? [Y/n] Y
New password: 
Re-enter new 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

Once the MariaDB is secured, log in to MariaDB shell with the following command:

mysql -u root -p

After that, create a database and user for Zabbix with the following command:

MariaDB [(none)]> CREATE DATABASE zabbix CHARACTER SET utf8 collate utf8_bin;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbix.* TO [email protected] IDENTIFIED BY 'zabbixpassword'

Then, flush the privileges and exit from the MariaDB shell with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Step 4 – Install Zabbix Server

Before install zabbix server, we neeed to install the libssh2 library required by Zabbix using the following command:

dnf install -y http://mirror.centos.org/centos/8.0.1905/AppStream/x86_64/os/Packages/libssh2-1.8.0-8.module_el8.0.0+189+f9babebb.1.x86_64.rpm

Then execute the following command on terminal to instal zabbix server on centOS 8:

dnf install -y https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-apache-conf

Now, start and enable the Zabbix server by executing the following command on terminal:

systemctl start zabbix-server
systemctl start zabbix-agent
systemctl start php-fpm
systemctl enable zabbix-server
systemctl enable zabbix-agent
systemctl enable php-fpm

Step 5 – Configure Zabbix

Configure zabbix server by import the database schema to the Zabbix database using the following command on terminal:

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

Then, edit the zabbix_server.conf file and define Zabbix database credentials by executing the following command on terminal:

nano /etc/zabbix/zabbix_server.conf

Change the following lines:

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbixpassword

Save and close the file.

Now, configure PHP for Zabbix frontend by editing the following file:

nano /etc/php-fpm.d/zabbix.conf

Update the timezone value with your desired value as shown below:

php_value[date.timezone] = Asia/Kolkata

Save and close the file. And execute the following command on terminal to restart all the services to apply the changes:

systemctl restart zabbix-server
systemctl restart zabbix-agent
systemctl restart php-fpm
systemctl restart httpd
systemctl restart mariadb

Step 6 – Configure Firewall for Zabbix

Now, execute the following command on terminal to configure ports 10050 and 10051:

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-port=10050/tcp
firewall-cmd --permanent --add-port=10051/tcp

Then execute the following command on terminal to reload firewall services:

firewall-cmd --reload

Step 7 – Access Zabbix Web Interface

Finally, open web browser and type the URL http://your-server-ip/zabbix for access web interface of zabbix.

Conclusion

That’s all! we have successfully installed the Zabbix server on CentOS 8 server.

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *