{"id":51,"date":"2023-09-28T21:55:05","date_gmt":"2023-09-28T14:55:05","guid":{"rendered":"http:\/\/nitirat.ddns.net\/wordpress\/?p=51"},"modified":"2024-05-07T21:24:59","modified_gmt":"2024-05-07T14:24:59","slug":"how-to-install-zabbix-monitoring-server-on-ubuntu-20-04","status":"publish","type":"post","link":"http:\/\/nitirat.ddns.net\/wordpress\/?p=51","title":{"rendered":"How to Install Zabbix Monitoring Server on Ubuntu 20.04"},"content":{"rendered":"\n<p>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.<\/p>\n\n\n\n<p>In this tutorial, we will explain how to install the Zabbix monitoring server on Ubuntu 20.04.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A fresh Alibaba Cloud instance with Ubuntu 18.04 installed.<\/li>\n\n\n\n<li>A root password is set up to your instance.<\/li>\n<\/ul>\n\n\n\n<p><a href=\"https:\/\/www.alibabacloud.com\/help\/doc-detail\/25424.htm\" target=\"_blank\" rel=\"noreferrer noopener\">Create a new ECS instance<\/a>&nbsp;and&nbsp;<a href=\"https:\/\/www.alibabacloud.com\/help\/doc-detail\/25434.htm\" target=\"_blank\" rel=\"noreferrer noopener\">connect to your instance<\/a>&nbsp;as the root user.<\/p>\n\n\n\n<p>Once you are logged into your Ubuntu 18.04 instance, run the following command to update your base system with the latest available packages.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get update -y\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1 \u2013 Install LAMP Server<\/h2>\n\n\n\n<p>First, install the Apache, MariaDB, PHP and other required extensions with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>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<\/code><\/pre>\n\n\n\n<p>Once all the packages are installed, edit the php.ini file and make some changes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/php\/7.4\/apache2\/php.ini<\/code><\/pre>\n\n\n\n<p>Change the following settings:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>memory_limit 256M\nupload_max_filesize 16M\npost_max_size 16M\nmax_execution_time 300\nmax_input_time 300\nmax_input_vars 10000\ndate.timezone = Asia\/Kolkata<\/code><\/pre>\n\n\n\n<p>Save and close the file then restart the Apache service to apply the changes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart apache2<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2 \u2013 Create a Database for Zabbix<\/h2>\n\n\n\n<p>Next, you will need to create a database and user for Zabbix. First, log into the MariaDB shell with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql<\/code><\/pre>\n\n\n\n<p>Once login, create a database and user with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE DATABASE zabbixdb character set utf8 collate utf8_bin;\nCREATE USER 'zabbixuser'@'localhost' IDENTIFIED BY 'password';<\/code><\/pre>\n\n\n\n<p>Next, grant all the privileges to the zabbixdb with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GRANT ALL PRIVILEGES ON zabbixdb.* TO 'zabbixuser'@'localhost' WITH GRANT OPTION;<\/code><\/pre>\n\n\n\n<p>Next, flush the privileges and exit from the MariaDB shell with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FLUSH PRIVILEGES;\nEXIT;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3 \u2013 Install and Configure Zabbix<\/h2>\n\n\n\n<p>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:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/repo.zabbix.com\/zabbix\/5.0\/ubuntu\/pool\/main\/z\/zabbix-release\/zabbix-release_5.0-1+focal_all.deb\ndpkg -i zabbix-release_5.0-1+focal_all.deb<\/code><\/pre>\n\n\n\n<p>Next, update the repository and install the Zabbix server with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get update -y\napt-get install zabbix-server-mysql zabbix-frontend-php zabbix-agent zabbix-apache-conf -y<\/code><\/pre>\n\n\n\n<p>Once all the packages are installed, start the Zabbix service and enable it to start at system reboot with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start zabbix-server\nsystemctl enable zabbix-server<\/code><\/pre>\n\n\n\n<p>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.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/usr\/share\/doc\/zabbix-server-mysql\nzcat create.sql.gz | mysql -u zabbixuser -p zabbixdb<\/code><\/pre>\n\n\n\n<p>Note: The zcat command can take several minutes to complete<\/p>\n\n\n\n<p>Next, edit the Zabbix default configuration file and define the database settings:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/zabbix\/zabbix_server.conf<\/code><\/pre>\n\n\n\n<p>Change the following lines:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  DBHost=localhost\n  DBName=zabbixdb\n  DBUser=zabbixuser\n  DBPassword=password<\/code><\/pre>\n\n\n\n<p>Note: You will need to uncomment # DBHost and DBPassword<\/p>\n\n\n\n<p>Save and close the file then restart the Zabbix and Apache service with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart zabbix-server\nsystemctl restart apache2<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4 \u2013 Configure Zabbix Agent<\/h2>\n\n\n\n<p>Next, you will also need to configure Zabbix agent in your system. You can configure it by editing the file zabbix_agentd.conf:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/zabbix\/zabbix_agentd.conf<\/code><\/pre>\n\n\n\n<p>Change the following lines:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Server = 127.0.0.1\nServerActive = 127.0.0.1\nHostname = Zabbix Server<\/code><\/pre>\n\n\n\n<p>Save and close the file then start the Zabbix agent service and enable it to start at boot with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start zabbix-agent\nsystemctl enable zabbix-agent<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5 \u2013 Access Zabbix Dashboard<\/h2>\n\n\n\n<p>Now, open your web browser and access the Zabbix dashboard using the URL&nbsp;<a href=\"http:\/\/your-server-ip\/zabbix.\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/your-server-ip\/zabbix.<\/a>&nbsp;You will be redirected to the Zabbix welcome page:<br><img decoding=\"async\" src=\"https:\/\/yqintl.alicdn.com\/83b6f798a9dbd5386b682eacc4f2652bc95b8c21.png\" alt=\"image1\"><\/p>\n\n\n\n<p>Click on the Next step button. You should get the following page:<br><img decoding=\"async\" src=\"https:\/\/yqintl.alicdn.com\/5be50090c28f351015bff73ee02c79d09b59bc19.png\" alt=\"image2\"><\/p>\n\n\n\n<p>Make sure all the required PHP extensions are installed then click on the Next step button. You should see the following page:<br><img decoding=\"async\" src=\"https:\/\/yqintl.alicdn.com\/cae77aa6e84d87889fd5e67806cfc6815e2a2b89.png\" alt=\"image3\"><\/p>\n\n\n\n<p>Provide your database details and click on the Next step button. You should see the following page:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/yqintl.alicdn.com\/d6a829687c8a3e5436acb4a17dcd0aec8d971fcd.png\" alt=\"image4\" title=\"image4\"\/><\/figure>\n\n\n\n<p>Provide your Zabbix server details and click on the Next step button.<br><img decoding=\"async\" src=\"https:\/\/yqintl.alicdn.com\/be6dc807c50b72cc059297102358eb67811f50be.png\" alt=\"image5\"><\/p>\n\n\n\n<p>Next, confirm all configurations and click on the Next step button. Once the installation has been completed, you should see the following page:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/yqintl.alicdn.com\/8d4a3796529ccb92881ff64a2d45bde77cd7fa87.png\" alt=\"image6\" title=\"image6\"\/><\/figure>\n\n\n\n<p>Click on the Finish button. You will be redirected to the Zabbix login page:<br><img decoding=\"async\" src=\"https:\/\/yqintl.alicdn.com\/af9e0098820588d527e0d69f9c023a3db8344bbf.png\" alt=\"image7\"><\/p>\n\n\n\n<p>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:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/192.168.1.110\/wordpress\/wp-content\/uploads\/2021\/08\/zabbix-1024x533.png\" alt=\"\" class=\"wp-image-21\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":119,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"categories":[6],"tags":[],"class_list":["post-51","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu"],"_links":{"self":[{"href":"http:\/\/nitirat.ddns.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/51","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nitirat.ddns.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nitirat.ddns.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nitirat.ddns.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nitirat.ddns.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=51"}],"version-history":[{"count":1,"href":"http:\/\/nitirat.ddns.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/51\/revisions"}],"predecessor-version":[{"id":52,"href":"http:\/\/nitirat.ddns.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/51\/revisions\/52"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/nitirat.ddns.net\/wordpress\/index.php?rest_route=\/wp\/v2\/media\/119"}],"wp:attachment":[{"href":"http:\/\/nitirat.ddns.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nitirat.ddns.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nitirat.ddns.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}