Last active
March 2, 2021 22:03
-
-
Save Samuel-Martineau/cc76240c6b479eedb89efdb8c8fbb7b3 to your computer and use it in GitHub Desktop.
init_server
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 | |
NC='\033[0m' | |
LBLACK='\033[0;30m' | |
LRED='\033[0;31m' | |
LGREEN='\033[0;32m' | |
LYELLOW='\033[0;33m' | |
LBLUE='\033[0;34m' | |
LPURPLE='\033[0;35m' | |
LCYAN='\033[0;36m' | |
LGRAY='\033[0;37m' | |
BLACK='\033[1;30m' | |
RED='\033[1;31m' | |
GREEN='\033[1;32m' | |
YELLOW='\033[1;33m' | |
BLUE='\033[1;34m' | |
PURPLE='\033[1;35m' | |
CYAN='\033[1;36m' | |
GRAY='\033[1;37m' | |
echo -e "${LCYAN}Installing system updates...${NC}" | |
apt update | |
apt upgrade -y | |
echo -e "${LCYAN}Rectifying SSHD config...${NC}" | |
echo "PermitRootLogin prohibit-password" >> /etc/ssh/sshd_config | |
echo "ChallengeResponseAuthentication no" >> /etc/ssh/sshd_config | |
echo "UsePAM no" >> /etc/ssh/sshd_config | |
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config | |
echo "Banner none" >> /etc/ssh/sshd_config | |
echo -e "${LCYAN}Installing fail2ban...${NC}" | |
apt install fail2ban -y | |
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local | |
echo -e "${LCYAN}Installing Docker & Compose...${NC}" | |
apt remove docker docker-engine docker.io containerd runc | |
apt install apt-transport-https ca-certificates curl gnupg | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
apt update | |
apt install docker-ce docker-ce-cli containerd.io -y | |
curl -L "https://github.com/docker/compose/releases/download/1.28.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
mkdir -p docker/{apps,core} | |
echo -e "${LCYAN}Rebooting system...${NC}" | |
read -p "Press enter to continue" | |
reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment