Devbyte tutorials cover

How to Install Zabbix 7 on Ubuntu Server 22.04: A Step-by-Step Guide

What is Zabbix and how to install it on Ubuntu server

Zabbix 7 is a powerful open-source tool for IT infrastructure monitoring. It offers a wide range of features to track the health and performance of servers, networks, and applications. For businesses running Ubuntu Server 22.04, installing Zabbix can greatly improve system oversight and management.

To install Zabbix 7 on Ubuntu Server 22.04, users need to add the Zabbix repository, update the system, and install the necessary packages using the apt package manager. This process involves running a series of commands in the terminal to set up the database, configure the web server, and start the Zabbix services.

The installation of Zabbix 7 on Ubuntu Server 22.04 is straightforward but requires attention to detail. It’s important to follow each step carefully to ensure a smooth setup. Once installed, Zabbix provides a user-friendly web interface for monitoring various aspects of IT infrastructure, allowing administrators to stay on top of system performance and potential issues.

Preparing Ubuntu Server for Zabbix Installation

Before installing Zabbix 7 on Ubuntu Server 22.04, we need to set up the system. This involves updating packages, installing dependencies, and securing the database.

Updating System Packages

To start, open a terminal and update the package lists. Run this command:

sudo apt update

After updating, upgrade existing packages:

sudo apt upgrade -y

These steps ensure your Ubuntu Server has the latest software versions and security patches.

Installing Required Dependencies

Zabbix needs several components to work properly. Install them with this command:

sudo apt install apache2 mysql-server php php-mysql php-gd php-curl php-xml php-bcmath php-mbstring -y

This installs Apache web server, MySQL database, PHP, and necessary PHP extensions.

Check if Apache is running:

sudo systemctl status apache2

If it’s not active, start it:

sudo systemctl start apache2

Enable Apache to start on boot:

sudo systemctl enable apache2

Securing the MySQL Database

MySQL security is crucial for Zabbix. Run the security script:

sudo mysql_secure_installation

Follow the prompts to:

  1. Set a root password
  2. Remove anonymous users
  3. Disallow root login remotely
  4. Remove test database
  5. Reload privilege tables

After securing MySQL, create a database for Zabbix:

sudo mysql -u root -p

Enter your MySQL root password. Then run:

CREATE DATABASE zabbix character set utf8mb4 collate utf8mb4_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace ‘password’ with a strong, unique password for the Zabbix database user.

Zabbix Installation and Configuration

Installing Zabbix 7 on Ubuntu 22.04 involves setting up server components, creating a database, configuring the server, and setting up the web interface. These steps are crucial for a successful Zabbix deployment.

Installing Zabbix Server Components

To start, update your system and install Zabbix 7.0 on Ubuntu. Use the following commands:

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

These packages include the Zabbix server, frontend, Apache configuration, SQL scripts, and agent.

Next, install the MariaDB database server:

sudo apt install mariadb-server

This provides the necessary database backend for Zabbix.

Creating Zabbix Database and User

Set up the Zabbix database and user in MariaDB:

  1. Access the MySQL command line: sudo mysql -uroot -p
  2. Create the Zabbix database: CREATE DATABASE zabbix character set utf8mb4 collate utf8mb4_bin;
  3. Create a Zabbix user and grant permissions: CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
  4. Exit MySQL: FLUSH PRIVILEGES; EXIT;

Replace ‘password’ with a strong, unique password.

Configuring Zabbix Server

Edit the Zabbix server configuration file:

sudo nano /etc/zabbix/zabbix_server.conf

Modify these lines:

DBName=zabbix
DBUser=zabbix
DBPassword=password

Use the password you set earlier.

Set the server hostname and timezone:

Hostname=zabbix-server
Timezone=Your/Timezone

Save the file and exit.

Setting Up the Frontend

Configure PHP for Zabbix:

  1. Edit the PHP configuration: sudo nano /etc/zabbix/apache.conf
  2. Set your timezone: php_value date.timezone Your/Timezone
  3. Restart Apache: sudo systemctl restart apache2

Access the Zabbix web interface at http://your-server-ip/zabbix.

Follow the installation wizard:

  1. Check prerequisites
  2. Configure database connection
  3. Set server details
  4. Review summary
  5. Finish installation

Log in with the default credentials:

  • Username: Admin
  • Password: zabbix

Change the admin password immediately for security.

Share this article:

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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