Skip to content

Instantly share code, notes, and snippets.

@jonataaraujo
Last active June 4, 2024 18:49
Show Gist options
  • Save jonataaraujo/9b34fec510b109ef83265337c196e496 to your computer and use it in GitHub Desktop.
Save jonataaraujo/9b34fec510b109ef83265337c196e496 to your computer and use it in GitHub Desktop.
Roteiro instalacao zabbix 7 no debian 12
# Roteiro instalacao zabbix 7 no debian 12
# superuser
sudo -i
# Instacao nginx
apt update && apt -y install nginx
sed -i 's/# server_tokens/server_tokens/' /etc/nginx/nginx.conf
systemctl restart nginx
# Instacao PHP
apt -y install --no-install-recommends php php-{fpm,cli,mysql,pear,gd,gmp,bcmath,mbstring,curl,xml,zip,json,pgsql}
# Conf do PHP
sed -i 's/max_execution_time = 30/max_execution_time = 600/' /etc/php/8.2/fpm/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 100M/' /etc/php/8.2/fpm/php.ini
systemctl restart php8.2-fpm
# Instacao do PostgreSQL
apt -y install postgresql postgresql-contrib -y
su - postgres
psql
# Conf do PostgreSQL Parte 1
postgres=# \password postgres
postgres=# CREATE EXTENSION adminpack;
postgres=# \q
exit
# Conf do PostgreSQL Parte 2
sed -i '0,/local\s*all\s*all\s*peer/s/peer/md5/' /etc/postgresql/15/main/pg_hba.conf
sed -i '/postgres.*peer/s/peer/md5/' /etc/postgresql/15/main/pg_hba.conf
systemctl restart postgresql
# Instalação do zabbix
cd /tmp/
wget https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-1%2Bdebian12_all.deb
dpkg -i zabbix-release_7.0-1+debian12_all.deb
apt update && apt -y install zabbix-server-pgsql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent traceroute
# Conf do PostgreSQL Parte 3
su - postgres
createuser --pwprompt zabbix
createdb -O zabbix zabbix
exit
# Conf do PostgreSQL Parte 4
zcat /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz | psql -U zabbix -d zabbix &>/dev/null
nano /etc/zabbix/zabbix_server.conf #OBS: Descomente e defina a senha na linha # DBPassword=.
# Configuracao Timezone
nano /etc/zabbix/php-fpm.conf #OBS: Adicione timezone, e ajuste upload_max_filesize
# Configuracao Locale
mkdir -p /var/lib/locales/supported.d/
rm -f /var/lib/locales/supported.d/local
cat /usr/share/zabbix/include/locales.inc.php | grep display | grep true | awk '{$1=$1};1' | cut -d"'" -f 2 | sort | xargs -I '{}' bash -c 'echo "{}.UTF-8 UTF-8"' >> /etc/locale.gen
dpkg-reconfigure --frontend noninteractive locales
systemctl restart php8.2-fpm.service
systemctl restart nginx
# Configuracao NGINX
nano /etc/nginx/conf.d/zabbix.conf #OBS: Troque o endereço IP no campo server_name
systemctl restart nginx
# Configuracao Zabbix
systemctl enable zabbix-server
systemctl restart zabbix-server zabbix-agent nginx
# Acesso Web
http://SEU_IP
# Setup zabbix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment