0% found this document useful (0 votes)
2 views

DevOps_Basic

The document outlines various tasks related to DevOps concepts, Linux fundamentals, and system administration. It covers the DevOps lifecycle, principles, benefits, and practical steps for setting up a lab environment, including installing virtualization software and creating a CentOS 7 virtual machine. Additionally, it includes tasks on user and group management, package management, and Bash shell scripting.

Uploaded by

Laxman Bhandari
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

DevOps_Basic

The document outlines various tasks related to DevOps concepts, Linux fundamentals, and system administration. It covers the DevOps lifecycle, principles, benefits, and practical steps for setting up a lab environment, including installing virtualization software and creating a CentOS 7 virtual machine. Additionally, it includes tasks on user and group management, package management, and Bash shell scripting.

Uploaded by

Laxman Bhandari
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Table of Contents

TASK 1 ................................................................................................................. 1

DevOps Concepts:.................................................................................................................. 1
a) What is DevOps? How does DevOps Work?.............................................................. 1
b) Describe the DevOps lifecycle. ................................................................................... 2
c) Describe the DevOps Principles. ................................................................................. 3
d) Explain the benefits of DevOps. ................................................................................. 4

TASK 2 ................................................................................................................. 5

Preparing Lab Environment: .............................................................................................. 5


a) Installing VMware Workstation or VirtualBox? ......................................................... 5
b) Creating Virtual Machine of CentOS 7. ...................................................................... 7
c) Assign the hostname of Linux machine as <yourname>.devops.com. .................... 14
d) Configure your network interface with static ip address and start the network
service........................................................................................................................ 14
e) Map your static ip address to your hosts name in configuration file /etc/hosts....... 15

TASK 3 ............................................................................................................... 16

Linux Fundamentals: ......................................................................................................... 16


a) Write brief history of Linux. ..................................................................................... 16
b) Describe briefly about the following Linux Filesystems Hierarchy: ........................ 16
c) Login from root user then create folders according to following tree structure. ...... 17
d) Copy all the files that have .conf filename extensions inside /etc directory to
/root/backup directory............................................................................................... 18
e) Create a directory /root/selected, move all files of /root/backup directory that have
‘o’ or ‘a’ as the second character of their file name to /root/selected directory. ...... 18
f) Remove second character with r in path /root/backup. ............................................ 18
g) Remove all files and directories in path /root/backup. ............................................ 18

TASK 4 ............................................................................................................... 19

Users, Groups, Permission: ............................................................................................... 19


a) Create a user named student. .................................................................................... 19
b) Login from student user then create files and folders according to following tree
structure. [where, d→ directory and f→ file]............................................................ 19
c) Change the permission of the file f1 so that the owner will get full permission, group
member will get read and execute permission and others will get read-only
permissions. ............................................................................................................... 21
d) Change permission of the file f2 such that the owner’s and group members will get
read and write permission but others will get no permission. ................................... 21
e) Change permission of directory d3 such that all categories of users will get full
permissions. ............................................................................................................... 21

TASK 5 ............................................................................................................... 22

User and Group Administration:...................................................................................... 22


a) Task below are based on following structure. ........................................................... 22
b) Create group for each department (production, marketing, sales)........................... 22
c) Create user account (user1, user2, user3, user4, user5, user6, manager, boss) for
each employee assigning them respective group. ..................................................... 22
d) Create common dir (production, marketing and sales) for each department. ......... 23
e) Change ownership of group directories such that boss will become the owner and
the respective groups will be group owner................................................................ 23
f) Change the permission of the group directories such that only the owner and group
member will get full permission and other will not get any permission. .................. 23

TASK 6 ............................................................................................................... 24

Package and Service Management, and Firewall Configuration in CentOS7: ............ 24


a) Enable EPEL repository (epel-release package) and verify the repo configuration in
/etc/yum.repos.d. ....................................................................................................... 24
b) Install firewalld package as well as start and enable firewall services. .................... 24
c) Install httpd package as well as start and enable httpd services. ............................... 25
d) Add the following services and ports to allow packets through the firewall.[Service
= http, smtp port = 25 /tcp, 25/udp, 110/tcp] ............................................................ 25
e) Remove the following services and ports to block packets through the
firewall.[Service = smtp port = 25 /tcp, 25/udp] ...................................................... 25
TASK 7 ............................................................................................................... 26

Bash Shell Scripting: .......................................................................................................... 26


a) Write a command to find the path of the bash shell. ................................................. 26
b) Write a script named helloworld.sh to display “Hello World”. ................................ 26
c) Write a script named age.sh to prompt for age and display it. .................................. 26
d) Write a script named guesspass.sh to guess admin password. [password =
Redhat123] ................................................................................................................ 27
e) Write a script to calculate simple interest. ................................................................ 27
f) Write a script to determine the type of tringle by reading the lengths of its sides. ... 28
g) Write a script to determine if a inputted number is positive, negative, or Zero. ....... 28
h) Write a script to print the first 10 elements of Fibonacci series. ............................... 29
i) Create a shell script named “bg.sh” inside /root directory which when execute with
parameter ‘boy’, the output should be ‘girl’, when execute with the parameter ‘girl,
the output should be ‘boy’ & when execute with some other parameter or no
parameter the output should be “enter boy or girl only”] ......................................... 30
TASK 1
DevOps Concepts:
a) What is DevOps? How does DevOps Work?
The word DevOps is a combination of the terms development and operations, meant to
represent a collaborative or shared approach to the tasks performed by a company's
application development and IT operations teams. It is a set of practices, tools, and a
cultural philosophy that automate and integrate the processes between software
development and IT teams. It emphasizes team empowerment, cross-team communication
and collaboration, and technology automation. DevOps describes the adoption of iterative
software development, automation, and programmable infrastructure deployment and
maintenance. While DevOps is not a technology, DevOps environments generally apply
common methodologies. These include the following:
 Continuous integration and continuous delivery or continuous deployment (CI/CD)
tools, with an emphasis on task automation,
 Systems and tools that support DevOps adoption, including real-time monitoring,
incident management, configuration management and collaboration platforms,
 Cloud computing, microservices and containers implemented concurrently with
DevOps methodologies.

DevOps works by breaking down the traditional barriers between development and
operations teams, and by using tools and automation to streamline the software
development process. DevOps teams work to create a culture of collaboration and shared
responsibility, where developers and operations staff work together to build and deploy
software. They use automation tools to automate tasks such as testing, building, and
deploying code, which helps to speed up the development process and reduce errors.

1
b) Describe the DevOps lifecycle.
DevOps lifecycle is a series of automated development processes or workflows within an
iterative development lifecycle. It follows a continuous approach; hence its lifecycle is
symbolized in the form of an infinity loop. This loop depicts the collaborative and iterative
approach throughout the application lifecycle, consisting of tools and technology stacks for
each stage. The left part deals with software development and testing. And in contrast, the
right side of the infinity loop represents the deployment and operations cycle.

1. Plan: In this stage, teams identify the business requirement and collect end-user
feedback. They create a project roadmap to maximize the business value and deliver
the desired product during this stage.
2. Code: The code development takes place at this stage. The development teams use
some tools and plugins like Git to streamline the development process, which helps
them avoid security flaws and lousy coding practices.
3. Build: In this stage, once developers finish their task, they commit the code to the
shared code repository using build tools like Maven and Gradle.
4. Test: Once the build is ready, it is deployed to the test environment first to perform
several types of testing like user acceptance test, security test, integration testing,
performance testing, etc., using tools like JUnit, Selenium, etc., to ensure software
quality.

2
5. Release: The build is ready to deploy on the production environment at this phase.
Once the build passes all tests, the operations team schedules the releases or deploys
multiple releases to production, depending on the organizational needs.
6. Deploy: In this stage, Infrastructure-as-Code helps build the production
environment and then releases the build with the help of different tools.
7. Operate: The release is live now to use by customers. The operations team at this
stage takes care of server configuring and provisioning using tools like Chef.
8. Monitor: In this stage, the DevOps pipeline is monitored based on data collected
from customer behavior, application performance, etc. Monitoring the entire
environment helps teams find the bottlenecks impacting the development and
operations teams’ productivity.

c) Describe the DevOps Principles.


DevOps principles are a set of values and practices that guide the culture and processes of
DevOps. The following are the key principles of DevOps:
1. Collaboration: Work together and share responsibility.
2. Automation: Use tools and scripts to streamline tasks.
3. DevOps Pipeline: Establish a repeatable system, a loop that facilitates continuity
in development.
4. Continuous Integration and Delivery: Deliver updates frequently and with value
to users.
5. Continuous Monitoring: Keep an eye on the software in production to identify
issues and fix them quickly.
6. Infrastructure as Code: Treat infrastructure as a code artifact that can be version
controlled, tested, and deployed like any other software.
7. Version Control: Helps DevOps teams stay organized, focused, and up to date
with what members of the team are doing. It also ensure teams collaborate faster
and easier to support frequent software releases.
8. Lean Thinking: Use lean thinking principles to increase efficiency and reduce
waste.

3
d) Explain the benefits of DevOps.
DevOps proponents describe several business and technical benefits, many of which can
result in happier customers. Some benefits of DevOps include:
1. Faster time-to-market: DevOps helps teams deliver software updates more
quickly through automation and collaboration.
2. Higher quality software: DevOps practices catch issues earlier in development,
reducing bugs and defects in production.
3. Improved collaboration and communication: DevOps break down silos and
encourages closer collaboration and communication between teams.
4. Better feedback loops: DevOps promotes continuous monitoring and feedback,
allowing teams to address issues quickly and make improvements based on user
feedback.
5. Increased efficiency: DevOps automates tasks and eliminates wasteful processes,
helping teams work more efficiently.
6. More reliable infrastructure: Treating infrastructure as code allows for version
control and consistent deployment, resulting in more reliable infrastructure.
7. Cost savings: DevOps reduces waste and increases efficiency, leading to cost
savings for organizations.

4
TASK 2
Preparing Lab Environment:
a) Installing VMware Workstation or VirtualBox?
To install VMware Workstation follow the following steps:
Step1: Go to Download VMware Workstation Pro and download workstation 17 pro for
Windows or Linux according to the OS you have.

Step2: Run the installer named as “VMware-workstation-full-16.1.0-17198959.exe”.

Step3: Follow the steps:

2. Next
1. Next

5
3. Accept

4. Next 5. Next

9. Choose the location where


you want to install VMware
6. Check if you want update

7. Check
11. Next
8. Next 10. Check to automatically
add path into system

12. Choose if the desktop icon


is needed

13. Choose for start menu 14. Next 15. Install


program folder

16. Wait for Installation 17. Finish

6
b) Creating Virtual Machine of CentOS 7.
To create the CentOS & virtual machine follow the following steps:
Step1: Open VMware Workstation, and select create a new a Virtual Machine.

Step2: Choose Typical(recommended) then Next.

7
Step3: Choose I will install the operating system later then Next .

Step4: Choose Linux operating system and CentOS 7 64-bit as version and Next.

Step5: Add name for virtual machine and choose location for VM.

8
Step6: Specify Disk Capacity

Step7: Customize hardware as per need and finish

Step8: Download centOS7 iso file.


Step9: Go to Edit virtual machine setting
Step10: Go to CD/DVD ide, check connect at power on, and choose use iso image file
and OK.

9
Step11: Now click power on this virtual machine.

Step12: Select Install CentOS 7 and press Enter.

10
Step13: Select Language you like to use and press continue.

Step14:. Configure options Date and time, Language, Keyboard, Network and Hostname.

Step15: Choose the software Software Selection > Server with GUI > Done.

11
Step16: Choose Installation Destination as default and then Done.

Step17: Select Begin Installation.

Step18: Set password for root and create a user and wait for installation.

12
Step19: After completion of installation Reboot.

Step20: After reboot Accept License agreement > Done and Turn On Network.

Step21:Finish Configuration.

After following all the steps mentioned above our Virtual Machine of CentOS 7 is created
successfully.

13
c) Assign the hostname of Linux machine as <yourname>.devops.com.

d) Configure your network interface with static ip address and start the
network service.

14
e) Map your static ip address to your hosts name in configuration file
/etc/hosts.

15
TASK 3
Linux Fundamentals:
a) Write brief history of Linux.
Linux is a free and open-source operating system created by Linus Torvalds in 1991. It was
made as an alternative to proprietary operating systems like Windows and macOS. Linux
is known for its stability, security, and flexibility, and is widely used in many industries. It
is available in many different versions called distributions, and the Linux community
continues to contribute to its development.

b) Describe briefly about the following Linux Filesystems Hierarchy:


/boot, /root, /user, /home, /usr/bin, /bin, /user/sbin, /sbin, /usr/lib64, /lib64,
/usr/lib, /lib, /dev, /etc, /media, /mnt, /opt, /proc, /tmp, /var, /run.
1. /boot: Contains files needed for the boot process, including the Linux kernel and
bootloader.
2. /root: Home directory for the root user, which is the system administrator.
3. /user: A directory that typically contains subdirectories for user-specific data and
programs.
4. /home: Home directories for regular users on the system.
5. /usr/bin: Contains executable files for system-wide use.
6. /bin: Contains essential executable files required for booting and system maintenance.
7. /usr/sbin: Contains system administrator executables that are not essential for the
system boot process.
8. /sbin: Contains essential system administrator executables required for system booting
and maintenance.
9. /usr/lib64: Contains shared libraries for 64-bit applications.
10. /lib64: Contains shared libraries for 64-bit essential executables.
11. /usr/lib: Contains shared libraries for system-wide use.
12. /lib: Contains shared libraries for essential executables.
13. /dev: Contains device files for hardware devices.
14. /etc: Contains system configuration files.
15. /media: Mount point for removable media devices.
16. /mnt: Mount point for temporary filesystems.

16
17. /opt: Contains optional software packages.
18. /proc: A virtual filesystem that contains system process information.
19. /tmp: A directory for temporary files.
20. /var: Contains variable files, including logs and other data that changes frequently.
21. /run: Contains system runtime data.

c) Login from root user then create folders according to following tree
structure.

17
d) Copy all the files that have .conf filename extensions inside /etc directory
to /root/backup directory.

e) Create a directory /root/selected then move all files of /root/backup


directory that have ‘o’ or ‘a’ as the second character of their file name to
/root/selected directory.

f) Remove second character with r in path /root/backup.

g) Remove all files and directories in path /root/backup.

18
TASK 4
Users, Groups, Permission:
a) Create a user named student.

b) Login from student user then create files and folders according to
following tree structure. [where, d→ directory and f→ file]

19
20
c) Change the permission of the file f1 so that the owner will get full
permission, group member will get read and execute permission and
others will get read-only permissions.

d) Change permission of the file f2 such that the owner’s and group
members will get read and write permission but others will get no
permission.

e) Change permission of directory d3 such that all categories of users will


get full permissions.

21
TASK 5
User and Group Administration:
a) Task below are based on following structure.

b) Create group for each department (production, marketing, sales).

c) Create user account (user1, user2, user3, user4, user5, user6, manager,
boss) for each employee assigning them respective group.

22
d) Create common directory (production, marketing and sales) for each
department.

e) Change ownership of group directories such that boss will become the
owner and the respective groups will be group owner.

f) Change the permission of the group directories such that only the owner
and group member will get full permission and other will not get any
permission.

23
TASK 6
Package and Service Management, and Firewall Configuration in CentOS7:
a) Enable EPEL repository (epel-release package) and verify the repo
configuration in /etc/yum.repos.d.

b) Install firewalld package as well as start and enable firewall services.

24
c) Install httpd package as well as start and enable httpd services.

d) Add the following services and ports to allow packets through the
firewall.[Service = http, smtp port = 25 /tcp, 25/udp, 110/tcp]

e) Remove the following services and ports to block packets through the
firewall.[Service = smtp port = 25 /tcp, 25/udp]

25
TASK 7
Bash Shell Scripting:
a) Write a command to find the path of the bash shell.

b) Write a script named helloworld.sh to display “Hello World”.

c) Write a script named age.sh to prompt for age and display it.

26
d) Write a script named guesspass.sh to guess admin password. [password =
Redhat123]

e) Write a script to calculate simple interest.

27
f) Write a script to determine the type of tringle by reading the lengths of
its sides.

g) Write a script to determine if a user-inputted number is positive, negative,


or Zero.

28
h) Write a script to print the first 10 elements of Fibonacci series.

29
i) Create a shell script named “bg.sh” inside /root directory which when
execute with parameter ‘boy’, the output should be ‘girl’, when execute
with the parameter ‘girl, the output should be ‘boy’ & when execute with
some other parameter or no parameter the output should be “enter boy
or girl only”]

30

You might also like