Complete DevOps Foundation Tutorials for Linux Admins - Textnotes

Complete DevOps Foundation Tutorials for Linux Admins


A step-by-step DevOps foundation guide covering Git, GitHub, Ansible, Jenkins, Docker, Kubernetes, and AWS basics tailored for Linux administrators.

1. Git and GitHub

Git is the most widely used version-control system. As a Linux Admin/DevOps engineer, you must know Git to manage scripts, automation code, infra-as-code, CI/CD pipelines, etc.

Install Git

RHEL/CentOS


sudo yum install git -y

Ubuntu


sudo apt install git -y

Configure Git


git config --global user.name "Muni"
git config --global user.email "muni@example.com"

Basic Git Commands

Initialize a repo


git init

Clone a repo


git clone https://github.com/user/repo.git

Check file status


git status

Add files


git add .

Commit changes


git commit -m "Updated script"

Push to GitHub


git push origin main

Pull changes


git pull

Git Branching


git branch dev
git checkout dev

Merge Branch


git checkout main
git merge dev

2. Ansible

Ansible is an automation tool used for configuration management, patching, deployments, and orchestration.

Install Ansible (RHEL)


sudo yum install ansible -y

Inventory File Example (/etc/ansible/hosts)


[web]
192.168.1.10
192.168.1.11

[db]
192.168.1.20

Test Connection


ansible all -m ping

Run a Command on All Servers


ansible all -a "uptime"

Simple Playbook Example

playbook.yml


- hosts: web
tasks:
- name: Install httpd
yum:
name: httpd
state: present

Run:


ansible-playbook playbook.yml

3. Jenkins Basics

Jenkins is a CI/CD automation tool widely used to automate deployments and build pipelines.

Install Jenkins (RHEL/CentOS)


sudo yum install java-11-openjdk -y
sudo yum install jenkins -y
sudo systemctl start jenkins
sudo systemctl enable jenkins

Access UI


http://<server-ip>:8080

Basic Jenkins Concepts

TermMeaning
Job/ProjectThe task Jenkins executes
PipelineScripted/Declarative automated flow
BuildRunning the job
WorkspaceDirectory where Jenkins runs builds

Create First Freestyle Job

Steps:

  1. New Item
  2. Freestyle Project
  3. Add Build Step → Execute shell
  4. Example:

echo "Deploying to dev environment"
  1. Save → Build Now

Simple Jenkins Pipeline Example


pipeline {
agent any
stages {
stage('Build') {
steps {
echo "Building Application..."
}
}
stage('Deploy') {
steps {
echo "Deploying App..."
}
}
}
}

4. Docker

Docker allows you to run applications in lightweight containers.

Install Docker


sudo yum install docker -y
sudo systemctl start docker
sudo systemctl enable docker

Basic Commands

Pull Image


docker pull nginx

Run Container


docker run -d -p 8080:80 nginx

List Containers


docker ps

Stop Container


docker stop <container_id>

Remove Container


docker rm <container_id>

Build Docker Image

Create Dockerfile:


FROM ubuntu
RUN apt-get update
CMD ["echo", "Hello from Docker"]

Build:


docker build -t myimage .

Run:


docker run myimage

5. Kubernetes Fundamentals

Kubernetes (K8s) manages containerized applications.

Key Components

ComponentDescription
PodSmallest unit in Kubernetes
NodeWorker machine
DeploymentController for pods
ServiceAccess pods internally/externally
NamespaceLogical separation

Install Kubernetes (Minikube)


minikube start

Check Cluster Status


kubectl get nodes

Create Deployment


kubectl create deployment web --image=nginx

Expose Deployment


kubectl expose deployment web --port=80 --type=NodePort

Check Services


kubectl get svc

Scale Application


kubectl scale deployment web --replicas=3

6. AWS Basics (EC2, VPC, IAM, S3)

AWS is the #1 cloud platform used by DevOps engineers.

EC2 (Linux server creation)

Launch EC2

Steps:

  1. Choose AMI (Amazon Linux / Ubuntu)
  2. Choose instance type (t2.micro)
  3. Configure VPC, subnet
  4. Add storage
  5. Add security group
  6. Launch with key pair

Connect to EC2


ssh -i key.pem ec2-user@<public-ip>

VPC (Virtual Private Cloud)

Key Components:

  1. VPC (Network)
  2. Subnets (Public/Private)
  3. Route tables
  4. Internet gateway
  5. NAT gateway

Create VPC (Basic)

  1. /16 network
  2. Create public subnet
  3. Associate route table

IAM (Identity & Access Management)

Create IAM User

  1. Go to IAM
  2. Add user
  3. Attach policy: AdministratorAccess or least privilege

Generate Access Keys

Used in CLI:


aws configure

S3 (Object Storage)

Create Bucket

AWS Console → S3 → Create Bucket

Upload File Using CLI


aws s3 cp file.txt s3://muni-bucket/

Download File


aws s3 cp s3://muni-bucket/file.txt .