Ubuntu24 源码安装 Zabbix 7.2

Ubuntu24 源码安装 Zabbix 7.2

安装 MariaDB 11.4

mkdir -p /etc/apt/keyrings
curl -o /etc/apt/keyrings/mariadb-keyring.pgp ‘https://mariadb.org/mariadb_release_signing_key.pgp’

cat /etc/apt/sources.list.d/mariadb.sources

# MariaDB 11.4 repository list - created 2025-02-07 08:39 UTC
# https://mariadb.org/download/
X-Repolib-Name: MariaDB
Types: deb
# deb.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# URIs: https://deb.mariadb.org/11.4/ubuntu
URIs: https://mirrors.accretive-networks.net/mariadb/repo/11.4/ubuntu
Suites: noble
Components: main main/debug
Signed-By: /etc/apt/keyrings/mariadb-keyring.pgp

apt-get update
apt-get install mariadb-server

安装必要组件
apt-get install curl vim nginx net-tools htop wget build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev g++ libpq-dev pkg-config

安装 PHP8.3 服务
apt install php8.3 php8.3-cli php8.3-common php8.3-curl php8.3-dev php8.3-gd php8.3-mbstring php8.3-mysql php8.3-xml php8.3-opcache php8.3-fpm php8.3-memcached php8.3-bcmath

Install Zabbix repository

wget https://repo.zabbix.com/zabbix/7.2/release/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_7.2+ubuntu24.04_all.deb
dpkg -i zabbix-release_latest_7.2+ubuntu24.04_all.deb
apt update

Install Zabbix server, frontend, agent 安装Zabbix server,Web前端,agent

apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent

Create initial database 创建初始数据库

# mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;

导入初始架构和数据,系统将提示您输入新创建的密码。 (新版mariadb 逐渐弃用 mysql 修改为 mariadb)
zcat /usr/share/zabbix/sql-scripts/mysql/server.sql.gz | mariadb –default-character-set=utf8mb4 -uzabbix -p zabbix

#Disable log_bin_trust_function_creators option after importing database schema.
# mysql -uroot -p
password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;

为Zabbix server配置数据库

编辑配置文件 /etc/zabbix/zabbix_server.conf
DBPassword=password

为Zabbix前端配置PHP
编辑配置文件 /etc/zabbix/nginx.conf uncomment and set ‘listen’ and ‘server_name’ directives.

# listen 8080;
# server_name example.com;

启动Zabbix server和agent进程
启动Zabbix server和agent进程,并为它们设置开机自启: (本次过程记录在Docker容器内安装 ,此设置无效,故未验证)

# systemctl restart zabbix-server zabbix-agent nginx php8.3-fpm
# systemctl enable zabbix-server zabbix-agent nginx php8.3-fpm

语言选择如需中文需安装
apt-get install language-pack-zh-hans
英文
apt-get install language-pack-en

vim /etc/default/locale

locale-gen en_US.UTF-8

修改语言需重启