Skip to content

Instantly share code, notes, and snippets.

@nu12
Last active January 4, 2024 01:05
Show Gist options
  • Save nu12/6d7813d71d195cfa2fcd0879010429d0 to your computer and use it in GitHub Desktop.
Save nu12/6d7813d71d195cfa2fcd0879010429d0 to your computer and use it in GitHub Desktop.
Installer tool
# installer_tool.sh: automated setup for ubuntu machines.
# Copyright (C) 2020 nu12
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# source <(curl -s https://gist.githubusercontent.com/nu12/6d7813d71d195cfa2fcd0879010429d0/raw)
#!/bin/bash
RUBY_VERSION=2.7.6
NODE_VERSION=18
OPTION=0
function system_update {
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get autoremove
}
function terraform {
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get install terraform -y
}
function commom_tools {
sudo apt-get update
sudo apt-get install curl make wget git gnupg2 tree snap -y
terraform
}
function cloud_cli {
sudo apt-get install apt-transport-https ca-certificates gnupg unzip
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install google-cloud-cli -y
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
rm awscliv2.zip
rm -rf aws
sudo snap install doctl
}
function docker {
curl https://get.docker.com | sh
sudo usermod -aG docker $USER
}
function kubernetes {
sudo apt-get update && sudo apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube
sudo cp minikube /usr/local/bin && rm minikube
}
function kubeadm {
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
sudo apt-get install -y kubelet kubeadm
}
function ruby {
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
rvm install $RUBY_VERSION
rvm use $RUBY_VERSION --default
}
function rails {
curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install nodejs yarn
gem install rails
}
function ide {
curl -Lo vscode.deb https://go.microsoft.com/fwlink/?LinkID=760868
sudo dpkg -i vscode.deb && rm vscode.deb
sudo apt-get install apt-transport-https
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt-get update && sudo apt-get install -y sublime-text
}
function apps {
sudo apt-get update && sudo apt-get install -y tilix vlc gimp flameshot
}
clear
while [ $OPTION != 'q' ] ; do
echo "Welcome to the installation tool. Please select what you want to install:"
echo ""
echo "1 - System update"
echo "2 - Common tools (curl, make, etc..)"
echo "3 - Docker & docker-compose"
echo "3.1 - Kubernetes & minikube"
echo "3.2 - kubelet, kubeadm"
echo "4 - Ruby using RVM"
echo "4.1 - Rails, Node, Yarn"
echo "5 - IDE (Sublime, VsCode)"
echo "6 - Apps (Gimp, vlc, etc...)"
echo "7 - Cloud CLIs"
echo "q - Quit"
echo ""
echo -n "Enter your option: "
read OPTION
if [ $OPTION == '1' ]
then
echo "Updating and upgrading the system..."
system_update
elif [ $OPTION == '2' ]
then
echo "Installing..."
commom_tools
elif [ $OPTION == '3' ]
then
echo "Installing Docker"
docker
elif [ $OPTION == '3.1' ]
then
echo "Installing Kubernetes (dev)"
kubernetes
elif [ $OPTION == '3.2' ]
then
echo "Installing Kubernetes (prod)"
kubeadm
elif [ $OPTION == '4' ]
then
echo "Installing Ruby"
ruby
elif [ $OPTION == '4.1' ]
then
echo "Installing Rails"
rails
elif [ $OPTION == '5' ]
then
echo "Installing IDE"
ide
elif [ $OPTION == '6' ]
then
echo "Installing programs"
apps
elif [ $OPTION == '7' ]
then
echo "Installing Cloud CLIs"
cloud_cli
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment