How to install Zabbix on Alpine Linux Latest

In this tutorial, we will walk you through the step-by-step process of installing Zabbix on Alpine Linux Latest.

Prerequisites

Step 1: Updating the system

Start by updating your system with the latest package repositories and software updates.

apk update && apk upgrade

Step 2: Installing required packages

Before installing Zabbix, we need to install some required packages:

apk add nginx php7 php7-fpm php7-curl php7-pdo_mysql php7-opcache php7-gd php7-json php7-xml php7-ctype php7-mbstring php7-iconv php7-zlib php7-zip mariadb mariadb-client mariadb-server-utils

Step 3: Installing Zabbix

We can now proceed to install Zabbix by following the following steps:

  1. Add the Zabbix repository and key to your system:
wget https://repo.zabbix.com/zabbix/5.4/alpine/edge/noarch/zabbix-openrc-5.4.1-r0.apk
wget https://repo.zabbix.com/zabbix/5.4/alpine/edge/noarch/zabbix-bash-completion-5.4.1-r0.apk
wget https://repo.zabbix.com/zabbix/5.4/alpine/edge/x86_64/zabbix-nginx-conf-5.4.1-r0.apk
wget https://repo.zabbix.com/zabbix/5.4/alpine/edge/x86_64/zabbix-web-5.4.1-r0.apk
wget https://repo.zabbix.com/zabbix/5.4/alpine/edge/x86_64/zabbix-web-nginx-conf-5.4.1-r0.apk
wget https://repo.zabbix.com/zabbix/5.4/alpine/edge/x86_64/zabbix-agent-5.4.1-r0.apk
wget https://repo.zabbix.com/zabbix/5.4/alpine/edge/x86_64/zabbix-server-mysql-5.4.1-r0.apk
wget https://repo.zabbix.com/zabbix/5.4/alpine/edge/noarch/zabbix-mysql-conf-5.4.1-r0.apk

apk add --allow-untrusted zabbix-openrc-5.4.1-r0.apk zabbix-bash-completion-5.4.1-r0.apk zabbix-nginx-conf-5.4.1-r0.apk zabbix-web-5.4.1-r0.apk zabbix-web-nginx-conf-5.4.1-r0.apk zabbix-agent-5.4.1-r0.apk zabbix-server-mysql-5.4.1-r0.apk zabbix-mysql-conf-5.4.1-r0.apk
  1. Create the Zabbix database and user:
mysql -u root -p
CREATE DATABASE zabbix character set utf8 collate utf8_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
exit
  1. Import the Zabbix database schema:
zcat /usr/share/doc/zabbix-server-mysql-5.4.1/create.sql.gz | mysql -u zabbix -ppassword zabbix
  1. Edit the Zabbix server configuration file /etc/zabbix/zabbix_server.conf and make the following changes:
DBName=zabbix
DBUser=zabbix
DBPassword=password
  1. Likewise, update the database information in the Zabbix PHP configuration file /etc/zabbix/web/zabbix.conf.php
<?php
// Zabbix GUI configuration file
global $DB;

$DB['TYPE']     = 'MYSQL';
$DB['SERVER']   = 'localhost';
$DB['PORT']     = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER']     = 'zabbix';
$DB['PASSWORD'] = 'password';

// SCHEMA is relevant only for IBM_DB2 database
$DB['SCHEMA'] = '';

$ZBX_SERVER      = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = '';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
?>

Step 4: Starting Zabbix services

We can now start the Zabbix services and make sure they start automatically on boot:

rc-update add nginx
rc-update add php-fpm7
rc-update add mariadb
rc-update add zabbix-server-mysql
rc-update add zabbix-agentd
/etc/init.d/nginx start
/etc/init.d/php-fpm7 start
/etc/init.d/mariadb start
/etc/init.d/zabbix-server start
/etc/init.d/zabbix-agentd start

Step 5: Accessing Zabbix web interface

Open your preferred web browser and enter your server's IP address or hostname followed by /zabbix in the address bar (e.g., http://192.168.1.100/zabbix). You will be prompted to log in with your Zabbix admin credentials.

Congratulations! You have successfully installed Zabbix on Alpine Linux Latest.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!