Skip to content

Instantly share code, notes, and snippets.

@febri4n
Created July 15, 2024 02:48
Show Gist options
  • Save febri4n/66601c9e2786105c53ab4c5198c4a3eb to your computer and use it in GitHub Desktop.
Save febri4n/66601c9e2786105c53ab4c5198c4a3eb to your computer and use it in GitHub Desktop.
Pre-install Kamaji on Openstack Instance
#!/bin/bash
# Log file
LOG="/var/log/install_script.log"
echo "Starting installation script at $(date)" | tee -a $LOG
# Docker Installation
echo "Starting Docker installation" | tee -a $LOG
apt install -y apt-transport-https ca-certificates curl software-properties-common | tee -a $LOG
curl -fsSL https://download.docker.com/linux/ubuntu/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/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update -y | tee -a $LOG
apt install -y docker-ce | tee -a $LOG
systemctl enable docker | tee -a $LOG
usermod -aG docker ubuntu
echo "Docker installation completed" | tee -a $LOG
# kubectl Installation
echo "Starting kubectl installation" | tee -a $LOG
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | tee -a $LOG
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
apt-get install bash-completion -y | tee -a $LOG
echo "source <(kubectl completion bash)" >> /home/ubuntu/.bashrc
echo "source <(kubectl completion bash)" >> /root/.bashrc
echo "kubectl installation completed" | tee -a $LOG
# Helm Installation
echo "Starting Helm installation" | tee -a $LOG
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | tee /usr/share/keyrings/helm.gpg > /dev/null
apt-get install apt-transport-https --yes | tee -a $LOG
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list
apt-get update | tee -a $LOG
apt-get install helm -y | tee -a $LOG
echo "Helm installation completed" | tee -a $LOG
# jq Installation
echo "Starting jq installation" | tee -a $LOG
apt install jq -y | tee -a $LOG
echo "jq installation completed" | tee -a $LOG
echo "Installation script completed at $(date)" | tee -a $LOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment