DevOps Tutorial: Learn the Basics and the Tools of the Trade

DevOps has become the gold standard in modern IT, but it means different things to different people. What exactly is DevOps, and why has the demand for it increased so fast? DevOps is a collaboration between development and operation teams, which enables continuous delivery of applications and services to our end users. What makes DevOps stand out? Why is it chosen over the traditional method, and for what reasons? Let’s go over all the basics and some of the tools DevOps engineers are using today.

Are you preparing for a career in DevOps? Then take up the DevOps Certification Training Course. Check out the course curriculum now.

The following are the topics covered in this DevOps Tutorial blog:

  1. Why DevOps?
  2. What is DevOps?
  3. Benefits of DevOps
  4. Lifecycle of DevOps
  5. Tools in DevOps - 
    > Git
    > Maven
    > Selenium
    > Jenkins
    > Docker
    > Ansible
    > Nagios

DevOps Career Guide

A Guide to Becoming A DevOps EngineerDOWNLOAD GUIDE
DevOps Career Guide

Why DevOps?

Before DevOps, there were two development models: Waterfall and Agile Method.

1. Waterfall Model

The waterfall model is the first model to be introduced in software development. It is a sequential process and very easy to understand. In this approach, software development is divided into several phases, and the output of one phase becomes the input for the next phase. This model is similar to a waterfall when the water flows off from the cliff; it cannot go back to its previous state.

The phases are; Requirements, Design, Implementation, Verification, and Maintenance.

devops phase

Drawbacks of the waterfall model:

  • It’s difficult to make changes to the previous stage
  • Not recommended for large-sized projects
  • Developers and testers don’t work together (which can result in a lot of bugs at the end) 
  • Not recommended for projects that will likely have changing requirements

From the figure below, we can see the issues with the waterfall model:

  • The developer took a very long time to deploy code
  • On the operations side, the tester found it challenging to identify problems and give useful feedback

waterfall

2. Agile Model

Agile is an approach in software development where each project splits into multiple iterations. As a result, at the end of each iteration, a software product is delivered. Each iteration lasts about one to three weeks. Every iteration involves functional teams working simultaneously on various areas, such as:

  • Requirements
  • Design
  • Development
  • Release

The figure below indicates that there can be a number of iterations needed to deliver a final product in agile method.

iteration 

Using the agile method, the code that works for the developer may not work for the operations team.

So how can this issue be solved?

agile

With DevOps, there is continuous integration between deployment of code and the testing of it. Near real-time monitoring and immediate feedback through a DevOps continuous monitoring tool enables both the developer and operations team work together.

The figure below shows how well the software is handled using DevOps.

devops-model

What is DevOps?

DevOps is a collaboration between development and operation teams, which enables continuous delivery of applications and services to our end users. 

Benefits of DevOps

  • Continuous delivery of software
  • Better collaboration between teams
  • Easy deployment
  • Better efficiency and scalability
  • Errors are fixed at the initial stage
  • More security
  • Less manual intervention (which means fewer chances of error)

DevOps Lifecycle

The DevOps lifecycle is divided into six different phases:

  • Source Code Management - In this phase, the business owners and software development team discuss project goals and create a plan. Programmers then design and code the application, using tools like Git to store the application code.
  • Continuous Build and Test - This phase deals with building tools, like Maven and Gradle, then taking code from different repositories and combining them to build the complete application. The application is then tested using automation testing tools, like Selenium and JUnit, to ensure software quality.
  • Continuous Integration - When the testing is complete, new features are integrated automatically to the existing codebase.
  • Continuous Deployment - Here, the application is packaged after being released and deployed from the development server to the production server. Once the software is deployed, operations teams perform tasks, such as configuring servers and provisioning them with the required resources.
  • Continuous Monitoring - Monitoring allows IT organizations to identify issues of specific releases and understand the impact on end-users.
  • Software Released - After all the phases are completed and the software meets the user’s requirement, it is released into the market.

DevOps Engineer Master's Program

Bridge between software developers and operationsExplore Course
DevOps Engineer Master's Program

Tools in DevOps 

devops tools


1. Git

Git is a distributed version control tool used to manage source code.

Features of Git:

  • It’s a software tool

  • It is used to track changes in the source code

  • Multiple developers can work together

  • Supports non-linear development 

Architecture of Git

git

  • Working Directory is the folder where you are currently working on your Git project, and where the files are stored 
  • From Working Directory, the files are added to Staging Area before making a commit. After making any changes, commit the files to Local Repository
  • The committed files are pushed to Remote Repository. An example of a remote repository is GitHub
  • Later, when there are any updates to the code, Git pulls all the changes from Remote Repository to Local Repository
  • After the files are pulled, we can either create new branches and switch to them when required, or after the changes, we can merge new branches to the master branch

DEMO 

In this demo, we are going to validate if we have Git running on our computer. We are then going to create a directory, add a file to that directory, make some changes and finally use the commit command to check the files and validate them.

Steps:

1. Check if Git is installed using the following command:

$ git --version

git version 2.19.1.windows.1

2. Create a new folder using the command:

$ mkdir green

$ cd green

3. Validate if the “green” folder has been created by going and checking in the location.

4. Add the folder as a part of a Git project using the command:

$ git init

Initialized empty Git repository in C:/Users/sana.afreen/green/.git/

This creates a git repository

5. Create a text file called “class” in the new initialized folder. Open the text file and type in “Welcome to Simplilearn”. Save and close.

6. Check the status of the file on Git: 

$ git status

On branch master

7. Commit the file: 

$ git add class.txt


$ git commit -m “first commit”

( a description message will be displayed)

8. Go to class.txt and make some changes. In this case, change the text to “This is my Demo!” Then, save and close.

9. Compare between the original file and a new file with updates:

$ git diff

This will display the original file text and new update text.

2. Maven

Maven is an automation tool that helps teams build and manage software projects quickly.

Features of Maven:

  • Supports parallel builds
  • Easy to use
  • Instant access to new features with no additional configurations
  • Easy build process 

Architecture of Maven:

maven

The above figure indicates Maven’s architecture. 

  • Maven commands are executed in the POM (project object model) file. POM is an XML file that contains the details of the project and configuration details to build it 
  • The POM file checks for dependencies and fetches them from the local Maven repository
  • Plugins are built that were created in the Maven environment
  • The software is built

DEMO

In this demo, we are going to learn how to run a project on Maven.

Steps:

1. Download and install a JDK file

2. Download and install a Maven file

3. Set a number of system variables for the JDK path

  • Open control panel -> system and security -> advanced system settings -> edit system variable
  • Select path variable -> copy the path of the JDK folder and paste it to the variable name

4. Set system path to the Maven folder using the same steps above

5. Validate that all files have been extracted correctly

6. Open the command prompt and type in the following:

mv

7. Create a new user variable

Variable name - M2

Path - (path of apache maven folder)

8. Open the command prompt to see if Maven is installed:

mvn --version 

Creating maven project

9. Go into the Maven folder, create a new directory, call it Simplilearn and copy its path

10. Open the command prompt and change directory 

Cd (path) 

11. Install the POM file

…/simplilearn> mvn archetyp 

Define value for property ‘group_Id’: com.mav

Define value for property ‘artifact_Id’: mav.project

Define value for property version 1.0-SNAPSHOT: :1.0-SNAPSHOT

Define value for property package ‘com.mav’: : com.mav.demo

12. Go to the Simplilearn folder and make sure all the necessary files are there

3. Selenium

Selenium is an open-source automation tool that is used to test web applications, mainly for regression and functional testing. Regression testing is the process to make sure that the older programming still works with the new changes. Functional testing ensures that the application has adequately satisfied the requirements.

Features of Selenium:

  • Fast execution
  • High accuracy
  • Allows scripting in several languages
  • Supports parallel test execution

selenium

  • Selenium WebDriver codes are built using client libraries, like C#, Java, Python, JavaScript, and PHP
  • WebDriver’s Application Programming Interface (API) is used to automate web application testing more efficiently. The WEB driver API help users maintain their tests easier
  • The WebDriver service provider interface (SPI) is immutable and stateless. It sends the command to browser drivers using the JSON wire protocol
  • The driver manages the communication between the browsers and the JSON wire protocol
  • As soon the command is received from the WebDriver, the browser driver will execute it on the respective web browser

DEMO

In this demo, we are going to set up Selenium.

Steps:

1. Check if the right version of Java is installed. Open the command prompt and type “java”

java 

If Java is not installed, download it from: “https://www.oracle.com/technetwork/java/javase/downloads/index.html

2. Download and install Eclipse from “https://www.eclipse.org/downloads/” 

3. Download and install ChromeDriver from “https://chromedriver.chromium.org/

4. Download and install Selenium from “https://selenium.dev/downloads/

5. Open Eclipse -> create a new java project -> project name - xyz -> finish

  • Right click xyz -> new -> class -> name: simplilearn -> select public static void main-> package name:qwe -> finish
  • Test page is running. Next we have to validate if Selenium is part of the project.
  • Right click on src -> Build Path -> Configure Build Path -> we can see that Selenium is present.

6. Enter the following code:

package qwe;


Import java.util.cocurrent.TimeUnit;


import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

Import org.openqa.selenium.chrome.ChromeDriver;



public class simplilearn:


  public static void main(String [] args) {

System.setProperty(“web driver.chrome driver”, “(path of chrome web driver on your PC)\\Cchromedriver.exe”)

WebDriver driver = new ChromeDriver();

driver.manage().deleteAllCookies();

driver.manage().window().fullscreen();

driver.get(“https://www.amazon.in/”);

driver.FindElement(By.id(“twotabsearchtextbox”)).sendKeys(“puma shoes”);

driver.manage().timeouts().implicitelyWait(10,TimeUnit,SECONDS”);

driver.quit();

}

}


4. Jenkins

Jenkins is an open-source continuous integration tool. It helps to automate continuous development, testing, and deployment of newly created codes.

Features of Jenkins:

  • Easy installation and configuration
  • Has multiple plugins
  • Can be extended via plugins
  • Easily distributed across multiple machines

Architecture of Jenkins:

jenkins

  • The server architecture is broken down into two sections: one section is the source code repository, and the other side is the Jenkins continuous integration server
  • Jenkins master pulls the code from the source code repository if there are any changes The server regularly checks the repository for any changes
  • Jenkins master distributes its workload to all the slaves
  • By request from Jenkins master, the slaves accept tasks and produces test report

DEMO 

In this demo, we are going to install Jenkins.

Steps:

1. Check if Java is installed

   System-> advanced system settings -> Environment variables -> check is Java is available

2. Download and install Jenkins from “https://jenkins.io/download/

3. After installation, go to web browser and type “localhost:8080”, which navigates to the Jenkins dashboard

4. Click new item -> Enter item name : demo_1 -> select freestyle project -> Description : simplilearn demo -> Select none under source code management -> select build - execute windows batch command - command: echo “Hello all :%date :%time%” -> save 

5. Select build now. The different builds are seen

6. Under console output, we can see the output

7. Create another project -> Click new item -> Enter item name : Jenkins -> select freestyle project -> Description : demo using Git -> Select Git under source code management - repository URL : (URL of your Github account) - credentials : add Jenkin credentials -> select build - execute windows batch command - command: javac simpli.java

         Java simpli 

(command is the file on your GitHub account)

Save 

8. Select build now. The different builds are seen

9. Under console output we can see the output

4. Docker

Docker is an OS-level virtualization software platform that enables developers and IT administrators to create, deploy and run applications and all their dependencies in a Docker container. A Docker Container is an executable package of an application and its dependencies together.

Features of Docker:

  • High scalability and efficiency
  • Short boot-up uptime
  • Reusable data volumes 
  • Isolated applications

Architecture of Docker:

docker

  • The Docker client issues command to the Docker daemon
  • The Docker daemon is a server that interacts with the operating system and performs various tasks that the Docker client assigns
  • Docker images are a set of instructions that are used for creating Docker containers
  • Docker container is a lightweight software package that includes all the dependencies to run an application
  • Docker registry is a service to host and distribute Docker images among users

DEMO

In this demo, we are going to install and run Docker.

Steps:

1. Open Linux window

2. Install Docker using the following command:

$sudo apt install docker

3. To check how many Docker images are present in the system: 

$sudo docker images

4. To get an image from the Docker hub: 

$sudo docker pull redis:latest

5. To check if the image has been added to Docker”

$sudo docker images

6. To check if any other images are running: 

$sudo docker images

7. Create a container:

$sudo docker run -d -p0.0.0.0:80:80 redis:latest

8. To view all running containers:

$sudo docker ps -a

9. To rename a container:

$sudo docker rename stupefied_engelbart simplilearn


10. To validate everything:

$sudo docker ps -a

6. Ansible

Ansible is a configuration management tool allowing applications to be deployed automatically in a variety of environments.

Features of Ansible:

  • Push-based configuration tool
  • Agentless tool
  • Maintains consistency of a product’s performance
  • Uses SSH for secure connections

ansible

  • The module is a collection of configuration code files
  • Playbooks are used for configuration of multiple servers
  • Inventory is a document that groups the nodes
  • For a secure connection, the Ansible node connects to other nodes through SSH

DEMO

In this demo, we are going to install and run Ansible into our system using a Linux environment.

Steps:

1. Create two workstations on Linux: Master and Node

2. Enter the master Linux system and open terminal 

  • Install Ansible 

# sudo yum install ansible -y


# vi /etc/ansible/hosts                                           // to check if ansible is downloaded


.

.

.

.

.

[ansible servers]

192.168.2.127 ansible_ssh_pass=simplilearn ansible_ssh_user= root

  • Create a playbook to run a sample script 

# vi sample.yml

  • Run the playbook

# ansible-playbook sample.yml --syntax-check

# ansible-playbook sample.yml

3. Go to node Linux machine, click on Mozilla Firefox web browser and see the default web page with the word “welcome” in it.

4. Go to master Linux machine and see the playbook content that has “welcome” in it.

7. Nagios

Nagios is an open-source tool that is used to monitor systems, servers, networks, and storage infrastructure.

Features of Nagios:

  • Easy to use
  • Comprehensive monitoring
  • High availability
  • Problem remediation — enables an automatic restart of failed applications and services

Architecture of Nagios

nagios

  • The Nagios server continually checks the status of the system.
  • It then creates visualization tools of all the data, or alerts can be sent, such as an email or push notifications alerts. 
Are you skilled enough with the DevOps tools and concepts? Try answering these DevOps Exam Questions and find out yourself.

DEMO 

In this demo, we learn how to set up Nagios, and the dashboard now helps to monitor your network.

Steps:

1. Go to “https://www.nagios.com/”. You can either download the application or log in as an administrator or a normal user.

2. On the dashboard, there are three distinct areas: the fixed sources, alert summary, and abnormal behavior

3. You can set up additional sources, generate reports, check the status of alerts and create queries

4. Click on points of view -> create view -> first name : s, limiter: 192.3.5.40, data lifetime: 24 hours -> create 

5. Click on alert tab -> select new check 

  • Step 1 - select source

Please name the check for administration (Required): Workflow

  • Step 2- select the criteria

Analyze traffic for: Bytes

The warning threshold is: 34

The critical threshold is: 50 

(Necessary) : 5667

  • Step 3 - select the alert methods

Default is email, but you can choose between Nagios, SNMP Traps and Commands

  • Step 1 - Finish and Save
  • The new alert is now in pending status

To learn more on DevOps, refer to the following DevOps Tutorial video.

Conclusion

We hope this blog helped you understand Devops. You learned all about the origins of DevOps, the benefits it brings, and the DevOps lifecycle. You learned about some of the most important tools used in DevOps, details about the architecture of each, and how to use them in a practical example. If you want to learn more about DevOps, enroll in our DevOps Certification Training Course today.

About the Author

Sayeda Haifa PerveezSayeda Haifa Perveez

Haifa Perveez is passionate about learning new technologies and working on them. She is an engineer who loves to travel, read and write. She's always curious about things and very determined to track the latest technologies and the trends that they are creating for the future.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.