Created
July 2, 2023 23:23
-
-
Save AmaralMarti/7bcdd985117959ca8917cb4383ca93f0 to your computer and use it in GitHub Desktop.
Setup Debian 12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Atualizando o Debian..." | |
apt update && apt upgrade -y && apt install -y dialog wget curl | |
export TERM=xterm-color | |
# Armazena a saída do comando dialog em uma variável | |
opcoes=$(dialog --colors --stdout --separate-output \ | |
--title "" \ | |
--checklist "Preparacao do Servidor Debian 12:" 0 0 0 \ | |
1 "Instalar ZSH com Oh My Zsh" on \ | |
2 "Instalar e habilitar servidor SSH" on \ | |
3 "Ativar acesso SSH como root" off \ | |
4 "Instalar Docker" off \ | |
5 "Instalar Speedtest by Ookla" off \ | |
6 "Instalar vim" on \ | |
7 "Instalar git" off \ | |
8 "Instalar htop" on \ | |
9 "Instalar net-tools" on \ | |
10 "Instalar neofetch" off \ | |
) | |
# Verifica se o usuário pressionou Esc ou Cancelar | |
if [ $? -eq 1 ] || [ $? -eq 255 ]; then | |
clear | |
echo "Operação cancelada pelo usuário." | |
exit 1 | |
fi | |
# Processa as opções selecionadas pelo usuário | |
for opcao in $opcoes; do | |
case $opcao in | |
1) | |
echo "Instalando ZSH com Oh My Zsh..." | |
apt install -y git zsh | |
wget --no-check-certificate http://install.ohmyz.sh -O - | sh | |
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="bira"/g' ~/.zshrc | |
echo "alias ll='ls -la'" >> ~/.zshrc | |
usermod -s /usr/bin/zsh $USER | |
source ~/.zshrc | |
;; | |
2) | |
echo "Instalando e habilitando servidor SSH..." | |
apt install -y openssh-server | |
systemctl enable sshd | |
systemctl start sshd | |
;; | |
3) | |
echo "Ativando acesso SSH como root..." | |
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | |
systemctl restart sshd | |
;; | |
4) | |
echo "Instalando Docker..." | |
apt install -y apt-transport-https ca-certificates curl gnupg lsb-release | |
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null | |
apt update | |
apt install docker-ce docker-ce-cli containerd.io | |
;; | |
5) | |
echo "Instalando Speedtest by Ookla..." | |
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash | |
apt update && apt install -y speedtest | |
;; | |
6) | |
echo "Instalando vim..." | |
apt install -y vim | |
;; | |
7) | |
echo "Instalando git..." | |
apt install -y git | |
;; | |
8) | |
echo "Instalando htop..." | |
apt install -y htop | |
;; | |
9) | |
echo "Instalando net-tools..." | |
apt install -y net-tools | |
;; | |
10) | |
echo "Instalando neofetch..." | |
apt install -y neofetch | |
;; | |
esac | |
done | |
clear | |
# Exibe o endereço IP das interfaces de rede | |
echo "Enderecos IP das interfaces de rede:" | |
ip -4 -o addr show | grep -v ' lo\|docker' | awk '{print $2 ": " $4}' | |
echo "Operação concluída." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment