fbpx

Zabbix Tutorial: How to Install and Configure Zabbix on Ubuntu

· >
Zabbix Tutorial How to Install and Configure Zabbix on Ubuntu

Zabbix is a powerful and open-source monitoring solution that allows you to monitor various aspects of your IT infrastructure such as servers, network devices, applications, and services. In this tutorial, we will guide you through the process of installing and configuring Zabbix on Ubuntu.

Step 1: Update your Ubuntu system

The first step is to update your Ubuntu system. Open a terminal and run the following command:

sudo apt update && sudo apt upgrade

Step 2: Install LAMP stack

Zabbix requires a web server, database, and PHP support to run. We can install all these dependencies with a single command by installing the LAMP stack. Run the following command in the terminal to install the LAMP stack:

sudo apt install lamp-server^

After the installation, check if the Apache web server is running by running the following command:

systemctl status apache2

Step 3: Install Zabbix Server

Next, we will install the Zabbix server on Ubuntu. Run the following command to add the Zabbix repository:

sudo wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu20.04_all.deb

Once the repository is added, update the package list and install the Zabbix server with the following command:

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

During the installation, you will be prompted to create a MySQL root password. Remember this password as we will need it later.

Step 4: Create a MySQL Database

Zabbix requires a database to store monitoring data. We will use MySQL as our database server. Run the following command to log in to MySQL as the root user:

sudo mysql -u root -p

Enter the root password when prompted. Once you are in the MySQL shell, create a new database and user for Zabbix:

CREATE DATABASE zabbixdb character set utf8 collate utf8_bin;
CREATE USER 'zabbixuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON zabbixdb.* TO 'zabbixuser'@'localhost';
FLUSH PRIVILEGES;

Replace ‘password’ with a secure password of your choice.

Step 5: Configure Zabbix Server

Now we will configure the Zabbix server to use the MySQL database we just created. Edit the Zabbix server configuration file with the following command:

sudo nano /etc/zabbix/zabbix_server.conf

Find the following lines and replace them with the corresponding values:

DBHost=localhost
DBName=zabbixdb
DBUser=zabbixuser
DBPassword=password

Save and close the file.

Step 6: Import Zabbix Database Schema

Zabbix comes with a database schema that we need to import into our MySQL database. Run the following command to import the schema:

sudo zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | sudo mysql -u zabbixuser -p zabbixdb

Enter the password for the zabbixuser when prompted.

Step 7: Configure Zabbix Frontend

Next, we will configure the Zabbix frontend. Open the Zabbix Apache configuration file with the following command:

sudo nano /etc/zabbix/apache.conf

Find the following lines and replace them with the corresponding values:

php_value date.timezone Europe/London

Save and close the file.

Step 8: Restart Services

To apply the changes, we need to restart the services. Run the following command to restart the Apache and Zabbix server:

sudo systemctl restart apache2
sudo systemctl restart zabbix-server

Step 9: Access Zabbix Web Interface

Zabbix frontend is now ready to be accessed. Open your web browser and navigate to http://your_server_ip/zabbix. You will see the Zabbix login screen.

Enter the default username and password (Admin/zabbix) and click on the login button. You will be prompted to change the default password. Enter a new password and click on the update button.

You will be redirected to the Zabbix dashboard, where you can start adding hosts and monitoring items.

Congratulations! You have successfully installed and configured Zabbix on Ubuntu.

Conclusion In this tutorial, we have shown you how to install and configure Zabbix on Ubuntu. Zabbix is a powerful and flexible monitoring solution that can help you monitor your IT infrastructure. By following the steps outlined in this tutorial, you can set up Zabbix on your Ubuntu server and start monitoring your hosts and services.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments