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/Project | The task Jenkins executes |
| Pipeline | Scripted/Declarative automated flow |
| Build | Running the job |
| Workspace | Directory where Jenkins runs builds |
Create First Freestyle Job
Steps:
- New Item
- Freestyle Project
- Add Build Step → Execute shell
- Example:
echo "Deploying to dev environment"
- 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 | |
| Pod | Smallest unit in Kubernetes |
| Node | Worker machine |
| Deployment | Controller for pods |
| Service | Access pods internally/externally |
| Namespace | Logical 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:
- Choose AMI (Amazon Linux / Ubuntu)
- Choose instance type (t2.micro)
- Configure VPC, subnet
- Add storage
- Add security group
- Launch with key pair
Connect to EC2
ssh -i key.pem ec2-user@<public-ip>
VPC (Virtual Private Cloud)
Key Components:
- VPC (Network)
- Subnets (Public/Private)
- Route tables
- Internet gateway
- NAT gateway
Create VPC (Basic)
- /16 network
- Create public subnet
- Associate route table
IAM (Identity & Access Management)
Create IAM User
- Go to IAM
- Add user
- 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 .