Instalador autônomo Zabbix 3.2.1 no CentOS 6
Publicado por fabio brigido (última atualização em 16/01/2017)
[ Hits: 5.616 ]
Download 1480528417.instalador_zabbix (versão 2)
Esta é a minha primeira contribuição ao fórum, qualquer erro por favor me avisem. Este script surgiu da necessidade de auxiliar um colega que está iniciando no mundo linux e precisava instalar o Zabbix em uma distro CentOS 6.
Está todo automatizado, inclusive as configurações da pagina web. Apenas por segurança altere as variáveis abaixo:
SENHA="123456"; # Essa é a senha que sera configurada no bando criado, nessa caso o zabbix
SENHAROOT="123456"; # Essa é a senha de root do mysql
Versão 2 - Enviado por fabio brigido em 30/11/2016
Changelog: Mudanças na estrutura do script sendo as principais:
- Mudança do banco mysql. Agora o script pede para inserir a senha na tela, não sendo mais necessária sua prévia inserção;
- Correção de bugs;
Download 1480528417.instalador_zabbix
#!/bin/bash # SCRIPT DE PREPARAÇÃO E INSTALAÇÃO ZABBIX NO CENTOS 6 # # VER. 1.0 # Copyright (c) 2016 Fabio Brigido # Email: fbrigido14@gmail.com # #===================================================================== echo '##############################################################################################################' echo '##############################################################################################################' echo '######################################## PREPARANDO SERVIDOR CENTOS #########################################' echo '##############################################################################################################' echo '##############################################################################################################' # Variaveis de ambiente PHPINI="/etc/php.ini" SENHA="123456"; SENHAROOT="123456"; NOMEBANCO="zabbix"; USUARIODB="zabbix"; # Criando e acessando o diretorio temporario de instalacao mkdir /home/instaladores cd /home/instaladores # Configurando o SELinux sed -i "s/=enforcing/=disabled/g" /etc/selinux/config # Desabilita o SELINUX neste boot setenforce 0 #Desabilitando firewall chkconfig iptables off chkconfig ip6tables off service iptables stop # Habilitando DNS echo "nameserver 8.8.8.8" >> /etc/resolv.conf echo "nameserver 8.8.4.4" >> /etc/resolv.conf # Habilitando os repositórios rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh http://dl.atrpms.net/all/atrpms-repo-6-7.el6.x86_64.rpm rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm # Instalando biblioteca de gerenciamento yum groupinstall 'Development Tools' -y yum install vim wget -y # Atualizando sistema operacional yum update -y # Instalando arquivos necessários yum install wget vim net-snmp net-snmp-devel net-snmp-utils net-snmp-libs iksemel-devel zlib-devel libc-devel curl-devel automake libidn-devel openssl-devel rpm-devel OpenIPMI-devel libssh2-devel make fping -y yum install httpd httpd-devel mod_ssl -y yum install mysql mysql-server mysql-devel -y yum install php56w php56w-opcache php56w-cli php56w-common php56w-devel php56w-gd php56w-imap php56w-mbstring php56w-mcrypt php56w-mysql php56w-phpdbg php56w-snmp php56w-bcmath php56w-xml php56w-ldap -y # Iniciando os serviços chkconfig mysqld on chkconfig httpd on service httpd start service mysqld start # Definindo a senha do root /usr/bin/mysqladmin -u root password $SENHAROOT; # Criando banco do zabbix echo "create database $NOMEBANCO character set utf8;" | mysql -uroot -p$SENHAROOT echo "GRANT ALL PRIVILEGES ON $NOMEBANCO.* TO $USUARIODB@localhost IDENTIFIED BY '$SENHA' WITH GRANT OPTION;" | mysql -uroot -p$SENHAROOT # Configurando apache echo "serverName localhost:80" >> /etc/httpd/conf/httpd.conf # Configurando o php.ini sed -i "s/date.timezone/;date.timezone/" $PHPINI; sed -i "s/max_execution_time/;max_execution_time/" $PHPINI; sed -i "s/max_input_time/;max_input_time/" $PHPINI; sed -i "s/post_max_size/;post_max_size/" $PHPINI; echo "date.timezone = Europe/Riga" >> $PHPINI; echo "max_execution_time = 300" >> $PHPINI; echo "max_input_time = 300" >> $PHPINI; echo "post_max_size = 16M" >> $PHPINI; echo "always_populate_raw_post_data=-1" >> $PHPINI # Instalação zabbix echo '############################################################################' echo '############################################################################' echo '###################### Instalando Zabbix 3.2 ###############################' echo '############################################################################' echo '############################################################################' # Criando usuário e grupo groupadd zabbix useradd -g zabbix zabbix cd /home/instaladores wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.1/zabbix-3.2.1.tar.gz tar xvf zabbix-3.2.1.tar.gz cd /home/instaladores/zabbix-3.2.1 cat database/mysql/schema.sql | mysql -u $USUARIODB -p$SENHA $NOMEBANCO && cat database/mysql/images.sql | mysql -u $USUARIODB -p$SENHA $NOMEBANCO && cat database/mysql/data.sql | mysql -u $USUARIODB -p$SENHA $NOMEBANCO; cd /home/instaladores/zabbix-3.2.1 ./configure --enable-server --enable-agent --with-mysql --with-openssl make install # Instalando frontend echo '############################################################################' echo '############################################################################' echo '######################## Instalação Zabbix 3.2.1 ###########################' echo '######################## INSTALAÇÃO DO FRONTEND ############################' echo '############################################################################' echo '############################################################################' mkdir /var/www/html/zabbix cd /home/instaladores/zabbix-3.2.1/frontends/php/ cp -a . /var/www/html/zabbix/ chown apache:apache -R /var/www/html/zabbix chcon -Rv --type=httpd_sys_content_t /var/www/html setsebool -P httpd_can_network_connect=1 setsebool -P zabbix_can_network=1 chmod +x /var/www/html/zabbix/conf/ # Criando o arquivo de configuracao do frontend echo -e "<?php // COnfigurador Zabbix GUI. - Criado por Fabio Brigido global \$DB; \$DB['TYPE'] = 'MYSQL'; \$DB['SERVER'] = 'localhost'; \$DB['PORT'] = '0'; \$DB['DATABASE'] = '$NOMEBANCO'; \$DB['USER'] = '$USUARIODB'; \$DB['PASSWORD'] = '$SENHA'; // Schema name. Used for IBM DB2 and PostgreSQL. \$DB['SCHEMA'] = ''; \$ZBX_SERVER = 'localhost'; \$ZBX_SERVER_PORT = '10051'; \$ZBX_SERVER_NAME = 'Zabbix'; \$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; ?> " > /var/www/html/zabbix/conf/zabbix.conf.php echo '############################################################################' echo '############################################################################' echo '##################### Instalação Zabbix 3.2.1 ##############################' echo '################# Instalação serviços agent & server #######################' echo '############################################################################' echo '############################################################################' cp /home/instaladores/zabbix-3.2.1/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server cp /home/instaladores/zabbix-3.2.1/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_agentd chkconfig --add /etc/init.d/zabbix_server chkconfig --add /etc/init.d/zabbix_agentd chkconfig zabbix_server on chkconfig zabbix_agentd on service zabbix_server start service zabbix_agentd start service httpd restart rm -rf /home/instaladores echo '############################################################################' echo '############################################################################' echo '################# Instalação Zabbix 3.2.1 concluida ########################' echo '################ Acesse http://ip_do_servidor/zabbix #######################' echo '################## Usuário: Admin / senha: zabbix ##########################' echo '############################################################################' echo '############################################################################'
Select DATAFILES especificando uma Tablespace
Compilando o apache2.2 com php5 e mysql5.1 no slackware
Firewall para Compartilhamento de Conexão 3G
Tradução de endereços de uma rede interna
Compartilhando a tela do Computador no Celular via Deskreen
Como Configurar um Túnel SSH Reverso para Acessar Sua Máquina Local a Partir de uma Máquina Remota
Configuração para desligamento automatizado de Computadores em um Ambiente Comercial
Como renomear arquivos de letras maiúsculas para minúsculas
Imprimindo no formato livreto no Linux
Vim - incrementando números em substituição
Efeito "livro" em arquivos PDF
Como resolver o erro no CUPS: Unable to get list of printer drivers
É cada coisa que me aparece! - não é só 3% (3)
Melhorando a precisão de valores flutuantes em python[AJUDA] (5)
[Python] Automação de scan de vulnerabilidades
[Python] Script para analise de superficie de ataque
[Shell Script] Novo script para redimensionar, rotacionar, converter e espelhar arquivos de imagem
[Shell Script] Iniciador de DOOM (DSDA-DOOM, Doom Retro ou Woof!)
[Shell Script] Script para adicionar bordas às imagens de uma pasta