By Hitesh Jethva, Alibaba Cloud Community Blog author.
Zabbix is a free, open-source, and high-performance monitoring tool for servers, applications, and network devices. It uses agents to collect system metrics. It also monitors standard services such as SMTP or HTTP services and supports host monitoring via SNMP, TCP, and ICMP checks. It is designed for real-time monitoring of thousands of servers, VMs, and network devices. It uses MySQL/MariaDB database to store its data and also supports encrypted communication between the server and connected clients.
In this tutorial, we will explain how to install the Zabbix monitoring server on Ubuntu 20.04.
Create a new ECS instance and connect to your instance as the root user.
Once you are logged into your Ubuntu 18.04 instance, run the following command to update your base system with the latest available packages.
apt-get update -y
First, install the Apache, MariaDB, PHP and other required extensions with the following command:
apt-get install apache2 libapache2-mod-php mariadb-server php php-mbstring php-gd php-xml php-bcmath php-ldap php-mysql unzip curl gnupg2 -y
Once all the packages are installed, edit the php.ini file and make some changes:
nano /etc/php/7.4/apache2/php.ini
Change the following settings:
memory_limit 256M
upload_max_filesize 16M
post_max_size 16M
max_execution_time 300
max_input_time 300
max_input_vars 10000
date.timezone = Asia/Kolkata
Save and close the file then restart the Apache service to apply the changes:
systemctl restart apache2
Next, you will need to create a database and user for Zabbix. First, log into the MariaDB shell with the following command:
mysql
Once login, create a database and user with the following command:
CREATE DATABASE zabbixdb character set utf8 collate utf8_bin;
CREATE USER 'zabbixuser'@'localhost' IDENTIFIED BY 'password';
Next, grant all the privileges to the zabbixdb with the following command:
GRANT ALL PRIVILEGES ON zabbixdb.* TO 'zabbixuser'@'localhost' WITH GRANT OPTION;
Next, flush the privileges and exit from the MariaDB shell with the following command:
FLUSH PRIVILEGES;
EXIT;
By default, Zabbix is not available in the Ubuntu 20.04 standard repository. So you will need to install Zabbix repository in your system. You can install it with the following command:
wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb
dpkg -i zabbix-release_5.0-1+focal_all.deb
Next, update the repository and install the Zabbix server with the following command:
apt-get update -y
apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-agent zabbix-apache-conf -y
Once all the packages are installed, start the Zabbix service and enable it to start at system reboot with the following command:
systemctl start zabbix-server
systemctl enable zabbix-server
Next, you will need to import the Zabbix database schema. You can import it with the following command, please note you will be prompted for the MySQL password created earlier.
cd /usr/share/doc/zabbix-server-mysql
zcat create.sql.gz | mysql -u zabbixuser -p zabbixdb
Note: The zcat command can take several minutes to complete
Next, edit the Zabbix default configuration file and define the database settings:
nano /etc/zabbix/zabbix_server.conf
Change the following lines:
DBHost=localhost
DBName=zabbixdb
DBUser=zabbixuser
DBPassword=password
Note: You will need to uncomment # DBHost and DBPassword
Save and close the file then restart the Zabbix and Apache service with the following command:
systemctl restart zabbix-server
systemctl restart apache2
Next, you will also need to configure Zabbix agent in your system. You can configure it by editing the file zabbix_agentd.conf:
nano /etc/zabbix/zabbix_agentd.conf
Change the following lines:
Server = 127.0.0.1
ServerActive = 127.0.0.1
Hostname = Zabbix Server
Save and close the file then start the Zabbix agent service and enable it to start at boot with the following command:
systemctl start zabbix-agent
systemctl enable zabbix-agent
Now, open your web browser and access the Zabbix dashboard using the URL http://your-server-ip/zabbix. You will be redirected to the Zabbix welcome page:
Click on the Next step button. You should get the following page:
Make sure all the required PHP extensions are installed then click on the Next step button. You should see the following page:
Provide your database details and click on the Next step button. You should see the following page:
Provide your Zabbix server details and click on the Next step button.
Next, confirm all configurations and click on the Next step button. Once the installation has been completed, you should see the following page:
Click on the Finish button. You will be redirected to the Zabbix login page:
Provide the default username as Admin and password as Zabbix then click on the Sign-in button. You should see the Zabbix dashboard in the following page:
Congratulations! you have successfully installed and configured the Zabbix monitoring server on Ubuntu 20.04. You can now install Zabbix agents on more client systems and start monitoring them from the Zabbix dashboard.
I hope you can now easily deploy the Zabbix monitoring server on the Cloud Environment and start monitoring servers.
How to Archive VM Backups on Alibaba Cloud with Simple 4 Steps?
39 posts | 4 followers
FollowAlibaba Clouder - September 30, 2017
Alibaba Clouder - May 7, 2019
Alibaba Clouder - May 8, 2019
Alibaba Clouder - May 10, 2019
Alibaba Clouder - May 9, 2019
Arman Ali - June 1, 2021
39 posts | 4 followers
FollowMulti-source metrics are aggregated to monitor the status of your business and services in real time.
Learn MoreBuild business monitoring capabilities with real time response based on frontend monitoring, application monitoring, and custom business monitoring capabilities
Learn MoreOrganize and manage your resources in a hierarchical manner by using resource directories, folders, accounts, and resource groups.
Learn MoreAutomate performance monitoring of all your web resources and applications in real-time
Learn MoreMore Posts by Hiteshjethva
Arman Ali June 1, 2021 at 7:27 am
Hey Hitesh,Thanks for sharing this article.