System administrators often use monitoring tools like Zabbix to keep an eye on servers, virtual machines, devices connected to their network, and more. Zabbix is ​​a great tool that offers a graphical user interface to efficiently control and manage these services.

But the Zabbix installation process on Linux is quite long and confusing. This article shows how to easily install Zabbix and its prerequisites on a system running Ubuntu or Debian.

Requirements for Zabbix

To successfully install Zabbix on your desktop or server, you need:

  • A root account

  • MySQL database

  • PHP

  • Apache server

Step 1: Install Apache and PHP

Since Zabbix is ​​written in PHP, you'll need to download PHP and the Apache server onto your computer.

Add the following PPA repository to your system by adding Add-apt-repository:

sudo add-apt-repository ppa: ondrej / php

Start the terminal and update your system's repository list with APT:

sudo apt update

Update the installed packages to make sure there are no outdated packages on your computer.

sudo apt upgrade

Next, download the required packages for Apache and PHP:

sudo apt install apache2 php php-mysql php-ldap php-bcmath php-gd php-xml libapache2-mod-php

After downloading the packages, the system will automatically configure the Apache service to start during boot. Use to check if the service is currently running on your computer systemctl:

systemctl-status apache2

When the status is displayed active (ongoing), then it's alright. If not, however, you will have to start the service manually.

systemctl start Apache2
systemctl stop apache2
systemctl restart Apache2

Step 2: Install and set up the MySQL database

Issue the below given command in Terminal to install MySQL.

sudo apt install mysql-server mysql-client

Now you need to install the database on your Ubuntu machine. To make your work easier, MySQL offers an installation script that will automatically install the database for you.

Start the terminal and enter the following:

mysql_secure_installation

Enter the root user password and press Enter. The script asks you a few questions to configure the database installation, such as:

  1. Set root password?

  2. Remove anonymous users?

  3. Prohibit root login remotely?

  4. Remove and access test database?

  5. Reload authorization tables now?

Art Yes and press Enter for all questions.

Now is the time to create a new database for Zabbix. Start the terminal and enter the following command:

mysql -u root -p

Run the following database commands to create a new database and give the new user the appropriate permissions. Make sure you replace password in the second command with a strong password of your choice.

$ CREATE DATABASE zabbixdb character set utf8 collate utf8_bin;
$ USER & # 39; zabbix & # 39; @ & # 39; localhost & # 39; IDENTIFIED BY & # 39; password & # 39; create;
$ ALL PRIVILEGES ON zabbixdb. * TO & # 39; zabbix & # 39; @ & # 39; localhost & # 39; GRANT WITH GRANT OPTION;
$ FLUSH PRIVILEGES;

When you're done, exit the MySQL shell by typing:

Leaving;

Step 3: Download and install Zabbix

To install Zabbix on Ubuntu and Debian, download the DEB package from the official Zabbix repository. To use wget to download the package file:

wget https://repo.zabbix.com/zabbix/5.0/debian/pool/main/z/zabbix-release/zabbix-release_5.0-1+buster_all.deb

Install the downloaded package using APT.

sudo apt ./zabbix-release_5.0-1+buster_all.deb

Next, download the Zabbix server, agent packages, and web front end.

sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent

Now create and load the Zabbix database schema.

zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u root -p zabbix

Step 4: configure the Zabbix server

Even though you have Zabbix installed on your system, it is not configured to use the database you created earlier.

Open the Zabbix configuration file under / etc / zabbix with your favorite Linux text editor.

nano /etc/zabbix/zabbix_server.conf

Now find the following lines in the configuration file and change the host name, username and password.

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

Make sure you replace password with a strong password of your choice.

Related: How To Make A Strong Password That You Will Not Forget

Step 5: configure the Apache server

Before proceeding, there are a few changes you need to make to the Zabbix Apache configuration file.

To do this, first reload the Apache server with systemctl.

systemctl reload apache2

Open the configuration file with nano or another text editor.

nano /etc/zabbix/apache.conf

Find the line php_value date.timezone and replace with the time zone that corresponds to your geographic location.

Step 6: complete configuration

After you've finished customizing the files, it's time to start the services and graphically set up Zabbix.

Restart the Apache service with systemctl.

systemctl restart Apache2

Start the Zabbix server and agent by entering the following command:

systemctl start zabbix-server zabbix-agent

Enable the Zabbix services from the command line.

systemctl activate zabbix server zabbix agent

Check if the Zabbix server is running on your system by running the Systemctl status Command.

systemctl-status zabbix-server

Proceed when the status is displayed active in green letters.

Step 7: Optimizing the firewall with UFW

To ensure that Zabbix is ​​working properly on your system, you need to open ports 80 and 443 on your network. On Linux, UFW is a great utility that will help you configure firewalls and manage ports.

Open ports 80 and 443 by entering the following command:

ufw allow 80 / tcp
ufw allow 443 / tcp

Reload your firewall to save the changes.

reload ufw

Step 8: configure the Zabbix frontend

Start any web browser on your Linux system and go to the following address:

http: // localhost / zabbix

If you installed Zabbix on a Linux server, replace localhost with the IP address of the server. The browser displays the Zabbix welcome page. Click on that Next Step , to continue.

Zabbix is ​​now checking the requirements for the application. If you find a missing package, install it from the terminal. When you're done, click Next Step.

Enter the database password previously entered in the configuration file. Then choose Next Step.

The system asks you for information about the server. Enter an appropriate server name and continue by clicking Next Step.

Zabbix quickly summarizes all the configurations and settings that you have made. Check these settings and click Next Step when everything looks good

The installation process will now begin. Choose Finished as soon as Zabbix has completed the installation.

The system will redirect you to the login page. Enter Administrator and zabbix as username or password. You can change the password later by going to Administrator> User.

Now you can easily monitor your network Monitor

Zabbix is ​​a great way to control and monitor devices on your network. It consists of several tools that a user may need to keep track of cloud services, virtual machines, servers, and other devices on their network.

You can also set up a portable network monitor with a Raspberry Pi and Nagios Enterprise Monitoring Server (NEMS). Using a Raspberry Pi as a network monitoring device is much better than using a full desktop for the task.

How to turn your Raspberry Pi into a network monitoring tool

Do you want to monitor your network or remote devices? How to turn your Raspberry Pi into a network monitoring tool with Nagios.

Continue reading

About the author

Deepesh Sharma
(56 published articles)

Deepesh is Junior Editor for Linux at MUO. He has been writing informational content on the Internet for over 3 years. In his spare time he enjoys writing, listening to music and playing the guitar.

More
From Deepesh Sharma

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!

One more step …!

Please confirm your email address in the email we just sent you.