-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathinstalaPreReq.sh
96 lines (74 loc) · 3.04 KB
/
instalaPreReq.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
#-------------------------------------------------------
# author: Adail Spinola <[email protected]>
# date: 05-jan-2016
#-------------------------------------------------------
#
# Variaveis de ambiente
PHPINI="/etc/php.ini"
# Instala Zabbix Server
SERVER="S";
# Instala Zabbix Proxy
PROXY="N";
# Criando e acessando o diretorio temporario de instalacao
mkdir /install
cd /install
# Habilitando repositorio centos
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
# Atualizando pacotes e instalando os pre-req
yum -y update && yum -y groupinstall 'Development Tools' ;
# Comuns
yum -y install wget 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 ;
if [ $PROXY == "S" ]; then
# BD para o proxy
yum -y install sqlite-devel sqlite
fi
if [ $SERVER == "S" ]; then
# Suporte BD com MariaDB
yum -y install mariadb-server mariadb-devel
# Instalando php 5.4
yum -y install php php-bcmath php-gd php-mbstring php-xml php-ldap php-mysql php-ldap php-mysql httpd --skip-broken
# 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 =America/Sao_Paulo" >> $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
# Garantindo o autostart de mysql e apache
systemctl enable httpd.service
systemctl enable mariadb.service
systemctl restart httpd.service
systemctl restart mariadb.service
fi
# Criando o usuario zabbix
useradd zabbix -s /bin/false
# Instala o iptables
yum install -y iptables-services
systemctl enable iptables.service
/usr/libexec/iptables/iptables.init save
# Desabilita o SELINUX
sed -i 's/enforcing/disabled/g' /etc/selinux/config
setenforce 0
systemctl disable firewalld
systemctl stop firewalld
#vim /etc/sysconfig/iptables
iptables -F
/usr/libexec/iptables/iptables.init save
#Alterar MANUALMENTE o arquivo /etc/sysconfig/iptables adicionando as regras de iptables caso nao queira deixar tudo escancarado
iptables -A INPUT -p udp -m udp --dport 631 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 10050 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 10051 -j ACCEPT
# Estas portas nao sao necessarias para o Zabbix, foram adicionadas para facilitar transmissao de arquivos entre a VM e a estacao do aluno
iptables -A INPUT -p tcp -m tcp --dport 137 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 138 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 139 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 445 -j ACCEPT
# Salva as novas regras
/usr/libexec/iptables/iptables.init save