DEV Community

Cover image for Essential DevOps Tools for Ubuntu
Joaquin Menchaca
Joaquin Menchaca

Posted on

Essential DevOps Tools for Ubuntu

Popular tools for provisioning the cloud are Terraform and Kubernetes tools kubectl and helm. For Linux, online instructions for how to install these tools can be inconsistent and potentially error prone. This article shows how to install these tools on Debian and Ubuntu based distros, which by extension would include Mint, Pop! OS, Zorin OS and others.

This guide walk you through how to install the latest versions of popular DevOps tool on Ubuntu Linux. This was tested on Ubuntu 24.04 Noble Nambat.

Segue: Why Linux?

For developers accustomed to macOS or Windows, choosing Linux as a primary development platform may seem unusual. For others, Linux is the default choice. With Windows now supporting Linux through WSL, Linux-based development environments have become increasingly common.

Beyond personal preference, the strongest case for Linux is environment consistency. Production systems, and especially CI/CD pipelines, almost always run on Linux. Developing and testing directly in a Linux environment allows you to validate build, test, and deployment scripts under the same conditions they'll run in production.

This consistency shortens development cycles by reducing surprises late in the pipeline and eliminates platform-specific "gotchas" that exist on macOS or Windows but never appear in Linux-based CI/CD or production systems.

The Tools

This is an overview of the tools.

  • Cloud Provisioning

    • Terraform [terraform]: tool for provisioning cloud infrastructure.
    • AWS CLI [aws]: tool to interact with Amazon Web Services
    • okta-aws-cli [okta-aws-cli]: allows you to get temporary IAM credentials using Okta as the Identity provider.
  • Kubernetes

    • Kubernetes CLI [kubectl]: command line tool for interacting with Kubernetes control plan
    • Helm [helm]: Tool for configuring, installing, and distributing Kubernetes applications.
    • Kustomize [kustomize]: tool to configure Kubernetes application through patching.
    • Helmfile [helmfile]: is a declarative spec for deploying helm charts that allows you to template helm chart values as well integrate patching support
    • Krew [kubectl krew]: is a plugin system for Kubernetes
  • Java

    • Correto OpenJDK [java, javac, jar, keytool]: Corretto is an OpenJDK distribution that is supported on many platforms.
  • Others

    • Vault [vault]: Allow securing, storing, and controlling access to secrets artifacts: tokens, passwords, certificates, and encryption keys.

The Installation

Below are script steps that you can use to install the packages and tools. These scripts follow the Google Shell Style Guide and I took some measures to reduce the width so that it would be nicely in this guide.

Repositories

Many of these tools are available from private repositories. You can add them with the following script below:

#!/usr/bin/env bash

main() {
  add_hashicorp_repo
  add_kubernetes_repo
  add_helm_repo
  add_corretto_repo

  sudo apt update
}

add_hashicorp_repo() {
  KEY="/usr/share/keyrings/hashicorp-archive-keyring.gpg"
  sudo rm -rf $KEY

  # Install HashiCorp's GPG key to package provided keyring area
  wget -O - https://apt.releases.hashicorp.com/gpg \
    | sudo gpg --dearmor -o $KEY

  # Add the official HashiCorp repository to your system.
  ARCH=$(dpkg --print-architecture)
  CODE=$(grep -oP '(?<=UBUNTU_CODENAME=).*' /etc/os-release)
  OPTIONS="arch=$ARCH signed-by=$KEY"
  URI="https://apt.releases.hashicorp.com "
  echo "deb [$OPTIONS] $URI $CODE main" \
    | sudo tee /etc/apt/sources.list.d/hashicorp.list
}

add_kubernetes_repo() {
  KEY="/usr/share/keyrings/kubernetes-apt-keyring.gpg"
  sudo rm -rf $KEY

  # Install Kubernetes's GPG key to package provided keyring area
  wget -O - https://pkgs.k8s.io/core:/stable:/v1.35/deb/Release.key \
    | sudo gpg --dearmor -o $KEY

  # Add the official Kubernetes repository to your system.
  OPTIONS="signed-by=$KEY"
  URI="https://pkgs.k8s.io/core:/stable:/v1.35/deb/"
  echo "deb [$OPTIONS] $URI /" \
    | sudo tee /etc/apt/sources.list.d/kubernetes.list
}

add_helm_repo() {
  KEY="/usr/share/keyrings/helm.gpg"
  sudo rm -rf $KEY

  # Install Helms's GPG key to package provided keyring area
  wget -O - https://packages.buildkite.com/helm-linux/helm-debian/gpgkey \
    | sudo gpg --dearmor -o $KEY

  # Add the official Helm repository to your system.
  OPTIONS="signed-by=$KEY"
  URI="https://packages.buildkite.com/helm-linux/helm-debian/any/"
  echo "deb [$OPTIONS] $URI any main" \
    | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
}

add_corretto_repo() {
  KEY=/usr/share/keyrings/corretto-keyring.gpg
  sudo rm -rf $KEY

  # Install Corretto's GPG key to package provided keyring area
  wget -O - https://apt.corretto.aws/corretto.key \
    | sudo gpg --dearmor -o $KEY

  # Add the official Corretto repository to your system.
  OPTIONS="signed-by=$KEY"
  URI="https://apt.corretto.aws"
  echo "deb [$OPTIONS] $URI stable main" \
    | sudo tee /etc/apt/sources.list.d/corretto.list
}

main
Enter fullscreen mode Exit fullscreen mode

Tools Installed from Repositories

For the tools that can be installed from these repositories, we can run through the following script below.

#!/usr/bin/env bash

# Install Common Tools
sudo apt install \
 apt-transport-https \
 ca-certificates \
 curl \
 gnupg \
 jq \
 software-properties-common \
 unzip

# Install Tools from Private Repos
sudo apt install terraform
sudo apt install vault
sudo apt install kubectl
sudo apt install helm
sudo apt install java-17-amazon-corretto-jdk
Enter fullscreen mode Exit fullscreen mode

Tools Installed as Binaries

#!/usr/bin/env bash

main() {
  # install AWS CLI
  install_binary_aws_cli
  install_binary_okta_aws_cli

  # install other binaries
  install_binary_kustomize
  install_binary_helmfile
}

install_binary_kustomize() {
  URL_PATH="kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
  URL_SCRIPT="https://raw.githubusercontent.com/$URL_PATH"
  curl -s "$URL_SCRIPT" | bash
  sudo mv ~/kustomize /usr/local/bin
}

install_binary_helmfile() {
  ARCH="amd64"
  VER="1.2.3"
  PKG="helmfile_${VER}_linux_$ARCH.tar.gz"
  URL_PATH="helmfile/helmfile/releases/download/v$VER/$PKG"
  URL="https://github.com/$URL_PATH"
  TEMP_DIR=$(mktemp -d)
  wget -qO- "$URL" | tar -xz -C "$TEMP_DIR"
  sudo mv $TEMP_DIR/helmfile /usr/local/bin
  rm -rf "$TEMP_DIR"
}

install_binary_okta_aws_cli() {
  ARCH="amd64"
  VER="2.5.1"
  PKG="okta-aws-cli_${VER}_linux_$ARCH.tar.gz"
  URL_PATH="okta/okta-aws-cli/releases/download/v$VER/$PKG"
  URL="https://github.com/$URL_PATH"
  TEMP_DIR=$(mktemp -d)
  wget -qO- "$URL" | tar -xz -C "$TEMP_DIR"
  sudo mv $TEMP_DIR/okta-aws-cli /usr/local/bin
  rm -rf "$TEMP_DIR"
}

install_binary_aws_cli() {
  TEMP_DIR=$(mktemp -d)
  PKG="awscli-exe-linux-x86_64.zip"
  wget "https://awscli.amazonaws.com/$PKG" -P $TEMP_DIR
  unzip $TEMP_DIR/$PKG -d $TEMP_DIR
  sudo $TEMP_DIR/aws/install
  rm -rf TEMP_DIR
}

main
Enter fullscreen mode Exit fullscreen mode

Verify Installations

# verify installations
terraform --version
vault --version
kubectl version --client
helm version
kustomize version
helmfile --version
java --version
aws --version
okta-aws-cli --version
Enter fullscreen mode Exit fullscreen mode

The Plugins

Both helm and Kubernetes can extend their functionality through a plugin. Here’s how you can get some popular plugins for these tools.

Helm Plugins

Helm has a few plugins that you can install, as shown below. I highly recommend the helm-diff, as this allows you to see what resources you will modify before installing or upgrading the the application.

Here are some examples:

helm plugin install https://github.com/databus23/helm-diff
helm plugin install https://github.com/aslafy-z/helm-git
helm plugin install https://github.com/hypnoglow/helm-s3.git
helm plugin install https://github.com/jkroepke/helm-secrets
Enter fullscreen mode Exit fullscreen mode

Kubernetes Plugin Engine

Kubernetes have a plugin system with Kubernetes Krew, which you can install using the script below.

#!/usr/bin/env bash

main() {
  install_krew

  # Add this in your startup scripts 
  export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
}

install_krew() {
  TEMP_DIR=$(mktemp -d)
  pushd $TEMP_DIR

  OS="$(uname | tr '[:upper:]' '[:lower:]')"
  ARCH="$(
    uname -m \
    | sed -e 's/x86_64/amd64/' \
          -e 's/\(arm\)\(64\)\?.*/\1\2/' \
          -e 's/aarch64$/arm64/'
  )"
  KREW="krew-${OS}_${ARCH}"
  PKG="/${KREW}.tar.gz"
  URL_PATH="kubernetes-sigs/krew/releases/latest/download/$PKG"
  URL="https://github.com/$URL_PATH"
  curl -fsSLO "$URL"
  tar zxvf "${KREW}.tar.gz"
  ./"${KREW}" install krew

  popd
  rm -rf TEMP_DIR
}

main
Enter fullscreen mode Exit fullscreen mode

Kubernetes Plugins

Once krew is installed, you can install some popular plugins.

Here are some examples:

kubectl krew install neat
kubectl krew install sort-manifests
kubectl krew install ktop
kubectl krew install tree
kubectl krew install graph
kubectl krew install cert-manager 
kubectl krew install get-all
kubectl krew install ice
kubectl krew install deprecations
kubectl krew install ns
kubectl krew install access-matrix
kubectl krew install pod-lens
kubectl krew install resource-capacity
Enter fullscreen mode Exit fullscreen mode

Conclusion

Ubuntu is a powerful platform for development, but it can be surprisingly complex for new developers, especially when it comes to installing and maintaining modern DevOps tooling. Most online instructions are fragmented, outdated, or inconsistent in how they handle repositories, keys, and binary installs. This can lead inconsistencies across developer workstations as well as production environments.

So my goal here is to reduce the complexity by providing consistent set of installation steps that follow best practices and rely on official sources wherever possible.

This can help avoid environment drift, especially when install scripts like this pin the tool versions and are routinely tested. This will help avoid those situations where you’ll hear: “works on my laptop”…

Ops Problem Now

Top comments (0)