Skip to content

Instantly share code, notes, and snippets.

@zebde
Last active January 9, 2018 08:08
Show Gist options
  • Save zebde/73e3d62834182dfa7a9b1a9afd5eba82 to your computer and use it in GitHub Desktop.
Save zebde/73e3d62834182dfa7a9b1a9afd5eba82 to your computer and use it in GitHub Desktop.
Ubuntu box deployment
#!/bin/bash
sudo locale-gen en_US.UTF-8
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade
sudo apt autoremove -y
sudo apt install -y firefox curl htop git tor vim build-essential zsh ntpdate fail2ban unzip
#Fail2ban
sudo awk '{ printf "# "; print; }' /etc/fail2ban/jail.conf | sudo tee /etc/fail2ban/jail.local # Create jail.local
# Install ZSH and oh-my-ZSH
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
chsh -s `which zsh`
# Install powerline fonts
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
cd ..
rm -rf fonts
# Install bullet train ZSH theme
sudo mkdir -p ~/.oh-my-zsh/custom/themes
sudo wget -O ~/.oh-my-zsh/custom/themes/bullet-train.zsh-theme http://raw.github.com/caiogondim/bullet-train-oh-my-zsh-theme/master/bullet-train.zsh-theme
sudo sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="bullet-train"/g' ~/.zshrc
# Install UFW Firewall and allow SSH
sudo apt install -y ufw
sudo ufw allow ssh
sudo ufw enable
# Setup Unattended Security Upgrades
cat > /etc/apt/apt.conf.d/50unattended-upgrades << EOF
Unattended-Upgrade::Allowed-Origins {
"Ubuntu xenial-security";
};
Unattended-Upgrade::Package-Blacklist {
//
};
EOF
cat > /etc/apt/apt.conf.d/10periodic << EOF
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";
EOF
sudo shutdown -r 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment