Complete Steps to Install and Configure Zabbix on Ubuntu

Hello Everyone

I recently installed Zabbix Network Monitoring Application in my company. It is a great and free tool to monitor the status of the various Network Devices in your infrastructure.

Pre-requisite- Ubuntu LinuxĀ 

Here’s the step by step

1. Visit- https://www.zabbix.com/download

Select the options appropriate for your OS. I selected below and once these are selected you will see a step by step things to do.


2.Ā  Install and Configure Zabbix

a. Install Zabbix Repository

Open terminal and enter below commands. If you face permission issue type sudo before the command and give password. You can also type sudo -I, this will enable root access and then you wonā€™t have to type sudo before admin commands

# wget https://repo.zabbix.com/zabbix/6.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.2-2%2Bubuntu22.04_all.deb

# dpkg -i zabbix-release_6.2-2+ubuntu22.04_all.debĀ 

# apt update

b. Ā Install Zabbix Server,
Frontend and Agent (we are installing everything on the same server)

# apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

c. Create Initial Database

# mysql -uroot -p
<type the password as>password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user [email protected] identified by ‘password’;
mysql> grant all privileges on zabbix.* to [email protected];
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;Ā Ā 

Import Initial Schema and Data. You will be prompted to enter the password created on “mysql -uroot -p” above

# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql –default-character-set=utf8mb4 -uzabbix -p zabbix

This command will take time to execute, so wait for it to run and only then go for the next step.

Disable log_bin_trust_function_creators option after importing database schema.

# mysql -uroot -p
<type the password as>password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;

d. Configure the database for Zabbix serverĀ 

Edit file /etc/zabbix/zabbix_server.conf by typing below commands

#nano /etc/zabbix/zabbix_server.conf

Scroll down to line DBPassword=password and uncomment it- Ctrl+X to save it

e. Start Zabbix server and agent processes

# systemctl restart zabbix-server zabbix-agent apache2
# systemctl enable zabbix-server zabbix-agent apache2

Start using Zabbix by opening the browser and type http://ip address/Zabbix. This will open the initial
Zabbix setup. Once this is done, login to Zabbix by entering below credentials

Username- Admin, Password- password

Useful MySQL commands for troubleshooting

Description

Command

To login (from unix shell) use -h only if needed.

[mysql
dir]/bin/mysql -h hostname -u root -p

Create
a database on the sql server.

create
database [databasename];

List
all databases on the sql server.

show
databases;

Switch
to a database.

use [db
name];

To see
all the tables in the db.

show
tables;

To see
database’s field formats.

describe
[table name];

To
delete a db.

drop
database [database name];

To
delete a table.

drop
table [table name];

Show
all data in a table.

SELECT
* FROM [table name];

Returns
the columns and column information pertaining to the designated table.

show
columns from [table name];

Show list of users SELECT
User, Host FROM mysql.user;

Delete
a user

DROP USER 'username'@'host';

Delete
multiple users

DROP USER 'user1'@'localhost', 'user2'@'localhost', 'user3'@'localhost';

Useful Links

https://www.zabbix.com/download

https://phoenixnap.com/kb/remove-delete-mysql-user

http://g2pc1.bu.edu/~qzpeng/manual/MySQL%20Commands.htm

Related Posts

One thought on “Complete Steps to Install and Configure Zabbix on Ubuntu

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.