-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sh
More file actions
103 lines (84 loc) · 2.73 KB
/
init.sh
File metadata and controls
103 lines (84 loc) · 2.73 KB
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
96
97
98
99
100
101
102
103
#!/bin/bash
##
## setup.sh - Canivete DevOps
##
## Site : https://alexjunio.com.br
## Autor : Alex Junio <contato@alexjunio.com.br>
##
## ------------------------------------------------------------------------ ##
## Esse script automatiza o setup de diversas ferramentas
## como: Docker, Ansible, Terraform e outros.
## ------------------------------------------------------------------------ ##
## ------------------------------------------------------------------------ ##
## CORES P/ TERMINAL
## ------------------------------------------------------------------------ ##
red=`echo -en "\e[31m"`
normal=`echo -en "\e[0m"`
green=`echo -en "\e[32m"`
orange=`echo -en "\e[33m"`
blue=`echo -en "\e[34m"`
bold=`echo -en "\e[1m"`
## ------------------------------------------------------------------------ ##
## INSTALACAO BASICA DE PACOTES E SISTEMA
## ------------------------------------------------------------------------ ##
# Debian 8+ Ubuntu 18+
ubuntu_debian() {
# Update de pacotes
sudo apt update
# Instalacao de pacotes
sudo apt-get install -y software-properties-common htop
# Liberacao de portas no firewall
sudo ufw allow 8088,7080,443,80/tcp
}
# CentOS 7
centos7() {
# Instalacao de pacotes
yum install -y epel-release
yum -y install yum-utils htop
# Liberacao de portas no firewall
firewall-cmd --permanent --add-port=443/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=7080/tcp
firewall-cmd --reload
}
# CentOS 8
centos8() {
# Instalacao de pacotes
yum install -y epel-release
yum -y install yum-utils htop
# Liberacao de portas no firewall
firewall-cmd --permanent --add-port=443/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=7080/tcp
firewall-cmd --reload
}
## ------------------------------------------------------------------------ ##
## VERIFICAO DO SO E EXECUCAO DA FUNCAO CORRESPONDENTE
## ------------------------------------------------------------------------ ##
# Detect OS
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$NAME
else
OS=$(uname -s)
fi
# Perform actions based on OS
if [[ "$OS" == "Debian GNU/Linux" ]] || [[ "$OS" == "Ubuntu" ]]; then
clear
echo "Instalando ferramentas basicas"
echo
ubuntu_debian
elif [[ "$OS" == "CentOS Linux" ]] && [[ "$(cat /etc/centos-release | awk '{print $4}' | awk -F '.' '{print $1}')" == "7" ]]; then
clear
echo "Instalando ferramentas basicas"
echo
centos7
elif [[ "$OS" == "CentOS Linux" ]] && [[ "$(cat /etc/centos-release | awk '{print $4}' | awk -F '.' '{print $1}')" == "8" ]]; then
clear
echo "Instalando ferramentas basicas"
echo
centos8
else
# Incompatible system
echo "Sistema Incompatível!"
fi