Ravindra BagaleCourses & study guides मराठी

How to Read This Course

DevOps

0.2 What you need before Chapter 1

Why: the problem

Many students stop at Chapter 3 because their laptop is not ready. Git is missing, Docker will not start, or the AWS CLI has no login. They lose a whole weekend fixing tools instead of learning. At companies like Infosys and TCS, the first day of a new DevOps engineer is also spent on this: install the tools, check versions, log in to the cloud. If the setup is done once, properly, every later lab just works. In this lesson you will set up the full lab: a Linux shell (Ubuntu, or WSL2 on Windows), Git, Docker, VS Code, the AWS CLI and a safe AWS login. You will run one small check for each tool, so you know it works before you need it. Do not skip this lesson. Ten minutes here saves ten hours later.

What we will build

You will build a ready-to-use DevOps lab: Ubuntu 22.04 (native, a VM, or WSL2), Git with your name and email, Docker Engine that runs without sudo, VS Code, and AWS CLI v2 logged in with a normal IAM user, not root. At the end one script, check-lab.sh, prints OK or MISSING for every tool.

What: every term in plain English

  • Ubuntu — A free Linux system. Most servers in the cloud run Linux.
  • WSL2 — Windows Subsystem for Linux 2. It runs a real Ubuntu inside Windows.
  • Terminal — The window where you type commands.
  • Git — A tool that saves every version of your files.
  • Docker Engine — The program that builds and runs containers.
  • VS Code — A free code editor from Microsoft.
  • AWS CLI — A command line tool to control AWS from your terminal.
  • IAM user — A login inside your AWS account with only the permissions you give it. Never use the root user for labs.
  • Free Tier — AWS offers some services free for new accounts, within limits.
Windows only: install WSL2 Install Git Tell Git who you are Install Docker Engine Run Docker without sudo Install AWS CLI v2 Log in to AWS safely
From an empty laptop to a ready DevOps lab

How: step by step

  1. Windows only: install WSL2

    wsl --install -d Ubuntu-22.04
    

    What it does: Run in PowerShell as Administrator. Installs Ubuntu inside Windows. Restart when asked.

    Output

    Installing: Ubuntu 22.04 LTS
    Ubuntu 22.04 LTS has been installed.
    The requested operation is successful. Changes will not be effective until the system is rebooted.
    
  2. Install Git

    sudo apt update && sudo apt install -y git && git --version
    

    What it does: Installs Git and prints its version.

    Output

    git version 2.34.1
    
  3. Tell Git who you are

    git config --global user.name "Ravi Kumar"
    git config --global user.email "ravi@example.com"
    

    What it does: Every commit will carry this name and email.

    Output

    (no output means it worked)
    
  4. Install Docker Engine

    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    

    What it does: Downloads and runs Docker's official install script for Ubuntu.

    Output

    # Executing docker install script
    + sh -c apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
    Client: Docker Engine - Community
     Version: 26.1.3
    
  5. Run Docker without sudo

    sudo usermod -aG docker $USER
    newgrp docker
    docker run --rm hello-world
    

    What it does: Adds you to the docker group and tests with the hello-world image.

    Output

    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    
  6. Install AWS CLI v2

    curl -fsSL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip
    unzip -q awscliv2.zip && sudo ./aws/install
    aws --version
    

    What it does: Downloads the official AWS CLI and installs it.

    Output

    You can now run: /usr/local/bin/aws --version
    aws-cli/2.17.20 Python/3.11.9 Linux/5.15.0 exe/x86_64.ubuntu.22
    
  7. Log in to AWS safely

    aws configure sso
    aws sts get-caller-identity
    

    What it does: Logs in with IAM Identity Center (short-lived keys). Then asks AWS who you are.

    Output

    {
        "UserId": "AROA...:ravi",
        "Account": "111122223333",
        "Arn": "arn:aws:sts::111122223333:assumed-role/AWSAdministratorAccess/ravi"
    }
    

Example 1: A lab checker script that says OK or MISSING for each tool

Stack. Bash, Ubuntu 22.04

Goal. A lab checker script that says OK or MISSING for each tool.

check-lab.sh

#!/usr/bin/env bash
for tool in git docker aws code curl; do
  if command -v "$tool" > /dev/null 2>&1; then
    printf "%-8s OK      %s\n" "$tool" "$("$tool" --version 2>&1 | head -1)"
  else
    printf "%-8s MISSING\n" "$tool"
  fi
done

terminal

chmod +x check-lab.sh
./check-lab.sh

What each line does

  • for tool in ... — Loops over every tool name.
  • command -v "$tool" — Finds the tool. It fails if the tool is not installed.
  • > /dev/null 2>&1 — Hides both normal output and errors.
  • printf "%-8s ..." — Prints the name in a column 8 characters wide, so the table lines up.
  • --version | head -1 — Shows only the first line of the version.

Green output

git      OK      git version 2.34.1
docker   OK      Docker version 26.1.3, build b72abbb
aws      OK      aws-cli/2.17.20 Python/3.11.9 Linux/5.15.0
code     OK      1.94.2
curl     OK      curl 7.81.0 (x86_64-pc-linux-gnu)

Expected result. Every line says OK. Run this script whenever a lab behaves strangely.

Example 2: Prove Docker, Git and AWS work together with one tiny project

Stack. Git 2.34, Docker 26, Python 3.12 image, AWS CLI v2

Goal. Prove Docker, Git and AWS work together with one tiny project.

terminal

mkdir -p ~/devops-lab/hello && cd ~/devops-lab/hello
git init
echo "print('hello devops')" > app.py
printf 'FROM python:3.12-slim\nCOPY app.py .\nCMD ["python","app.py"]\n' > Dockerfile
git add . && git commit -m "first lab"
docker build -t hello:1 . && docker run --rm hello:1
aws s3 ls | head -3

What each line does

  • git init — Starts a new Git repository in this folder.
  • printf ... > Dockerfile — Writes a three-line Dockerfile without opening an editor.
  • git commit -m — Saves the first version.
  • docker build / run — Builds the image and runs it once. --rm deletes the container after.
  • aws s3 ls — Lists your S3 buckets. An empty list is fine; an error is not.

Green output

Initialized empty Git repository in /home/ravi/devops-lab/hello/.git/
[master (root-commit) 1a2b3c4] first lab
 2 files changed, 4 insertions(+)
 => naming to docker.io/library/hello:1
hello devops

Expected result. Git saved the files, Docker ran them, and AWS answered. Your lab is ready.

Example 3: Open the project in VS Code from the terminal, the way you will work every day

Stack. VS Code 1.94

Goal. Open the project in VS Code from the terminal, the way you will work every day.

terminal

cd ~/devops-lab/hello
code .
code --install-extension ms-azuretools.vscode-docker
code --install-extension redhat.vscode-yaml
code --list-extensions

What each line does

  • code . — Opens the current folder in VS Code. On WSL it opens the Windows VS Code connected to Ubuntu.
  • --install-extension ms-azuretools.vscode-docker — Adds Docker support: build, run and see containers.
  • --install-extension redhat.vscode-yaml — Checks YAML files, which you will write for Compose, Kubernetes and pipelines.
  • --list-extensions — Shows what is installed.

Green output

Installing extensions...
Extension 'ms-azuretools.vscode-docker' was successfully installed.
Extension 'redhat.vscode-yaml' was successfully installed.
ms-azuretools.vscode-docker
redhat.vscode-yaml

Expected result. VS Code opens your folder and understands Dockerfile and YAML files.

Verify: did it work?

  1. Check your tool versions

    git --version
    docker --version
    aws --version
    

    What it does: Prints the version of each tool. If one says "command not found", go back to lesson 0.2.

    Output

    git version 2.43.0
    Docker version 26.1.3, build b72abbb
    aws-cli/2.17.20 Python/3.11.9 Linux/6.5.0 exe/x86_64.ubuntu.22
    
  2. Check Docker runs without sudo

    docker ps
    

    What it does: An empty table is good. A permission error means the group step is not done.

    Output

    CONTAINER ID   IMAGE   COMMAND   CREATED   STATUS   PORTS   NAMES
    

When it is red 1

Unable to locate credentials. You can configure credentials by running "aws configure".

Cause. The AWS CLI has no login.

Fix, step by step

  1. Run aws configure sso (best) or aws configure with an IAM user's keys.
  2. Run aws sts get-caller-identity.
  3. Never use the root account keys.

When it is red 2

WslRegisterDistribution failed with error: 0x80370102

Cause. Virtualisation is off in the BIOS, or the Windows feature is missing.

Fix, step by step

  1. Turn on Intel VT-x or AMD-V in the BIOS.
  2. In PowerShell (admin) run: wsl --install again.
  3. Restart Windows.

When it is red 3

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Cause. Docker is installed but not started.

Fix, step by step

  1. Run sudo systemctl start docker.
  2. Run sudo systemctl enable docker so it starts at boot.
  3. Run docker ps again.

Cleanup

  1. Remove the test image

    docker rmi hello:1
    

    What it does: Deletes the small test image.

    Output

    Untagged: hello:1
    
  2. Remove the installer files

    rm -rf get-docker.sh awscliv2.zip aws/
    

    What it does: Deletes the downloaded installers. The tools stay installed.

    Output

    (no output means it worked)
    

Ravindra Bagale's Tip

Do the lab setup once, carefully. When check-lab.sh shows everything OK, move on. Never use the root user for daily work. Keep that in mind!

Practice tasks

Easy Run hello-world

Why: The first test of any Docker install.

What to do: Run docker run --rm hello-world.

How:
  1. docker run --rm hello-world

Check: You see Hello from Docker!

Medium Set a billing alarm

Why: Labs must never surprise you with a bill.

What to do: Create a zero-spend budget in AWS Budgets.

How:
  1. Open Billing and Cost Management, Budgets.
  2. Choose the Zero spend budget template.
  3. Enter your email.

Check: You get a confirmation email from AWS Budgets.

Hard Rebuild the lab on a VM

Why: A fresh machine proves your notes are complete.

What to do: Create a new Ubuntu VM in VirtualBox or an EC2 t3.micro and set up all tools using only your notes.

How:
  1. Follow your notes.
  2. Run check-lab.sh.

Check: All lines OK in under 30 minutes.

Easy Say Lab setup in two lines

Why: If you can say it simply, you understand it. Interviewers want the short version first.

What to do: Write two short lines about Lab setup for a friend who is new to IT.

How:
  1. Write what problem it solves.
  2. Write one command or file you used for it.
  3. Read it aloud.

Check: Your friend understands it without asking a question.

Easy Run the commands again from memory

Why: Typing from memory makes the commands stick. Copy-paste does not.

What to do: Close this page and run the main steps of this lesson again.

How:
  1. Open a fresh terminal.
  2. Type each command yourself.
  3. Open the page only when stuck.

Check: You got the same green output without copying.

Medium Break it on purpose

Why: You must know the red message by face. In a real job there is no time to read slowly.

What to do: Cause one error from the "When it is red" part of this lesson and fix it.

How:
  1. Follow one error section.
  2. Copy the exact message into your notes.
  3. Write the fix in one line.

Check: You fixed it using only your notes.

Medium Write a one-page note

Why: A short note in your own words is the best revision.

What to do: Write a note page for this lesson in ~/devops-lab/notes.md.

How:
  1. Title, why, the commands, one error and its fix.

Check: A classmate can follow your note alone.

Hard Explain it like an interview

Why: Interviewers want real stories, not definitions.

What to do: Record a 60 second answer about this lesson on your phone.

How:
  1. Say the problem, what you did, the command you ran, and one error you hit.

Check: Your answer has a real command and a real error message.

Hard Draw the flow top to bottom

Why: A drawing shows the order of things.

What to do: Draw this lesson as boxes from top to bottom on paper.

How:
  1. One box per step.
  2. Write the command next to each box.

Check: Each box matches a step you really ran.

Easy Teach it to someone

Why: Teaching shows the gaps in your own understanding.

What to do: Explain this lesson to a friend or family member in five minutes.

How:
  1. Use one real app as the example (Swiggy, Netflix, Paytm).

Check: They can tell you back the main idea.

Homework: try at home

Try at home

At home, run check-lab.sh on your machine and screenshot the output. If any line says MISSING, install that tool using the steps in this lesson and run the script again until everything is OK.

Recap

  • Use Ubuntu 22.04: native, VM, or WSL2 on Windows.
  • Install Git, Docker, VS Code and AWS CLI v2.
  • Run Docker without sudo by joining the docker group.
  • Log in to AWS with SSO or an IAM user, never root.
  • Keep check-lab.sh and run it when something feels wrong.

FAQ

My laptop has 8 GB RAM. Is it enough?

Yes for most labs. For Kubernetes labs, close the browser tabs you do not need, or use a small cloud VM.

Can I use a Mac?

Yes. Use Homebrew for Git and AWS CLI and Docker Desktop or Colima for Docker. Commands are the same.

Docker Desktop or Docker Engine?

On Ubuntu and WSL2, Docker Engine is free and light. Docker Desktop needs a paid licence in big companies.

Should I use aws configure with access keys?

Only if you cannot use SSO. Never commit keys to Git.

Do I need a credit card for AWS?

Yes, AWS asks for one. Set a zero-spend budget the same day.

Interview questions

  1. How do you set up a new DevOps workstation?

    Install a Linux shell, Git, Docker, an editor and the cloud CLI, then verify each with a version or test command.

  2. Why should engineers not use the AWS root user?

    It cannot be limited by IAM policies. Use least-privilege IAM users or SSO with MFA.

  3. What is WSL2?

    A Windows feature that runs a real Linux kernel, so Linux tools work on Windows.

  4. How do you check who you are logged in as in AWS?

    aws sts get-caller-identity.

  5. Why add a user to the docker group, and what is the risk?

    To run Docker without sudo. The risk is that the docker group is root-equivalent on that machine, so only trusted users get it.

Quick quiz

Q1. Which Linux do we use in this course?

Ubuntu 22.04 (native, VM or WSL2).

Q2. Why not use the AWS root user for labs?

It has full power over the account. A leak or mistake can cost a lot. Use an IAM user or SSO.

Q3. Which command proves AWS login works?

aws sts get-caller-identity.

Q4. How do you run Docker without sudo?

Add your user to the docker group and log in again.

Q5. What does git config --global user.email set?

The email saved in every commit you make.

Did you understand? Let us try it once more.