Zabbix is a mature open-source infrastructure monitoring platform that collects metrics from network devices, servers, virtual machines, and applications. It supports both agent-based monitoring and agent-less monitoring via SNMP, IPMI, and JMX. The Zabbix agent is lightweight and runs on Linux, UNIX, macOS, and Windows.
This guide covers how to install Zabbix on Ubuntu 18.04 using MySQL as the database backend. It also covers installing the Zabbix agent on a remote host with PSK encryption and registering that host in the Zabbix web interface.
<strong>Prerequisite:</strong> You need sudo access and MySQL already installed on your server.
Create the Zabbix database. Log in to MySQL and create the database using utf8_bin collation. Binary collation is case-sensitive, which Zabbix requires for its internal schema:
bashsudo mysql
sqlCREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;GRANT ALL ON zabbix.* TO 'zabbix'@'localhost' IDENTIFIED BY 'change-with-strong-password';EXIT;
Add the official Zabbix repository. The Ubuntu repositories ship outdated Zabbix versions. Install the Zabbix 4.0 repo package and update the package index:
bashwget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.debsudo apt install ./zabbix-release_4.0-2+bionic_all.debsudo apt updatesudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent
This installs the Zabbix server, the PHP web frontend, and the local agent. It also pulls in Apache and the required PHP modules automatically.
Set the PHP timezone. Open /etc/apache2/conf-enabled/zabbix.conf and set the date.timezone value to your time zone. Leaving the line commented out causes the Zabbix frontend prerequisites check to fail. After editing, restart Apache:
bashsudo systemctl restart apache2
Import the database schema. The Zabbix package includes a compressed SQL dump with the initial schema and data:
bashzcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
Enter the zabbix database user password when prompted.
Set the database password in the Zabbix config. Open /etc/zabbix/zabbix_server.conf, find the DBPassword directive, uncomment it, and add the database password you created earlier. Start and enable both services:
bashsudo systemctl restart zabbix-server zabbix-agentsudo systemctl enable zabbix-server zabbix-agent
Complete the web setup wizard. Open http://your_domain_or_ip/zabbix in a browser. The wizard steps through:
zabbix database name, username, and passwordAfter completing setup, log in with the defaults: username Admin, password zabbix. Change this password immediately from the user profile page.
On the remote host you want to monitor, install the Zabbix 4.0 agent:
bashwget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.debsudo apt install ./zabbix-release_4.0-2+bionic_all.debsudo apt update && sudo apt install zabbix-agent
Generate a PSK key to encrypt all communication between the agent and server:
bashopenssl rand -hex 32 | sudo tee /etc/zabbix/zabbix_agentd.psk
Edit /etc/zabbix/zabbix_agentd.conf and set the following directives:
Server= — your Zabbix server IP addressTLSConnect=psk and TLSAccept=pskTLSPSKIdentity=PSK 001TLSPSKFile=/etc/zabbix/zabbix_agentd.pskStart the agent, enable it at boot, and open the Zabbix agent port:
bashsudo systemctl start zabbix-agentsudo systemctl enable zabbix-agentsudo ufw allow proto tcp from <zabbix_server_ip> to any port 10050
Port 10050 is the default TCP port the Zabbix server uses to poll agents. Restricting UFW access to only the Zabbix server IP prevents unauthorized polling attempts.
Register the host in the Zabbix web interface. Go to Configuration > Hosts > Create host. Enter the hostname and IP address, assign the host to the Linux Servers group, and add the Template OS Linux template on the Templates tab. Switch to the Encryption tab, select PSK for both connection directions, set the PSK identity to PSK 001, and paste the key from /etc/zabbix/zabbix_agentd.psk into the PSK value field. Click Add to save.
Zabbix 4.0 is now monitoring your Ubuntu 18.04 server and collecting data from the remote agent. Explore the dashboards, configure triggers for alert thresholds, and add notification actions for email or Slack. Leave a comment below if you run into any issues.
phpMyAdmin is a free, open-source PHP application that provides a browser-based interface for managing MySQL and…
Gradle is a powerful open-source build automation tool used primarily for Java, Kotlin, Groovy, and Android…
TeamViewer is a proprietary cross-platform remote access application for remote control, desktop sharing, file transfer, and online meetings. It is one of the most widely used remote support tools in the world, available for Windows, macOS, Linux, iOS, and Android. TeamViewer is not included in the Ubuntu repositories because it is proprietary software. This guide covers how to install TeamViewer on Ubuntu 18.04 using the official .deb package. The same steps apply to Ubuntu 16.04, Debian, Linux Mint, and Elementary OS. <strong>Prerequisite:</strong> You need sudo access. Install TeamViewer on Ubuntu: Download the .deb Package Download the official TeamViewer .deb package. The _amd64.deb suffix indicates this package is for 64-bit x86-64 systems. For ARM-based machines, download the appropriate package from the TeamViewer Linux downloads page: bashwget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb Install the package using apt. The ./ prefix tells apt this is a local file path, not a package name from the repositories:…
Nagios is one of the most widely used open-source infrastructure monitoring systems in the world. It…
Laravel is an open-source PHP web application framework built around an expressive, developer-friendly syntax. It is…
Kodi (formerly XBMC, short for Xbox Media Center) is a free, open-source, cross-platform media player and…