Skip to content

Instantly share code, notes, and snippets.

View alexolinux's full-sized avatar
🤠
Working from home

Alex Mendes alexolinux

🤠
Working from home
View GitHub Profile

Consul Installation


sudo yum install yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum install consul

Running consul as dev (single mode)

@alexolinux
alexolinux / kubectl-remove-node.sh
Created May 14, 2024 08:51
K8s - Remove kubernetes node from cluster
#!/bin/bash
NODE="kube-node-02"
kubectl cordon $NODE
kubectl drain $NODE --ignore-daemonsets --delete-emptydir-data
kubectl delete node $NODE
@alexolinux
alexolinux / granted.sh
Created May 7, 2024 17:35
Installation of granted for AWS account profile management
#!/bin/bash
#https://docs.commonfate.io/granted/getting-started#verify-the-installation
GRANTED_HOME="/usr/local/granted"
DEST="/usr/local/bin"
TTMP="/tmp/tarball"
clear && \
mkdir $TTMP && cd $TTMP && \
curl -OL https://releases.commonfate.io/granted/v0.21.1/granted_0.21.1_linux_x86_64.tar.gz
@alexolinux
alexolinux / ec2-user-data.sh
Created May 1, 2024 20:38
EC2 user-data for Apache Webserver and Instance Metadata page
#!/bin/bash
sudo yum update -y
sudo yum install -y httpd
sudo yum install -y git
export TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
export META_INST_ID=`curl http://169.254.169.254/latest/meta-data/instance-id -H "X-aws-ec2-metadata-token: $TOKEN"`
export META_INST_TYPE=`curl http://169.254.169.254/latest/meta-data/instance-type -H "X-aws-ec2-metadata-token: $TOKEN"`
export META_INST_AZ=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone -H "X-aws-ec2-metadata-token: $TOKEN"`
@alexolinux
alexolinux / aws-cli-install.sh
Created April 24, 2024 21:14
aws-cli installation
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
@alexolinux
alexolinux / terraform-install.sh
Last active May 19, 2024 12:46
Install terraform by using repository
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum -y install terraform
touch ~/.zshrc
terraform -install-autocomplete
@alexolinux
alexolinux / install-nvm.sh
Last active April 20, 2024 20:36
Script to install Node Version Manager (NVM).
#!/bin/bash
NVM_VER="v0.39.7"
# Check if NVM is already installed
if [ -z "$(command -v nvm)" ] && [ -z "$NVM_DIR" ]; then
echo "---- NVM Installation ----"
# Check if curl is installed
@alexolinux
alexolinux / install-trivy.sh
Created April 19, 2024 12:08
Installing Trivy using YUM Package Manager
#!/bin/bash
# https://aquasecurity.github.io/trivy/v0.50/getting-started/installation/#rhelcentos-official
RELEASE_VERSION=$(grep -Po '(?<=VERSION_ID=")[0-9]' /etc/os-release)
cat << EOF | sudo tee -a /etc/yum.repos.d/trivy.repo
[trivy]
name=Trivy repository
baseurl=https://aquasecurity.github.io/trivy-repo/rpm/releases/$RELEASE_VERSION/\$basearch/
gpgcheck=1
enabled=1
@alexolinux
alexolinux / zsh-install-compilation.sh
Last active May 6, 2024 18:05
Script to install ZSH specific version via compilation
#!/bin/bash
ZSH_VER="zsh-5.9"
ZSH_URL="https://www.zsh.org/pub/${ZSH_VER}.tar.xz"
TMP_DIR="/tmp"
# Check if the script is run as root
if [ "$EUID" -ne 0 ]; then
echo "Error: This script should not be run as root."
exit 1
@alexolinux
alexolinux / install-kubectl.sh
Last active April 24, 2024 20:53
Script to install kubectl binary.
#!/bin/bash
# Script to install kubectl binary with curl on Linux
# List of kubectl releases: https://kubernetes.io/releases/
# For kubectl latest stable version: $(curl -L -s https://dl.k8s.io/release/stable.txt)
KUBE_VERSION="1.29.0"
# Define installation directory
# Note: If you do not have root access on the target system, you can still install kubectl to the '~/.local/bin' directory.