Installation of CentOS 8 + Zabbix 5.0 + Nginx 1 + php-fpm 7.4 + PostgreSQL 12 + TimescaleDB 2
(การติดตั้ง CentOS 8 + Zabbix 5.0 + Nginx 1 + php-fpm 7.4 + PostgreSQL 12 + TimescaleDB 2)
PostgreSQL 12 Installation
Installing
# dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# dnf -qy module disable postgresql
# dnf update
# dnf install postgresql12-server
Configuring
# /usr/pgsql-12/bin/postgresql-12-setup initdb
# systemctl enable postgresql-12
# systemctl start postgresql-12
TimescaleDB 2 Installation
Setting up TimescalDB dnf repository
# vi /etc/yum.repos.d/timescale_timescaledb.repo
--Fill content in file named timescale_timescaledb.repo--
[timescale_timescaledb]
name=timescale_timescaledb
baseurl=https://packagecloud.io/timescale/timescaledb/el/8/x86_64
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/timescale/timescaledb/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
Install & Configuration
# dnf update
# dnf install timescaledb-postgresql-12
# timescaledb-tune -pg-config /usr/pgsql-12/bin/pg_config
--Answer "yes" to all--
# systemctl restart postgresql-12
PHP 7.4 Installation
Installing
# dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
# dnf install epel-release
# dnf update
# dnf module enable php:remi-7.4
# dnf install php-fpm
# systemctl enable php-fpm
# systemctl start php-fpm
Nginx 1 Installation
Installing
# dnf install nginx
# systemctl enable nginx
# systemctl start nginx
Zabbix 5.0 Installation
Installing
# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
# dnf clean all
# dnf install zabbix-server-pgsql zabbix-web-pgsql zabbix-nginx-conf zabbix-agent
Setting up database
# cd /tmp/
# sudo -u postgres createuser --pwprompt zabbix
# sudo -u postgres createdb -O zabbix -E Unicode -T template0 zabbixdb
# zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u zabbix psql zabbixdb
Setting up timescaledb
# echo "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" | sudo -u postgres psql zabbixdb
# zcat /usr/share/doc/zabbix-server-pgsql*/timescaledb.sql.gz | sudo -u zabbix psql zabbixdb
Remark:
Default History chunk = 1 day
Default Trend chunk = 30 day
Default Compress = 7 day
Setting up Zabbix for database
# vi /etc/zabbix/zabbix_server.conf
--Edit content in file--
DBHost=localhost
DBName=zabbixdb
DBUser=zabbix
DBPassword=xxxxxxxx
Configuring PHP-FPM for Zabbix
# vi /etc/php-fpm.d/zabbix.conf
--Edit content in file--
php_value[date.timezone] = Asia/Bangkok
Configuring Nginx for Zabbix (Open port TCP/81-HTTP for Zabbix webui - Not default TCP/80)
# vi /etc/nginx/conf.d/zabbix.conf
--Edit content in file--
listen 81 default_server;
Configuring PostgreSQL
# vi /var/lib/pgsql/12/data/pg_hba.conf
--Edit content in file--
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
Enable & Restart all related services
# systemctl enable zabbix-server zabbix-agent
# systemctl restart zabbix-server zabbix-agent nginx php-fpm postgresql-12
Continue setting up using Zabbix webui (Rememberer Using port 81)
http://IP_ADDR:81/
Reference:
[1] https://www.zabbix.com/download?zabbix=5.0&os_distribution=centos&os_version=8&db=postgresql&ws=nginx
[2] https://idomaster.com/solutions/install-zabbix-5-0-timescaledb-postgresql-on-centos8
[3] https://www.postgresql.org
[4] https://www.timescale.com
[5] https://www.zabbix.com/documentation/5.0/manual/appendix/install/db_scripts
[6] https://www.zabbix.com/documentation/5.0/manual/appendix/install/timescaledb