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 name | Release date | End of Full Support | End of Limited Support |
Zabbix 5.4 | May 17, 2021 | Nov 30, 2021 | Dec 31, 2021 |
Zabbix 5.2 | Oct 27, 2021 | Jul 31, 2021 | Jul 31, 2021 |
Zabbix 5.0 LTS | May 12, 2020 | May 31, 2023 | May 31, 2025 |
Zabbix 4.0 LTS | October 1, 2018 | October 31, 2021 | October 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
Table of Contents
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 VERSION | OS DISTRIBUTION | OS VERSION | DATABASE | WEB SERVER |
5.0 LTS | Ubuntu | 20.04 (Focal) | MySQL | Apache |
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
Database | zabbix |
User | zabbix |
Password | password |
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.
- 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. - You will check of pre-requisites step and make sure everything is ok before proceeding further
- Provide the details of zabbix database we configured earlier and click on the next step
- Update the name, I will call it TEKNEX-NETMON01 and click on the next step
- 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)
fairy heryana
October 27, 2020 @ 9:04 pm
Really helped me
Jay Singh
October 28, 2020 @ 1:05 pm
Sounds great 😀
dave
November 15, 2020 @ 5:31 am
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
Jay Singh
November 16, 2020 @ 1:33 pm
Hi Dave,
Try performing this step https://blog.masteringmdm.com/zabbix-installation-on-ubuntu-server/#9_Start_Zabbix_server_and_agent_processes again and check the status of Zabbix server.
Jay
dave
November 17, 2020 @ 6:02 am
Hi Jay,
thank you for your reply, unfortunately it still does not work.
Greetings
Jay Singh
November 17, 2020 @ 11:22 am
Check Zabbix Server log file. It is located here
/var/log/zabbix/zabbix-server.log
.Jay
dave
November 19, 2020 @ 3:53 am
This is what I am getting
so I think there is a problem with password/access? I have followed your tutorial.
btw. in your article, this:
didn’t work for me. I had to provide
Jay Singh
November 19, 2020 @ 10:29 am
I have fixed the “use zabbix;” to select the DB.
The error shows either you have the wrong password configured or set in the Zabbix configuration. You can confirm the permissions with the step number 6 on this section https://blog.masteringmdm.com/zabbix-installation-on-ubuntu-server/#5_Create_an_initial_database_and_a_user. I added that step just now.
You should see something like this:
mysql> Show GRANTS FOR ‘zabbix’@’localhost’;
+————————————————————+
| Grants for zabbix@localhost |
+————————————————————+
| GRANT USAGE ON *.* TO `zabbix`@`localhost` |
| GRANT ALL PRIVILEGES ON `zabbix`.* TO `zabbix`@`localhost` |
+————————————————————+
2 rows in set (0.00 sec)
If the permissions are correct, then it would be the password in the Zabbix server conf file.
Jay
dave
November 20, 2020 @ 6:02 am
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.
dave
November 20, 2020 @ 6:13 am
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:
Google says that I should replace localhost with ip address of the device, but even after I am doing it, it does not work.
Jay Singh
November 23, 2020 @ 11:52 am
Hi Dave,
It should not be the firewall unless you installed Zabbix on customised Linux OS. By default, the firewall allows Zabbix traffic flow on the intranet.
Jay
Hamish A
November 26, 2020 @ 5:31 am
Installed by following this blog and it all worked. Thank you for all the commands.
weiju
December 27, 2020 @ 10:20 pm
谢谢你,我从youtube上看了你的视频,然后来到你的blog,我参考了很多人的安装文档结果都失败了;最后发现你写得这个文档,补充了zabbix官方不足,我也顺利成功安装了。作为中国人谢谢你。
Jay Singh
January 3, 2021 @ 4:27 pm
You are very welcome. I am glad you find this post helpful.
Amol
January 6, 2021 @ 1:26 pm
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.
Jay Singh
January 8, 2021 @ 9:51 am
Thank you.
I agree with you on the naming convention. I haven’t used the best naming convention for the tutorial just to keep things super simple.
Pavithran S
February 15, 2021 @ 6:53 pm
Its showing Zabbix server not running.
i am using Ubuntu 20.04 and zabbix version 5.2.
why the zabbix server not running.
veera
March 30, 2021 @ 8:19 pm
check status of zabbix
using below cmd
systemctl status zabbix-server
ZAIN
August 6, 2021 @ 5:17 pm
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
May 16, 2021 @ 12:04 pm
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
Jay Singh
May 17, 2021 @ 11:37 pm
Go this path
cd /usr/share/doc/zabbix-server-mysql/
and check whether create.sql.gz is available on the disk or not by usingls
.Nischal
July 28, 2021 @ 4:48 pm
What to do ? If this isn’t available?
Jesus A
February 18, 2024 @ 7:52 am
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
May 20, 2021 @ 1:34 am
How to install without the database for those who have already a database installed in their server?
Jay Singh
May 20, 2021 @ 1:48 pm
Create the database for Zabbix on your existing database server and ensure it is reachable from Zabbix server.
Michael
May 20, 2021 @ 4:51 pm
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
May 31, 2021 @ 6:50 am
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
Jay Singh
May 31, 2021 @ 6:15 pm
Thanks for the update John. I have added a comment for now and will update the command as well.
Rob
August 11, 2021 @ 11:35 am
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
June 1, 2021 @ 9:00 pm
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 ?
Jay Singh
June 2, 2021 @ 5:12 pm
Hi Vedant,
I have not tested this myself yet.
Could you check whether create.sql.gz exists under /usr/share/doc/zabbix-sql-scripts/mysql/ or not?
Vedant Agrawal
June 4, 2021 @ 8:47 pm
It doesnt
Abdel
July 1, 2021 @ 7:42 pm
The file doenst exist in zabbix 5.4. I have the same issue, did you find a fix for it?
Abdel
July 6, 2021 @ 9:57 pm
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
August 27, 2021 @ 10:42 pm
hi John
Wich is the new path ?
Vedant Agrawal
June 1, 2021 @ 5:54 pm
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
July 2, 2021 @ 6:25 am
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:
I have tried to download the file and add it to the server but receive a permission denied error. Could you advise?
abdel
July 6, 2021 @ 10:08 pm
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.
Jay Singh
July 8, 2021 @ 6:03 pm
Edit: This is just permissions issue. Apache user/group does not have write permissions on /usr/share/zabbix/conf/. You need to manually provide read/write permissions and it should work. I have tested in my lab and will add a new post for Zabbix 5.4 installation.
ivandro
August 27, 2021 @ 10:37 pm
Hi Jay
Did you already post for Zabbix 5.4 installation ?
ZAIN TAHIR
August 6, 2021 @ 4:51 pm
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
Albait
August 22, 2021 @ 8:38 pm
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
Jay Singh
August 23, 2021 @ 5:01 pm
What version of Zabbix are you installing?
Natasha
August 27, 2021 @ 8:07 am
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
September 9, 2021 @ 2:29 am
yes this is the best guide, follow step by step
alejandro
September 9, 2021 @ 3:44 am
SUPERRRRR GRACIAS TOTALES
likeYouTube Video!!!
Devashish
October 13, 2021 @ 8:34 pm
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.
Jay Singh
October 15, 2021 @ 3:18 pm
Drop the Zabbix DB and import the schema again.
omri
October 23, 2021 @ 8:24 pm
Jay, i am facing the same bug, and it does not worked for me. (Ubuntu 64, MySQL)
Jay Singh
October 24, 2021 @ 6:15 pm
I have tested and it works for me.
kailuo
December 12, 2021 @ 6:41 pm
Can not open the browser with http://10.0.0.8/zbbix
thank you
Jay Singh
December 13, 2021 @ 6:44 am
It is your_ip_address/zabbix. Zabbix with a in it. If your IP is 10.0.0.8, then the link will be http://10.0.0.8/zabbix.
ilhan
January 29, 2022 @ 8:30 am
Dandy160
May 7, 2022 @ 3:55 pm
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”