Jan DevOps Batch 2024 Notes
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Day 1
DevOps + SRE + DevSecOps + MDE
DevOps - 2 Months - https://devopsschool.com/certification/devops-certified-professional-dcp.html
SRE =- 3.5 Months= DevOps + SRE tools - https://devopsschool.com/certification/sre-certified-professional-srecp.html
DevSecOps = 3.5 Months= DevOps + Security - https://devopsschool.com/certification/devsecops-certified-professional-dsocp.html
MDE = DevOps + SRE + DevSecOps = 4 Months
=====================================
9 AM IST - 3-4 Hours
====================
========================================================
How to get Video Recordings?
https://www.devopsschool.xyz/
-------------------------------
Last 3 Batch Recordings + Advance Recording
How get Step by Step Tutorials
----------------------------
I would share every session
https://www.devopsschool.com/blog/
How to get Slides?
============================
I would share every session
https://www.devopsschool.com/slides/
How do we get Assignment & Project?
==============================
I would share with u after session in Whatsapp Group
Where to submit an Assignment?
---------------------------
https://www.debug.school/
How to Submit Any question & Support?
---------------------------
https://www.debug.school/
Day 2 – 27 Jan 2024
PLATFORM
LINUX
VM
Virtualbox
CLOUD
AWS
Azure
GC
Docker
Kubernetes
============================================
What is Docker?
Aka Docker Engine
Container mgmt tool/platform
Written in Go lang
Rel
Community
Enterprise
Version
25.x
by Soloman Hykes
Why docker?
To Run Containers
What is Containers?
you can run apps in Container
Earlier - Desktop -> Laptop -> VMS -> Container
--------------------------------------------------------
1 hours -----> 5 mins --> 1 Sec
its lightweight
tool/platform
- save cost == Container consume less CPU/RAM/STORage/ No lic cost
- save time ==
- improve quality
mgmt
VMs - create -> start -> stop -> restart -> kill -> pause > unpa -> kil > remove
Containers - - create -> start -> stop -> restart -> kill -> pause > unpa -> kil > remove
=============================================================================
How to install Docker?
----------------------------
https://www.devopsschool.com/blog/how-to-install-docker-in-linux/
Docker architecture
----------------------------------------
YOU --> Docker Clinet --> Docker Server(Daemon) --> ContainerD --> Kernal
=======================================
Docker Engine
Components of Dockers
-----------------------------------------
Step 1 - Install Docker Engine
Step 2 - Download Docker Image
===============================
MACHINE IMAGE AWS AZUE VirtualBox
OS IMAGE AMI vm image ISO image
------------------
VM Image ==== BOOTFILESYSTE(Kernal) --> ROOTFILESYSTEM --> USERFS --> APPFS
=========================================================
1 Image
Docker Image =
ROOTFILESYSTEM --> USERFS --> APPFS
ubuntu --- root -- bash/ls/cd
centos --- rajesh -- java -- tomcat --app
Step 3 - From where?
===============================
Registry
Repo(S)
APP(Version of filesystem)
hub.docker.com
Step 4 -
Containers - - create -> start -> stop -> restart -> kill -> pause > unpa -> kil > remove
==========================
LOGIN TO VMS
===========> SHELL
ACCESS THE VM USING NETWORK
=== IP : PORT
110 clear
111 docker version
112 which docker
113 which dockerd
114 ps -eaf | grep dockerd
115 clear
116 docker pull httpd
117 docker images
118 docker version
119 clear
120 docker -v
121 docker info
122 clear
123 docker ps
124 docker ps -a
125 docker create httpd
126 docker ps
127 docker ps -a
128 docker start 82ebdf5f40a4
129 docker ps -a
130 docker stop 82ebdf5f40a4
131 docker ps -a
132 docker start 82ebdf5f40a4
133 docker ps -a
134 docker restart 82ebdf5f40a4
135 docker ps -a
136 clear
137 docker ps
138 docker pause 82ebdf5f40a4
139 docker ps
140 docker stats
141 docker ps
142 docker unpause 82ebdf5f40a4
143 docker ps
144 docker kill 82ebdf5f40a4
145 docker ps
146 docker ps -a
147 docker rm friendly_elgamal
148 docker ps -a
149 clear
150 docker create httpd
151 docker ps -a
152 docker rm b660a1c8eaee 803e25e307a2 6d72f20ea55c 7a6176ab998a 469b043b4cd1
153 docker ps -a
154 clear
155 ls
156 docker create httpd
157 docker ps -a
158 docker start 0c3b4c9354cb
159 docker ps -a
160 echo $SHELL
161 docker exec -it 0c3b4c9354cb /bin/bash
162 clear
163 docker ps
164 docker inspect 0c3b4c9354cb
165 curl http://172.17.0.2
11 Feb 2023
How to Get Linux VM?
---------------------
in your Laptop - DONE
How to Get Linux Container?
---------------------
in your Laptop - DONE
How to Get Linux VM in AWS?
---------------------
Pending
==========================================
70% - PURE LINUX
------------------------------------------
------------------------------------------
How to learn Linux?
-----------------------------------------
What is Kernel? - DONE
Users Commands -
Admin Commands -
Linux Troubleshooting
Bash Scripting -
=========================================
Users Commands -
======================================================================
https://www.devopsschool.com/commands
CMD === executable lying at certain path
CORE
YUm|APT
==========================================
CMD
min 10 of param
======================================================
How to communicate with hardware?
Console UI
CMDs
SHELL
LINUX
C shell
Sh
ksh
bash
Windows
ps
cmd
-----------------------------------
Know your SHELL? BASH
--------------
configuration
======================================
How Linux Login Works?
===================================
Protocla - SSH
SSH CLIENT ------------------------------> SSHD Server
PACKET OVER NETWORK
-------------------
IPADD
=======================================================
How to login to linux?
SSH
USER|PASS ------
USER|KEY ----- User key | PVT KEY
-----------------------
How SSH Key authentication Works in Linux?
How to Set Password less authentication in between 2 Linux server?
How to get more Access?
================================
Authentication ----> How to login?
USER|PASS ------
USER|KEY ----- User key | PVT KEY
Authorization - What you are allowed to do?
======================================
Types of User in linux?
----------------------------
Normal user | root user
How to get root access or how to run commands as a root?
===========================================================
SUDO
-------------------------
sudo without password
sudo with password
sudo with another user and password
Assignment
- What is Sudo?
- Know about the config file of Sudo
- How to add user and their in sudo acccess for sudo
========================================================
Impersinate
--------------------------
su
==============
==============================================================
PACKAGE Manager
Install | Remove | Update
=============================================================
Android|IPH LINUX Windows
PLAYSTORE|App Store Apt | Yum MS Store | chocolatey | nuget
apk| ipa .deb | .rpm exe|msi
Assignment
-----------------------------------------
What is Apt?
Top 10 Commands of used in APT
How to configure repo in Apt
What is yum?
Top 10 Commands of used in yum
How to configure repo in yum
=================================================================================
TOP 100 USERS Commands in Linux
Linux Tutorials: Commands for Linux User
20 2
---------------
================================================================
Archiving and compressing
----------------------------------
Archive
- tar
Compress
- gzip and gunzip
Archive + Compress
- zip
====================================================================
CHMOD VS CHOWN
===========================================
- rw- r-- r-- 1 root root 231696206 Dec 22 01:01 latest-unix.tar.gz
d rwx r-x r-x 10 root root 4096 Dec 23 09:10 nexus-3.64.0-01
==================================================
OWNER GROUP OTHERS
7 7 7
7 5 5 EXECUTE
RWX RX RX
6 4 4 DEFAULT
R read 4
W Write 2
X- Execute 1
==================
7
==============================================================
Chown
===================================
99 chown ubuntu:ubuntu latest-unix.tar.gz
100 sudo chown ubuntu:ubuntu latest-unix.tar.gz
101 ls -la
102 clear
103 ls
104 ls -la
105 chown rajesh:rajesh sonatype-work.zip
106 sudo chown rajesh:rajesh sonatype-work.zip
107 ls
108 ls -lrt
109 clear
110 ls
111 ls -la
112 clear
113 man chown
114 clear
115 ls
116 chown -R root:root sonatype-work
117 clear
118 ls
119 sudo chown -R root:root sonatype-work
120 ls -la
121 history
===========================================================
Finding a file Vs Finding a cOntent in the file
-------------------------------------------------
find VS grep
https://www.devopsschool.com/commands/tools/linux/find - 30 mins
grep
https://www.devopsschool.com/commands/tools/linux/grep - 30 mins.
===================
. - CURR
.. - BACK DIR
================================================
EDITOR
- vi FOCUS
- nano
- sed
- vim
=========================================
SonarQube
PLAN -> Code -> Ana -> Build
Jira git CodAna
conf py
What is SonarQube?
============================
Quality MGMT Tool
Tool
- Save cost
- Save time
- Imp Quality
MGMT
Quality
- Code Quality
Peer Code Review
Static Code Review
https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis
- Test Quality
by SonarSource
Release
Comm - Free
Develop
Enterprise
https://www.sonarsource.com/products/sonarqube/downloads/
Using Java
Static Code Review
----------------------------------------
Code Would Review Code
Rule Would Review Code
RuleS Would Review Code
tool Would Review Code
How SonarQube Works!!
----------------------------------------------------
Human --> SonarQube WEB ---> DB(RDBMS)
C:\tools\sonarqube\sonar-scanner\bin\sonar-scanner.bat
===========================================
Server sonar.properties
Scanner sonar-scanner.properties
Project sonar-project.properties
Ansible
What is Ansible?
-----------------------------
config mgmt tool
Release
ansible cmd - free
tower - GUI - PAID
awx - GUI - FREE
Python
From Redhat
config
SERVER(S) config mgmt
tool
save cost - Resources for Managing 1000s of server
save time
10 steps --- 1 mins -- 10 mins X 1000
10 steps - 1mins -- 10 mins - X 1000 - 10 mins
imp quality
mgmt
patching
install|remove
modify some files
modify some perm
SERVER
file
dir
user
group
package
services
==========================================
How Ansible works?
ACS - Ansible control server
ARS - ansible remote server
------------------------------------------
YOU -------> ACS ---------> ARS
ACS ---------------> ARS
Linux Any
python win - ps + dn
ansible NA
PROTO-----------SSH ------ Linux
------- winrm ----> Window
Component of ACS
=====================
Ansible
executables -----> 10s
modules ---------> python code --- run in ARS with param --- 1000s
plugins ---------> python code --- run in acs
configfile /etc/ansible/ansible.cfg
playbook
--- its a Script which run in ARS
Collection of Play
Play
inventory
--- file - contains IP ADDRESS of ARS
ACS
13.201.23.206
ARS
3.111.36.149
Ansible Adhoc commands
=============================
Requirement ---> deploy a webserver in prod
Step 1 - install apache2 in ubuntu apt
Step 2 - copy index.html to /var/www/html/ copy
Step 3 - Start apache service service
ansible localhost -m apt -a"name=apache2 state=latest"
ansible localhost -m copy -a"src=index.html dest=/var/www/html/"
ansible localhost -m service -a"name=apache2 state=started"
=====================================================
ansible all -i inventory -m apt -a"name=apache2 state=latest" -u ubuntu --key-file=node.pem -b
ansible all -i inventory -m copy -a"src=index.html dest=/var/www/html/" -u ubuntu --key-file=node.pem -b
ansible all -i inventory -m service -a"name=apache2 state=started" -u ubuntu --key-file=node.pem -b
inventory
------------
group - all
root@ip-172-31-10-141:~# more inventory
13.201.23.206
3.111.36.149
Behavioruial param
some_host ansible_port=2222 ansible_user=manager
aws_host ansible_ssh_private_key_file=/home/example/.ssh/aws.pem
freebsd_host ansible_python_interpreter=/usr/local/bin/python
ruby_module_host ansible_ruby_interpreter=/usr/bin/ruby.1.9.3
root@ip-172-31-10-141:~# more inventory
[web]
13.201.23.206
3.111.36.149
[db]
13.201.23.37
3.111.36.14
ansible web -i inventory -m apt -a"name=apache2 state=latest" -u ubuntu --key-file=node.pem -b
ansible web -i inventory -m copy -a"src=index.html dest=/var/www/html/" -u ubuntu --key-file=node.pem -b
ansible web -i inventory -m service -a"name=apache2 state=started" -u ubuntu --key-file=node.pem -b
===================================================
playbook
collection of play
yaml
what is play
host: localhost or all or web
tasks:
module1 and its pararm
module2 and its pararm
module3 and its pararm
- hosts: web
tasks:
- name: Install apache httpd
ansible.builtin.apt:
name: apache2
state: present
- name: Copy file with owner and permissions
ansible.builtin.copy:
src: index.html
dest: /var/www/html/index.html
- name: Start service httpd, if not started
ansible.builtin.service:
name: apache2
state: started
ansible-playbook -i inventory play.yaml -u ubuntu --key-file=node.pem -b
vars
https://www.devopsschool.com/blog/example-code-of-ansible-variable-with-playbook/
---
- name: Update web servers
hosts: web
vars:
myname: "Rajeshkumar"
age: "18"
packagename: "apache2"
servicename: "apache2"
vars_files:
- "vars.yaml"
vars_prompt:
- name: "version"
prompt: "Which version Do you want to install?"
private: no
tasks:
- name: Install Apache in ubuntu
ansible.builtin.apt:
name: "{{ packagename }}"
state: latest
- name: Copy index.html
ansible.builtin.copy:
src: index.html
dest: /var/www/html/index.html
- name: Starting a Apache Server
ansible.builtin.service:
name: "{{ servicename }}"
state: started
- name: Print return information from the previous task
ansible.builtin.debug:
var: myname
- name: Print return information from the previous task
ansible.builtin.debug:
msg: "My Name is {{ myname }} and My age is {{ age }}"
- name: Print return information from the previous task
ansible.builtin.debug:
var: version
ansible-playbook -i inventory varex.yaml -u ubuntu --key-file=node.pem -b
tasks
vars
files
---
- name: Calling role
hosts: web
roles:
- web
ansible-playbook -i inventory site.yaml -u ubuntu --key-file=node.pem -b