Skip to content

Instantly share code, notes, and snippets.

@BarakStout
Last active February 17, 2022 22:16
Show Gist options
  • Save BarakStout/14408b87db2abaf8fbc8fdb857bfac9b to your computer and use it in GitHub Desktop.
Save BarakStout/14408b87db2abaf8fbc8fdb857bfac9b to your computer and use it in GitHub Desktop.
CentOS host install script
sudo yum update
sudo dnf install gcc \
epel-release \
gcc-c++ \
kernel-devel \
make \
golang \
python3 \
python3-pip \
git \
tmux \
nss-tools \
conntrack \
yum-utils \
postgresql \
mysql \
zsh \
net-tools \
java \
java-devel \
-y
sudo yum install @scala \
awscli \
snapd \
nodejs \
-y
# Kube stuff
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
EOF
# Set SELinux in permissive mode (effectively disabling it)
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
# Kubectl
# curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/# kubectl"
# sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
# rm -f kubectl
# Docker
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum clean all
yum install -y containerd.io --allowerasing
systemctl enable containerd
systemctl start containerd
# Snap store
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
# Poerty
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 -
alias python=python3
alias pip=pip3
alias potery=~/.poetry/bin/poetry
# Helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
rm -f get_helm.sh
# K9s
curl -sS https://webinstall.dev/k9s | bash
export PATH="/root/.local/bin:$PATH"
# Cluster Lint
go install github.com/digitalocean/clusterlint/cmd/clusterlint@latest
mv ./go/bin/clusterlint /usr/local/bin/
# KubeLinter
go install golang.stackrox.io/kube-linter/cmd/kube-linter@latest
mv ./go/bin/kube-linter /usr/local/bin/
# Stern
go install github.com/stern/stern@latest
mv ./go/bin/stern /usr/local/bin/
# Kubetail
wget https://raw.githubusercontent.com/johanhaleby/kubetail/master/kubetail
chmod +x kubetail
mv -f kubetail /usr/local/bin/
# Kustomize
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
mv -f kustomize /usr/local/bin/
# Flux
curl -s https://fluxcd.io/install.sh | sudo bash
# Istio
curl -sL https://istio.io/downloadIstioctl | sh -
export PATH=$PATH:$HOME/.istioctl/bin
# YQ
snap install yq
mv /var/lib/snapd/snap/bin/yq /usr/local/bin/yq
# Sops
go get -u go.mozilla.org/sops/cmd/sops
alias sops=./go/bin/sops
# kustomize-sopssecretgenerator
VERSION=1.4.1 PLATFORM=linux ARCH=amd64
curl -Lo SopsSecretGenerator https://github.com/goabout/kustomize-sopssecretgenerator/releases/download/v${VERSION}/SopsSecretGenerator_${VERSION}_${PLATFORM}_${ARCH}
chmod +x SopsSecretGenerator
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/kustomize/plugin/goabout.com/v1beta1/sopssecretgenerator"
mv -f SopsSecretGenerator "${XDG_CONFIG_HOME:-$HOME/.config}/kustomize/plugin/goabout.com/v1beta1/sopssecretgenerator"
# Kind
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
chmod +x ./kind
mv -f ./kind /usr/local/bin/kind
# k3d
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash
# Minikube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
alias minikube=/usr/local/bin/minikube
# EKS-Anywhere
curl "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" \
--silent --location \
| tar xz -C /tmp
sudo mv -f /tmp/eksctl /usr/local/bin/
# Argo
curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
chmod +x /usr/local/bin/argocd
# mkcerts
git clone https://github.com/FiloSottile/mkcert && cd mkcert
go build -ldflags "-X main.Version=$(git describe --tags)"
mv mkcert /usr/local/bin/
cd .. && rm -f -r mkcert
# Kafka tools
KAFKA_VERSION=kafka_2.13-3.1.0
wget wget http://www.apache.org/dist/kafka/3.1.0/${KAFKA_VERSION}.tgz
tar xvf ${KAFKA_VERSION}.tgz
mv -f ${KAFKA_VERSION} /usr/local/kafka
cd /usr/local/kafka
export PATH="/usr/local/kafka/bin:$PATH"
# Confluent CLI
curl -sL --http1.1 https://cnfl.io/cli | sh -s -- latest
mv -f ./bin/confluent /usr/local/bin/confluent
# kafkacat
# sudo yum group install "Development Tools" -y
VERSION=1.6.2
curl -L https://github.com/edenhill/librdkafka/archive/v${VERSION}.tar.gz | tar xzf -
cd librdkafka-${VERSION}/
./configure --prefix=/usr
make -j
make install
cd ..
git clone https://github.com/edenhill/kafkacat.git
cd kafkacat
./configure --prefix=/usr
make -j
mv -f kcat /usr/local/bin/kcat
cd ~
# asdf
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
alias asdf=~/.asdf/bin/asdf
# Terraform & Terragrunt
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo dnf install terraform -y
snap install terragrunt
# Configure zsh
chsh -s /bin/zsh root
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
\cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
source ~/.zshrc
cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/zsh-users/zsh-autosuggestions.git
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
sed -i 's/plugins=(git)/plugins=(\n\tgit\n\tzsh-autosuggestions\n\tzsh-syntax-highlighting\n\t)/g' ~/.zshrc
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="dpoggi"/g' ~/.zshrc
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment