Author: Amitabh Soni

Install Essential DevOps Tools on Ubuntu/Linux

In this guide, we’ll cover step-by-step instructions for installing the following DevOps tools on Ubuntu/Linux: AWS CLI, Docker, Jenkins, Kubernetes (KIND), Minikube, Kubectl, Terraform, Ansible, Prometheus, Grafana, kubeadm, ArgoCD, and eksctl. Each tool plays a vital role in the DevOps ecosystem, and this blog aims to help the community with detailed installation steps.


Prerequisites

  1. A system running Ubuntu 20.04 or later.
  2. A user with sudo privileges.
  3. Basic knowledge of the Linux command line.
  4. Internet connectivity.

1. Install AWS CLI

The AWS CLI allows you to interact with AWS services from the command line.

Steps:

  1. Download the AWS CLI installer:
    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
  2. Install unzip if not already installed :
    sudo apt install -y unzip
  3. Unzip the installer:
    unzip awscliv2.zip
  4. Run the installer:
    sudo ./aws/install
  5. Verify the installation:
    aws --version
  6. Configure AWS CLI:
    aws configure

    Enter the following details:
    • AWS Access Key ID
    • AWS Secret Access Key
    • Default region
    • Default output format (e.g., JSON)

Steps to Retrieve AWS Access Key ID and Secret Access Key:

  1. Log in to the AWS Management Console:
  2. Navigate to the IAM Dashboard:
    • Click on Services and search for IAM (Identity and Access Management).
  3. Create a New IAM User:
    • Select Users from the left menu and click Add Users.
    • Provide a username and select Programmatic Access as the access type.
  4. Assign Permissions:
    • Choose an existing policy (e.g., AdministratorAccess) or create a custom policy.
  5. Review and Create:
    • Review the settings and click Create User.
  6. Download the Credentials:
    • Save the Access Key ID and Secret Access Key securely, and copy them to paste during the aws configure setup process.

2. Install Docker

Docker simplifies application containerization. Here’s how to install Docker on Ubuntu:

Steps:

  1. Update the package index:
    sudo apt update sudo apt upgrade -y
  2. Install dependencies:
    sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
  3. Add Docker’s official GPG key:
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  4. Set up the Docker repository:
    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" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  5. Install Docker:
    sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io
  6. Verify the installation:
    docker --version
  7. Enable Docker to start on boot:
    sudo systemctl enable docker
  8. Run Docker without sudo (optional):
    sudo usermod -aG docker $USER newgrp docker

3. Install Jenkins

Jenkins is a CI/CD automation server.

First Install JAVA on instance using :

sudo apt install openjdk-17-jdk

Steps:

  1. Install dependencies:
    sudo apt-get install -y ca-certificates curl gnupg
  2. Add the Jenkins repository key:
    curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
  3. Add Jenkins to APT sources:
    echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
  4. Install Jenkins:
    sudo apt-get update sudo apt-get install jenkins -y
  5. Enable Jenkins to start on boot:
    sudo systemctl enable jenkins sudo systemctl start jenkins
  6. Verify Jenkins status:
    sudo systemctl status jenkins
  7. Access Jenkins: Open a browser and navigate to http://<your-ip>:8080. Use the password located in /var/lib/jenkins/secrets/initialAdminPassword.

4. Install Kubernetes (KIND)

KIND (Kubernetes IN Docker) runs Kubernetes clusters in Docker containers.

Steps:

  1. Install Docker (if not already installed): Refer to the Docker installation steps above.
  2. Download KIND binary:
    curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
  3. Make the binary executable:
    chmod +x ./kind sudo mv ./kind /usr/local/bin/kind
  4. Verify installation:
    kind --version

5. Install Minikube

Minikube is another lightweight Kubernetes option for local development.

Steps:

  1. Download Minikube binary:
    curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
  2. Make the binary executable:
    chmod +x minikube-linux-amd64
  3. Move the binary to a directory in your PATH:
    sudo mv minikube-linux-amd64 /usr/local/bin/minikube
  4. Verify installation:
    minikube version

6. Install Kubectl

Kubectl is a command-line tool for interacting with Kubernetes clusters.

Steps:

  1. Download the latest Kubectl binary:
    curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
  2. Make the binary executable:
    chmod +x kubectl
  3. Move the binary to a directory in your PATH:
    sudo mv kubectl /usr/local/bin/
  4. Verify installation:
    kubectl version --client

7. Install Terraform

Terraform manages infrastructure as code (IaC).

Steps:

  1. Download the Terraform binary:
    curl -fsSL https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_linux_amd64.zip -o terraform.zip
  2. Install the unzip tool (if not installed):
    sudo apt install -y unzip
  3. Extract and move the binary:
    unzip terraform.zip sudo mv terraform /usr/local/bin/
  4. Verify installation:
    terraform --version

8. Install Ansible

Ansible automates IT tasks.

Steps:

  1. Install Ansible using the package manager:
    sudo apt update sudo apt install -y ansible
  2. Verify installation:
    ansible --version

9. Install Prometheus

Prometheus is a monitoring and alerting toolkit.

Steps:

  1. Download Prometheus:
    wget https://github.com/prometheus/prometheus/releases/download/v2.50.0/prometheus-2.50.0.linux-amd64.tar.gz
  2. Extract the archive:
    tar -xvzf prometheus-2.50.0.linux-amd64.tar.gz cd prometheus-2.50.0.linux-amd64
  3. Move binaries to /usr/local/bin:
    sudo mv prometheus promtool /usr/local/bin/
  4. Create a Prometheus config directory:
    sudo mkdir /etc/prometheus sudo mv prometheus.yml /etc/prometheus/
  5. Verify Prometheus installation:
    prometheus --version
  6. Start Prometheus:
    prometheus --config.file=/etc/prometheus/prometheus.yml

10. Install Grafana

Grafana visualizes data collected by Prometheus.

Steps:

  1. Add Grafana’s repository:
    sudo apt update sudo apt install -y software-properties-common wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
  2. Install Grafana:
    sudo apt update sudo apt install -y grafana
  3. Start and enable Grafana:
    sudo systemctl start grafana-server sudo systemctl enable grafana-server
  4. Access Grafana: Open a browser and navigate to http://<your-ip>:3000. Use default credentials (admin/admin).

11. Install Helm

Prerequisites:

  • Ensure Kubernetes is running (using KIND, Minikube, or any other method).
  • Helm requires a Kubernetes cluster running version 1.18+.
  • Install Kubectl as well
  • Verify your Kubernetes setup by running:
    kubectl version --client
  • Ensure the cluster is accessible and kubectl is configured correctly:
    kubectl get nodes

Helm is a package manager for Kubernetes, which simplifies deploying and managing Kubernetes applications.

Steps:

  1. Get the Helm shell file:
    curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
  2. Change permission and run shell file:
    chmod 700 get_helm.sh ./get_helm.sh
  3. Verify installation:
    helm version

12. Deploy Prometheus and Grafana Using Helm

Using Helm makes it much easier to deploy complex applications like Prometheus and Grafana in Kubernetes.

Prerequisites:

  • Ensure Kubernetes is running (using KIND, Minikube, or any other method).
  • Install Helm (see the Helm installation steps above).

Steps:

  1. Add the Helm repository for Prometheus and Grafana:
    helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo add grafana https://grafana.github.io/helm-charts helm repo update
  2. Create a namespace for monitoring tools:
    kubectl create namespace monitoring
  3. Install Prometheus using Helm:
    helm install prometheus prometheus-community/prometheus --namespace monitoring
  4. Verify Prometheus installation:
    kubectl get pods -n monitoring
  5. Install Grafana using Helm:
    helm install grafana grafana/grafana --namespace monitoring
  6. Verify Grafana installation:
    kubectl get pods -n monitoring
  7. Access Grafana:
    • Forward the Grafana service port to localhost:
      kubectl port-forward svc/grafana 3000:80 -n monitoring
    • Open your browser and go to http://localhost:3000. Use default credentials (admin/admin).

13. eksctl Installation

eksctl is a command-line tool that simplifies the creation and management of Kubernetes clusters on Amazon EKS.

Steps:

  1. Update the package index:
    sudo apt update sudo apt upgrade -y
  2. Download eksctl binary:
    curl -sL "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" -o eksctl.tar.gz
  3. Extract the binary:
    tar -xzf eksctl.tar.gz
  4. Move the binary to a directory in your PATH:
    sudo mv eksctl /usr/local/bin
  5. Verify the installation:
    eksctl version

14. Steps to Install ArgoCD:

  1. Create the ArgoCD Namespace:
    kubectl create ns argocd
  2. Install ArgoCD: Apply the ArgoCD manifests to install it:
    kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
  3. Verify ArgoCD Installation: Check the pods in the argocd namespace to ensure they are running:
    kubectl get pods -n argocd
  4. Accessing the ArgoCD UI: By default, the ArgoCD server is exposed as a ClusterIP service. To access the UI:
    • Option 1: Port Forwarding
      Forward the port to your local machine:
      kubectl port-forward svc/argocd-server -n argocd 8080:443

      Access the UI at:
      https://localhost:8080
    • Option 2: Change Service to NodePort
      Update the ArgoCD server service to NodePort:
      kubectl edit svc argocd-server -n argocd

      Change type: ClusterIP to type: NodePort.
      Access ArgoCD at:
      http://<node-ip>:<node-port>

ArgoCD Initial Admin Password:

Retrieve the default password for the admin user:

kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 --decode

Use this password with the username admin to log in to the UI.


CLI Setup:

Install the ArgoCD CLI to interact with the cluster:

curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd
rm argocd-linux-amd64
argocd login <ARGOCD_SERVER> -u <username> -p <password>

Conclusion

By following these steps, you now have a fully functional DevOps toolkit installed on your Ubuntu/Linux system. Each tool can now be used to automate, monitor, and manage your infrastructure efficiently. If this guide helped you, consider sharing it with others in the DevOps community!

3. Decode the password:

kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d

This will return the decoded password.


6. Login to ArgoCD CLI

Once you have the password, you can log in to the ArgoCD server using the following command:CopyCopy

argocd login <ARGOCD_SERVER> -u admin -p <password>
  • <ARGOCD_SERVER>: Replace this with the address of your ArgoCD server (e.g., argocd.example.com or an IP address).
  • <password>: Replace this with the decoded admin password retrieved in the previous step.

Author: Amitabh Soni

Categorized in:

Blog,