Zabbix is an open-source monitoring solution for networks, servers, and applications. It offers comprehensive monitoring features and allows you to set up alerting and visualization tools to keep your infrastructure in check. This guide will walk you through installing Zabbix on Ubuntu 20.04 LTS. Whether you're hosting on a local machine or a Windows VPS UK, Zabbix helps you maintain reliable infrastructure monitoring.
Step 1: Update Your System
Before installing Zabbix, make sure your Ubuntu system is up to date. Run the following commands to update the package list and upgrade installed packages:
sudo apt update && sudo apt upgrade -y
Regular system updates are critical for security and performance, particularly when hosting on platforms like VPS Windows Servers.
Step 2: Install and Configure MySQL
Zabbix requires a database for storing monitoring data. Install MySQL (or MariaDB) using the following command:
sudo apt install mysql-server -y
Once installed, secure the MySQL installation by running:
sudo mysql_secure_installation
Log in to MySQL and create the Zabbix database and user:
sudo mysql -u root -p
Run the following SQL commands to set up the database:
CREATE DATABASE zabbix CHARACTER SET utf8 collate utf8_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Replace your_password
with a strong password of your choice.
Step 3: Install Zabbix Repository and Server
Add the Zabbix repository to your system to install the latest version. Run the following commands:
wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb
sudo dpkg -i zabbix-release_5.0-1+focal_all.deb
sudo apt update
Now install the Zabbix server, frontend, and agent:
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent -y
Step 4: Configure Zabbix Server
Import the initial schema and data into the Zabbix database:
sudo zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u zabbix -p zabbix
Next, configure the Zabbix server to connect to the database by editing the configuration file:
sudo nano /etc/zabbix/zabbix_server.conf
Update the following lines with the Zabbix database information:
DBName=zabbix
DBUser=zabbix
DBPassword=your_password
Save and close the file.
Step 5: Configure PHP for Zabbix Frontend
Zabbix uses PHP for its frontend. Edit the PHP configuration file to set the required time zone:
sudo nano /etc/zabbix/apache.conf
Uncomment and set the time zone, for example:
php_value date.timezone Europe/London
Save the file and restart Apache to apply the changes:
sudo systemctl restart apache2
Step 6: Start Zabbix Server and Agent
Start the Zabbix server and agent, and enable them to start at boot:
sudo systemctl start zabbix-server zabbix-agent
sudo systemctl enable zabbix-server zabbix-agent
You can check the status of the services using the following command:
sudo systemctl status zabbix-server zabbix-agent
Step 7: Access Zabbix Web Interface
Open your web browser and navigate to http://your_server_ip/zabbix
. You will be prompted to complete the Zabbix web installation.
Use the database information and set up the Zabbix frontend. The default login credentials are:
Username: Admin
Password: zabbix
Step 8: Secure Zabbix with SSL (Optional)
To secure your Zabbix instance with HTTPS, you can use Let’s Encrypt SSL certificates. First, install Certbot:
sudo apt install certbot python3-certbot-apache -y
Run Certbot to obtain and install the SSL certificate:
sudo certbot --apache -d yourdomain.com -d www.yourdomain.com
Follow the prompts to secure your Zabbix instance with HTTPS.