Zabbix Server is a mature and effortless, enterprise-class, open source monitoring solution. Here, you will see how to install it on Ubuntu 20.04 LTS.
Table of Contents:
- What is Zabbix Server?
- Environment Specification
- Upgrade Ubuntu Software Packages
- Add Zabbix Official Repository in Ubuntu
- Installing Zabbix Server on Ubuntu
- Installing MySQL Database Server on Ubuntu
- Run Web Setup of Zabbix Server
- Conclusion
What is Zabbix Server?:
Zabbix is an open-source monitoring software tool for diverse IT components, including networks, servers, virtual machines (VMs) and cloud services. The Software provides monitoring metrics, among others network utilization, CPU load and disk space consumption.
The monitoring software configuration can be done using XML based templates which contain elements to monitor. The software monitors operations on Linux, Hewlett Packard Unix (HP-UX), Mac OS X, Solaris and other operating systems (OSes); however, Windows monitoring is only possible through agents.
Zabbix server can use MySQL, MariaDB, PostgreSQL, SQLite, Oracle or IBM DB2 to store data. Its backend is written in C and the web frontend is written in PHP.
Released under the terms of GNU General Public License version 2, Zabbix is free software.
Recommended Training: Zabbix 5 Application and Network Monitoring
Recommended Books: Zabbix 5 IT Infrastructure Monitoring Cookbook by Nathan Liefting
Environment Specification:
We are using a minimal Ubuntu 20.04 LTS virtual machine with following specifications.
- CPU - 3.4 Ghz (2 cores)
- Memory - 4 GB
- Storage - 40 GB
- Operating System - Ubuntu Server 20.04 LTS
- Hostname – zabbix-01.centlinux.com
- IP Address - 192.168.116.239 /24
Upgrade Ubuntu Software Packages:
Connect with zabbix-01.centlinux.com as a privileged user by using a ssh client.
Execute apt command to update list of available packages.
$ sudo apt update
In our Ubuntu server, there are 65 packages that can be upgraded. The output may vary on your Ubuntu operating system.
Execute following command at Linux bash prompt to upgrade the listed software packages.
$ sudo apt -y upgrade
Add Zabbix Official Repository in Ubuntu:
Zabbix website provides installation package for various Linux distros. You can install this package to add it’s official repository in Package Management System of your Ubuntu operating system.
Download software package for Zabbix 5.0 repository from their official website.
$ wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb
Use dpkg command to install download package.
$ sudo dpkg -i zabbix-release_5.0-1+focal_all.deb
Update list of available software packages for your Ubuntu operating system by using apt command.
$ sudo apt update
Installing Zabbix Server on Ubuntu:
You have successfully added Zabbix official repository in your Linux operating system. Therefore, you can now easily install this software by using apt command.
$ sudo apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent
Installing MySQL Database Server on Ubuntu:
In this guide, we are using Apache web server and MySQL database server with Zabbix application. Therefore, you are required to have a MySQL database server.
If you do not have a MySQL database server in your network, then you have to install it on zabbix-01.centlinux.com machine.
$ sudo apt install -y mysql-server
After succesfull installation, check the status of MySQL service.
$ sudo systemctl status mysql
MySQL database service is already started.
Configure MySQL database server by using mysql_secure_installation command.
$ sudo mysql_secure_installation Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: Y There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2 Please set the password for root here. New password: Re-enter new password: Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y Success. All done!
Connect to MySQL database server by using mysql command.
$ sudo mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Create 'zabbix' database to be used by your monitoring server.
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected, 2 warnings (0.01 sec)
Create a database user 'zabbix' and set a strong password.
mysql> create user zabbix@localhost identified by 'P@ssw0rd';
Query OK, 0 rows affected (0.01 sec)
Grant all privileged on zabbix database to zabbix user.
mysql> grant all privileges on zabbix.* to zabbix@localhost; Query OK, 0 rows affected (0.00 sec) mysql> quit; Bye
Zabbix server documentation provides a SQL script to create it’s repository in MySQL database.
You can run this SQL script as follows.
$ zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u zabbix -p zabbix
Enter password:
Edit Zabbix server configuration file in nano text editor.
$ sudo nano /etc/zabbix/zabbix_server.conf
And set the zabbix database user's password in this file.
DBPassword=P@ssw0rd
Edit Apache configuration file in nano text editor.
$ sudo nano /etc/zabbix/apache.conf
Uncomment and set your respective Time Zone. There are multiple occurrences of this directive, you should set each of them.
php_value date.timezone America/Santiago
Restart and Enable Zabbix Server, Agent and Apache services.
$ sudo systemctl restart zabbix-server zabbix-agent apache2 $ sudo systemctl enable zabbix-server zabbix-agent apache2 Synchronizing state of zabbix-server.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable zabbix-server Synchronizing state of zabbix-agent.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable zabbix-agent Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable apache2 Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service → /lib/systemd/system/zabbix-server.service.
Allow Apache service in Ubuntu Firewall by executing ufw command.
$ sudo ufw allow apache
Rules updated
Rules updated (v6)
Run Web Setup of Zabbix Server:
Open URL http://zabbix-01.centlinux.com/zabbix/ in a web browser.
If you have performed the installation as described above, then you will see this welcome page of Zabbix web setup.
Click on 'Next Step'.
If you have performed the configurations correctly, then you will get the 'OK' status for all the Zabbix perquisites.
Move on to 'Next Step'.
Provide the connection details of your MySQL server, including database and user credentials.
Click on 'Next Step'.
Enter the hostname/IP address and port number of the Linux server. You are required to provide the name of the installation (optional).
Continue to 'Next Step'.
Web setup will display the configurations, that you have made so far.
Click on 'Next Step' if you are happy with them, otherwise go back and adjust them as per your requirement.
Configuration file has been created and the installation of Zabbix frontend completed successfully.
Login as default Zabbix user/password i.e. admin/zabbix.
After successful login, you will reach at the Zabbix dashboard.
Conclusion:
We have successfuly performed step by step installation of Zabbix server on Ubuntu 20.04 LTS.
no work:
ReplyDeletezcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbix -p zabbixdb
Enter password: gzip: /usr/share/doc/zabbix-server-mysql*/create.sql.gz: No such file or directory
Try following command.
Deletezcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u zabbix -p zabbixdb
update your guide
ReplyDeletePlease let me know exactly what can I update in this guide.
Deletegreat guide. i appreciate the hard work
ReplyDelete