Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Zabbix Installation on Ubuntu Server

Zabbix Installation on Ubuntu Server

In this blog, we will install Zabbix 5.0 LTS on Ubuntu Server.

Last updated on 8th July 2021

This blog is specifically targeted at Zabbix 5.0 LTS. Check the life cycle of Zabbix versions below before selecting the latest version (Zabbix 5.4 at the time of writing this blog). I would recommend to go for Zabbix 5.0 LTS unless you need a functionality not offered by this version. Check Zabbix link for further information on Zabbix life cycle.

Release nameRelease dateEnd of Full SupportEnd of Limited Support
Zabbix 5.4May 17, 2021Nov 30, 2021Dec 31, 2021
Zabbix 5.2Oct 27, 2021Jul 31, 2021Jul 31, 2021
Zabbix 5.0 LTSMay 12, 2020May 31, 2023May 31, 2025
Zabbix 4.0 LTSOctober 1, 2018October 31, 2021October 31, 2023

Make sure you have an Internet connection on your Ubuntu Server and it is up-to-date as well. Run the following commands to update/upgrade the list of available packages.

sudo apt update && sudo apt upgrade

1. Select Zabbix Version

Head down to zabbix.com/download and select the Zabbix Version, OS Distribution, OS Version, Database and Web Server. I will be using the following:

ZABBIX VERSIONOS DISTRIBUTIONOS VERSIONDATABASEWEB SERVER
5.0 LTSUbuntu20.04 (Focal)MySQLApache

Perform the first step and Install the Zabbix repository. In my case, it is Zabbix 5.0 and it could be different when you are following this blog.

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

Once the repository is downloaded, run the following command to install it.

dpkg -i zabbix-release_5.0-1+focal_all.deb

This is important, otherwise, you will run into problems. Update/Upgrade the installed packages with the following command.

sudo apt update && sudo apt upgrade

2. Install Zabbix Server, frontend, agent, and database

Now we will install Zabbix server, frontend, agent, and database. I have added additional bit mysql-server to the official Zabbix command because without that I could not run mysql_secure_installation command.

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

3. Check Versions

Check all the software versions you have installed. Here you can check the supported versions

MySQL server version

sudo mysql -V

Apache version

sudo apache2 -V

PHP Version

sudo php --version

4. Configure MySQL Server

This is again missing in the official documentation, let’s secure our MySQL server and give a password to the root user:

sudo mysql_secure_installation
  • yes or no, if you would like to install Validate Password Plugin (I said no for this in my lab environment)
  • The next part offers you to change the password for the root of MYSQL
  • The next option to remove anonymous users, I will say Yes 
  • The next option to stop root login remotely, I would go for no 
  • Reload privileges table: Yes 
  • You will see, “All done”, once it is all done 

5. Create an initial database and a user

Databasezabbix
Userzabbix
Passwordpassword

1. Let’s login to MySQL server and provide the MySQL root password which you entered in the previous step.

sudo mysql -u root -p

2. Create a database and name it zabbix.

create database zabbix character set utf8 collate utf8_bin;

3. Create a new user and name it zabbix. Also, pick a password for this user. We will need this password later on for Zabbix server config file.

create user zabbix@localhost identified by 'password';

4. Now grant permissions on zabbix database to user zabbix.

grant all privileges on zabbix.* to zabbix@localhost;

5. Once done, flush the privileges.

flush privileges;

6. Confirm privileges for user zabbix on database zabbix.

show GRANTS FOR 'zabbix'@'localhost';

7. Let’s get out of MySQL

quit;

6. Import initial schema and data.

In the previous step, we created a new database and user. Now we will utilize that database and import initial schema and data to that database. Run the following command and provide the password for the database user zabbix. Be patient with this command and it could take 5 to 30 seconds or more to finish.

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

Verify the schema is imported successfully to database zabbix.

  • In order to do that, we have to log in to MySQL server with MySQL user root and provide the password when prompted
sudo mysql -u root -p

  • Use database zabbix, where we imported initial schema and data
use zabbix;
  • So we are now in database zabbix. Let’s see the tables
show tables;
  • You should see the tables on the screen. Let’s get out of MySQL server
quit;

7. Update Zabbix Server Config file

Well! this file has a lot of stuff. We will update only one thing, however, this is the place where you tune up your Zabbix server. We will update the zabbix server password only. If you have used different zabbix database name, consider updating that as well.

sudo nano /etc/zabbix/zabbix_server.conf

Let’s find the keyword DBPassword
Hit Ctrl + W on your keyboard, type DBPassword, and then hit Enter on your keyboard. You should see #DBPassword. Update it as follows:

DBPassword=password

Once you have made the above change, then use the following on your keyboard to save the file:
Ctrl  + O and Ctrl + X

8. Configure PHP for Zabbix frontend

We will edit  /etc/zabbix/apache.conf file to update the timezone. Here is the list of timezones and find yours.

sudo nano  /etc/zabbix/apache.conf

Look for # php_value date.timezone Europe/Riga below PHP 7.0 configuration and update your timezone accordingly. Mine looks like this

php_value date.timezone Australia/Melbourne

Once you have made the above change, then use the following on your keyboard to save the file:
Ctrl  + O and Ctrl + X

9. Start Zabbix server and agent processes

Alright, now it is the time to start Zabbix server and agent. 

sudo systemctl restart zabbix-server zabbix-agent apache2

Let’s add Zabbix server and agent services to auto start at system boot

sudo systemctl enable zabbix-server zabbix-agent apache2

10. Configure Front End

All the hard work is done and now let’s finish it off through a web browser. Make sure your system can ping the Ubuntu server from where you are accessing the browser.

  1. Open your favourite browser and open Zabbix by typing the following:
    http://Your_IP_Address/zabbix

    In my case, it will look like http://10.0.0.8/zabbix. You should see the front end welcome screen.
  2. You will check of pre-requisites step and make sure everything is ok before proceeding further
  3. Provide the details of zabbix database we configured earlier and click on the next step
  4. Update the name, I will call it TEKNEX-NETMON01 and click on the next step
  5. Here you will see a summary of the settings which you selected and provided. Click next and finish

11. Login to Zabbix

The default credentials are as follows:
Username: Admin
Password: zabbix

Note: Username is case sensitive.

Well that is all. Let me know how did you go with your setup along with your current configuration (Ubuntu Version, MySQL Version, PHP Version and Apache Version)

Liked it? Take a second to support Jay Singh on Patreon!

About Jay Singh


Follow Me
Subscribe
Notify of
guest
54 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
fairy heryana
fairy heryana
3 years ago

Really helped me

dave
dave
3 years ago

Hi Jay,

thanks for great article. I installed the Zabbix on my home server, but there is a problem. In dashboard Zabbix says, that the server is not running. “Zabbix server is running: no”. Can you help me please?

Greetings

dave
dave
3 years ago
Reply to  Jay Singh

Hi Jay,

thank you for your reply, unfortunately it still does not work.

Greetings

dave
dave
3 years ago
Reply to  Jay Singh

This is what I am getting 4498:20201118:172120.350 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)  4498:20201118:172120.350 database is down: reconnecting in 10 seconds  4498:20201118:172130.352 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)  4498:20201118:172130.352 database is down: reconnecting in 10 seconds  4498:20201118:172140.353 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)  4498:20201118:172140.353 database is down: reconnecting in 10 seconds  4498:20201118:172150.355 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO) so I think there is a… Read more »

dave
dave
3 years ago
Reply to  Jay Singh

Hey Jay I think if the password would not be correct I would not be able to log into the dashboard. I have checked it and it is ok.

Screenshot 2020-11-19 203214.png
dave
dave
3 years ago
Reply to  Jay Singh

I can even create a new user, add host, etc. but it will not be monitored. I just went to Queue section inside of dashboard and Zabbix says:

  • Connection to Zabbix server “localhost” refused. Possible reasons:
  • 1. Incorrect server IP/DNS in the “zabbix.conf.php”;
  • 2. Security environment (for example, SELinux) is blocking the connection;
  • 3. Zabbix server daemon not running;
  • 4. Firewall is blocking TCP connection.
  • Connection refused

Google says that I should replace localhost with ip address of the device, but even after I am doing it, it does not work.

Hamish A
Hamish A
3 years ago

Installed by following this blog and it all worked. Thank you for all the commands.

weiju
weiju
3 years ago

谢谢你,我从youtube上看了你的视频,然后来到你的blog,我参考了很多人的安装文档结果都失败了;最后发现你写得这个文档,补充了zabbix官方不足,我也顺利成功安装了。作为中国人谢谢你。

Amol
Amol
3 years ago

Great article really helped me. One thing though, I think it is best not to use the same variable for everything. Like your DB name and user name are the same. In commands, you never know when you are referring to the DB or username. If it was like zabbixdb and zabbixuser things will be much clearer.

Last edited 3 years ago by Amol
Pavithran S
Pavithran S
3 years ago

Its showing Zabbix server not running.
i am using Ubuntu 20.04 and zabbix version 5.2.
why the zabbix server not running.

veera
veera
3 years ago
Reply to  Pavithran S

check status of zabbix
using below cmd
systemctl status zabbix-server

Last edited 3 years ago by veera
ZAIN
ZAIN
2 years ago
Reply to  veera

Same issue and status is below.

root@zabbix-OptiPlex-3050:/home/zabbix# systemctl status zabbix-server
● zabbix-server.service – Zabbix Server
    Loaded: loaded (/lib/systemd/system/zabbix-server.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Fri 2021-08-06 06:45:41 GMT; 2s ago
   Process: 3693 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
  Main PID: 3695 (code=exited, status=1/FAILURE)

shah
shah
2 years ago

root@shah-zabbix:/home/shah# sudo zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbix -p zabbix
Enter password: gzip: /usr/share/doc/zabbix-server-mysql*/create.sql.gz: No such file or directory

Nischal
Nischal
2 years ago
Reply to  Jay Singh

What to do ? If this isn’t available?

Jesus A
Jesus A
2 months ago
Reply to  Jay Singh

I have the same issue:

root@helen2srvlnx01:/usr/share/doc# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:   Ubuntu 22.04.4 LTS
Release:       22.04
Codename:      jammy

root@helen2srvlnx01:/usr/share/doc# sudo zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u helen2 -p zabbixdt
Enter password: gzip: /usr/share/doc/zabbix-server-mysql/create.sql.gz: No such file or directory

root@helen2srvlnx01:/usr/share/doc#

Michael
Michael
2 years ago

How to install without the database for those who have already a database installed in their server?

Michael
Michael
2 years ago
Reply to  Jay Singh

I mean i have a server that has already installed MySql and i want in the same server to install also Zabbix

But the command is

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

can i opt out the zabbix-server-mysql?

Thanks.

John
John
2 years ago

sudo zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -u zabbix -p zabbix

For zabbix 5.4 the path to the create.sql.gz did change

Rob
Rob
2 years ago
Reply to  Jay Singh

phew…I spent an hour trying to figure out why that didn’t work. raced down here to the comments to add the solution only to find this! doh!

Vedant Agrawal
2 years ago
Reply to  John

root@zabbix:~# sudo zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -u zabbix -p zabbix
Enter password: gzip: /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz: No such file or directory

this is the error I’m getting mate on the 6th step when trying to update database any leads how can I fix it ?

Vedant Agrawal
2 years ago
Reply to  Jay Singh

It doesnt

Abdel
Abdel
2 years ago
Reply to  Jay Singh

The file doenst exist in zabbix 5.4. I have the same issue, did you find a fix for it?

Abdel
Abdel
2 years ago
Reply to  Abdel

I had the same issue. What helped for me is installation of zabbix 5.0 instead of 5.4. Mysql and PHP versions i used the most recent once. When you depackage dpkg the file in step 1 and after the apt update && apt upgrade, check if you have the create.sql.gz file by using cd /usr/share/doc/zabbix-server-mysql then hit Enter and ls. If you can find it just continue Jay’s tutorial.

ivandro
ivandro
2 years ago
Reply to  John

hi John

Wich is the new path ?

Vedant Agrawal
2 years ago

 gzip: /usr/share/doc/zabbix-server-mysql*/create.sql.gz: No such file or directory
getting this error man on the 7th step when trying to update schema

Joe Haney
Joe Haney
2 years ago

I have tried this install with 3 different tutorials and 4 fresh installs of Ubuntu but keep getting the error on the final page of the Web Setup:

Cannot create the configuration file
Alternatively, you can install it manually:

  1. Download the configuration file
  2. Save it as “/usr/share/zabbix/conf/zabbix.conf.php”

I have tried to download the file and add it to the server but receive a permission denied error. Could you advise?

abdel
abdel
2 years ago
Reply to  Joe Haney

This is a permission error. I connected to my zabbix server through Putty and through WinSCP. Through putty i changed pemissions on that file with chown. After i deleted the old zabbix.conf.php file in WINSCP and replaced it with the one I donwloaded.

ivandro
ivandro
2 years ago
Reply to  Jay Singh

Hi Jay

Did you already post for Zabbix 5.4 installation ?

ZAIN TAHIR
ZAIN TAHIR
2 years ago

I am following all your steps but I got an error on multiple attempts.” Please create a database manually, and set the configuration parameters for connection to this database”. Press the “Next step” button when done. Cannot connect to the database

Kindly help. Thanks

Capture.PNG
Albait
Albait
2 years ago

Hay Jay,
hi jay,
please help with my problem?
I have a problem while installing zabbix in the last step, can’t create the configuration file.
Thankyou

Natasha
Natasha
2 years ago

Hi! Can I also follow this tutorial for my Ubuntu 20.04 server with Plesk administration? I tried it once with another tutorial, but it didn’t work out. (Couldn’t access the frontend) So maybe someone has experience with it?

shiham
shiham
2 years ago
Reply to  Natasha

yes this is the best guide, follow step by step

alejandro
alejandro
2 years ago

SUPERRRRR GRACIAS TOTALES
likeYouTube Video!!!

Devashish
Devashish
2 years ago

Please help me. I am new here. so i m worried about failure of zabbix installation. After installation of LAMP server, Zabbix server , i failed to procced on Zabbix frontend site. It says “Unable to determine current Zabbix database version: the table “dbversion” was not found.” Please help to fix.

omri
omri
2 years ago
Reply to  Jay Singh

Jay, i am facing the same bug, and it does not worked for me. (Ubuntu 64, MySQL)

kailuo
kailuo
2 years ago

Can not open the browser with http://10.0.0.8/zbbix
thank you

ilhan
ilhan
2 years ago

I read so many videos and blogs, I always understood that it was incomplete or wrong.

I followed step by step what you wrote.

Result : Successful

Thank you very much 🙂

Dandy160
Dandy160
1 year ago

Great tutorial just a small update if some users still have issue with the Database Schema import.

In some recent releases the schema import file name has changed to server.sql.gz so swap the file name in the command use that. “# zcat /usr/share/doc/zabbix-server-mysql/server.sql.gz | mysql -uzabbix -p zabbix” instead of “# zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix”

54
0
Would love your thoughts, please comment.x
()
x