Lesstion 1 - Monitoring the server and notifying when the server has problems has never been difficult with Zabbix

01/03/2023 - 2 phút

Follow  on Google News

To install Zabbix server on Ubuntu 22.04, the following steps are required:

Step 1: Install Zabbix 6.2

sudo su
apt update && apt -y upgrade
wget https://repo.zabbix.com/zabbix/6.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.2-1+ubuntu22.04_all.deb
dpkg -i zabbix-release_6.2-1+ubuntu22.04_all.deb
apt update
root@zabbix-serverr:~# apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent

Step 2: Install and configure MySQL

sudo su
apt install -y mysql-server
systemctl start mysql
systemctl enable mysql
systemctl status mysql

Step 3: Create Zabbix database and user

sudo su
 mysql -uroot -p

After logging in, run the following commands to create the database and user:

create database zabbix_db character set utf8 collate utf8_bin;
create user zabbix_user@localhost identified by 'zabbix@123';
GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD on *.* TO 'zabbix_user'@'localhost' WITH GRANT OPTION;
grant all privileges on zabbix_db.* to zabbix_user@localhost;
SET GLOBAL log_bin_trust_function_creators = 1;
FLUSH PRIVILEGES;
\q

Step 4: Import Zabbix default database

sudo su
zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uroot -p zabbix_db

Step 5: Find and change Zabbix configuration

Use the following command to open the Zabbix configuration file:

sudo su
nano /etc/zabbix/zabbix_server.conf

Add the following lines to the end of the file and save:

DBName=zabbix_db
DBUser=zabbix_user
DBPassword=zabbix@123

Step 6: Configure Nginx to point to the IP address of the server (in this case, 10.19.2.1)

Use the following command to open the Nginx configuration file:

sudo su
nano /etc/zabbix/nginx.conf

Find the line and change the configuration:

listen          80;
server_name	10.19.2.1

Step 7: Restart the services

sudo su
systemctl restart zabbix-server zabbix-agent nginx php8.1-fpm
systemctl enable zabbix-server zabbix-agent nginx php8.1-fpm

After successfully restarting the services, go to http://10.19.2.1/setup.php to perform the initial configuration. Follow the on-screen instructions to complete the setup.

Click on Next Step to check the system installation requirements.

Click on Next Step to configure the database connection.

Click on Next Step to choose a theme or skip this step.

Click on Next Step to complete the installation!

Click on Finish to redirect to the default login page.

username: Admin

password: zabbix

Check the Zabbix dashboard as shown below.