1: DevOps Prerequisite course Flashcards

1
Q

What is a LAMP stack application?

A

Linux, Apache, MySQL, PHP. You can substitute some of those though.. my Nginx instead of apache, or python instead of PHP , for example.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 4 steps of building and pushing an app to prod?

A

1: Develop -> GIT
2: Build : on build server complies/builds app
3: On test server: test app for bugs
4: move to prod server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the point of CI/CD? some common tools?

A

Helps automate the develop, build, test, deploy. Jenkins, Github actions, Gitlab CI/CD are examples. This can automate the entire process to allow bug fixes and such to happen faster.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the benefit of a docker file in the develop, build, test production pipeline?

A

A developer can configure a docker file to contain all of the application dependencies which ensures the entire pipeline has those dependencies available. “docker build” “docker run”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Kubernetes orchestrates the containers, what handles the underlying servers?

A

Terraform can configure servers regardless of what cloud platforms they are on. If someone changes a server config, teraform will changed it back! this is IaC. storage, networking, virtual machine, all of it in this code. terraform is used for provisioning infrastructure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Where does ansbile come into there Kubernetes/terraform stack?

A

Kubernetes is for the contains. Terraform configures the underlying infrastructure. Ansible is automated tool to configure infrastructure once created. this code is also stored on github

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Where does Prometheus/Grafana come into the kubernetes/terraform/ansible stack?

A

Prometheus collects and visualizes metrics. Grafana will visualize this data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Linux command: echo $shell

A

This will show which shell is being used. /bin/bash should be the most common. that is the bash shell.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Linux command: echo Hi

A

This will write Hi to the screen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Linux command: ls

A

Used to list files in directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Linux command: pwd

A

Used to display current path

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Linux operator to run multiple commands on same line?

A

semi-colon : example: cd /home/my_dir; ls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

linux cmd: md

A

Make directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the linux command to create an entire directory tree for /mydir/mydir1/mydir2/mydir3

A

mkdir -p /mydir/mydir1/mydir2/mydir3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

linux command to remove directory and all if its contents?

A

rm -r /mp/my_dir

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

linux command to copy a directory and all contents?

A

cp -r /temp/mydir1 /temp/mydir2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Linux command : touch myfile.txt

A

Creates an empty file, or updates the timestamp on an existing file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How do I add some text to a text file in linux?

A

cat > my_file.txt <enter> some test <control></control></enter>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How do I view a file in linux?

A

cat file.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

How do I copy a file in linux?

A

cp source_file.txt destination_file.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How do I move a file in linux?

A

mv my_file.txt New_location.txt - this is also used to rename a file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How do I remove a file in linux?

A

rm my_file.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

VI editor has two modes, what are they and describe

A

Command Mode: default mode, issue commands like copy and paste line or navigate, but cannot write contents.
Insert Mode: type “i” to enter insert mode to edit. escape key to exit back to command mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

basics VI command mode options:

A
  • arrow keys to move around
  • x : to delete a character
    -dd : delete a line
    -Copy and paste a line : yy then p
    -Scroll page: ctrl+U or ctrl+D
  • :w - does a save file
  • :w filename - save a file to a name
  • :q = quit
  • :qw = save and quit
  • FIND : do a /mydata
  • N: command to use for find next
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

linux command: whoami

A

Tells me my user

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

linux command: id

A

tells me current user, userid and groups

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

How do I change my logged in user?

A

su OtherUser

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

How do I SSH into a different system with a different name than currently logged into?

A

ssh username@host

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

linux command: curl http://www.site.com/file.txt -O

A

this will download a file. the -O specifies to save it to file otherwise it would just pipe to screen.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

linux command wget http://www.site.com/file.txt -O MyFile.txt

A

downloads a file using -O to save it and a file after to give it name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Linux command: cat /etc/release

A

will display details about the OS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What is RPM?

A

Redhat Package Manager (runs on redhate therefor centos)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

what are rpm switch -i -e -q ?

A

rpm -i telnet.rpm installs a package
rpm -e telnet.rpm removes a package
rpm -q telnet.rpm queries a package

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

Does RPM install prereqs? how about YUM?

A

No, if you install Ansible, it will not install the prereqs. this is where YUM comes into play. yum install ansible : will find and install prereqs and Ansible itself. YUM still uses RPM

35
Q

How does YUM know where to find files?

A

This is stored in /etc/yum/repos.d . this contains a default list of repositories, but you may want to add repositories, so you would add it here. or remove.

36
Q

command to view the list of yum repositories?

A

yum repolist to view repositories
ls /etc/yum/repos.d/ will list each file that represents a repository.
catting one of the files will show the URL to the repo

37
Q

command: yum list

A

Lists installed yum packaged

38
Q

command: yum remove ansible

A

remove ansible

39
Q

command: yum –showduplicates list ansibles

A

Shows if there are duplicates available inside of the yum repos.

40
Q

command: yum install -y ansible-2.4.2.0

A

the ansible-2.4.2.0 will specify which ansible to install when there are duplicates across repos.

41
Q

command: RPM -qa

A

List all installed RPM packages can | grep also

42
Q

how do I start and stop the httpd server?

A

New way: systemctl start httpd “system cuddle”
systemctl stop httpd
old way: service httpd start

43
Q

How do I check a service status?

A

systemctl status httpd

44
Q

how do I enable or disable a service to start at system startup?

A

systemctl enable httpd
systemctl disable httpd

45
Q

How do I configure a python app to run as a service? for example my_app.py ? automatically start at startup and restart if crashes.

A

1: create a unit file in /etc/systemd/system - the file will be the name of the service.
2: in my_app.service file insert the following
[Service]
ExecStart=/user/bin/pyton3 /opt/code/my_app.py
3: systemctl daemon-reload (have systemD reread the files)
4: systemctl start my_app
5: systemctl status my_app : to check the service
6: systemctl stop my_app to stop
7: to have it start with the system you edit the unit file and add a section. this will have it run during boot up after everything else has status
[Install]
WantedBy=multi-user.target
8:you can also add:
[Unit]
description=My service description
9: to have application automatically restart under [service] write
Restart=always

46
Q

Linux CMD: ip link

A

provides basic network information for all ETH adapters.

47
Q

What command do you use to assign an IP address to a network adapter “eth0” in linux?

A

ip address add 192.168.1.10/24 dev eth 0 - note persistent across restart /etc/network/inerfaces for persistent

48
Q

What is the linux command to view the local route table?

A

Route

49
Q

What is the command to add a route in linux?

A

ip route add 192.168.2.0/24 via 192.168.1.1

50
Q

Linux : how do I assign the default gateway as 192.168.2.1?

A

ip route add default via 192.168.2.1
Also could : ip route add 0.0.0.0 via 192.168.2.1

51
Q

If I have a linux host behaving as a router, how do I enable packet forwarding?

A

must modify /proc/sys/net/ipv4/ip_forward and set the contents from 0 to 1. “echo 1 > /proc/sys/net/ipv4/ip_forward”. This will not maintain after reboot, to make it stay after reboot you must do the same change to the /etc/sysctl.conf files and set net.ipv4.ip_forward to 1.

52
Q

Linux DNS: How to I set a manual DNS entry for 192.168.1.11 as host DB

A

cat&raquo_space; /etc/hosts
192.168.1.11. DB

53
Q

Linux how do I assign a DNS server to a host?

A

cat /etc/resolv.conf
namerserver 192.168.1.100

54
Q

Linux : How do I change If the local DNS or the DNS server should be checked first when resolving names?

A

cat /etc/nsswitch.conf
hosts : files dns
This means it will. check local first, swap if you want to check DNS server first.

55
Q

Linux: How do I add a local DNS suffix for mycompany.com

A

cat&raquo_space; /etc/resolv.conf
search mycompany.com

56
Q

Linux commands: download, extract and check java version

A

wget https://download.java.net
tar -xvf VersionDownoads.tar.gz
idk(FromOutput)/bin/java -version
or
java -version

57
Q

What is Java JDK?

A

Java Development Kit (JDK) when you install java you install a kit that helps you with develop -> build -> run. It comes with:
DEVELOP
jdb: debug
javadoc: document code
BUILD
Javac: compile
jar: archive code and library into single jar file
RUN
JRE : Java Runtime Environment
java: java command line utility or loader to run app

58
Q

In java what is the summary for Develop - compile - run

A

Develop: write the code for MyClass.java
Complies : Javac MyClass.java
Run : java MyClass

59
Q

In Java, what is JAR(Java Archive)? How about WAR(Web Archive)?

A

JAR combines all necessary class files and dependencies into a single distributiatble package.
WAR is specifically structured to be a web app

60
Q

What is the command to create a JAR file for service1.class and service2.class

A

jar cf MyApp.jar service1.class service2.class
This will also create a META-INF/manifest.mf that will show the contents.

61
Q

How of I run a JAR java app?

A

java -jar MyApp.jar

62
Q

In Java how do add documentation to MyClass.java

A

javadoc -d doc MyClass.java

63
Q

What are popular build tools for Java? give examples of what they do use ANT as an example

A

Maven, Gradle, ANT
The tools will automatically execute your compile, package, build process.
ANT for example:
MANUAL
Javac MyClass.java
javadoc MyClass.java
jar cf MyClass.jar
W/ ANT you cover to an XML ANT build file.
Once ANY XML is created run:
ant <enter></enter>

64
Q

How do you install apache ant?

A

Sudo yum install -y ant

65
Q

what is apache ant?

A

Apache Ant is a Java-based build tool that uses XML files to automate software build processes, such as compiling code and packaging JAR files. It’s often used for Java projects but has been mostly superseded by Maven and Gradle.

66
Q

What is node.js?

A

Node.js is a runtime environment that allows you to run JavaScript code server-side. Built on the V8 JavaScript engine from Google, it’s commonly used for building web servers, APIs, and other networking applications. Node.js is known for its non-blocking, event-driven architecture, making it well-suited for scalable and real-time applications.

67
Q

How do you install node.js?

A

Add the repository:
1: curl -sL https://rpm.nmodesource.com/setup_13.x | bash -
then install:
2: yum install nodejs

68
Q

How do I identify the node.js version?

A

node -v

69
Q

What is node.js NPM?

A

npm stands for Node Package Manager. It’s a package manager for JavaScript and is commonly used with Node.js. npm allows you to install libraries and packages to use in your projects, manage versions, and handle dependencies. It provides a large repository of open-source packages, making it easier to develop and distribute Node.js applications.

70
Q

how can you tell the version of node.js NPM?

A

npm -v
unrelated to install npm package use : npm install MyPackage

71
Q

Why is Python pip? how can I tell the version?

A

pip = Python Package Manager
pip3 -V or
pip2 -V or
pip -V

72
Q

How do install python flask with pip?

A

pip install flask
bonus:
pip show flask - will show where flash installed

73
Q

A large python app may require many packages to install. You could install all packages with pup one at a time, or:

A

or you can created a requirements.txt file and list all of the dependencies are run: pip install -r requirements.txt.
This is handy for making your application more portable.

74
Q

What is a python .egg file in python?

A

This is a python package that is installed with the python easy_install command. so : easy_install install MyApp

75
Q

What is a python wheels? .whl file?

A

It is a python package like .egg files. you install with : pip install app.whl

76
Q

Overview of GIT start to finish:

A

0: Install : yum install git
1: init git repo: git init (inits an empty repo)
1.5: list files tracker: git status
2: config files to track: git file1.py file2.py file3.py….
3: Tracks changes: when file is changed git status shows which file is modified
4: stage the changed file: git add ChangedFile.py
4.5: all the other files were already staged, now the changed file is as well
4.6: basically the git add will add a file to the stage. when you change the file it upstages it.
5: commit changes: git commit -m “Initial commit”

77
Q

Steps to submit to GitHub

A

1: set up local repo, and commit local
2: create GitHub repo on GitHub web ui
—-Transfer to remote repo
3: get remote add <RemoteRepoName> <urlProvideByGitHub> - this tells local repo remote is available.
4: push from local to remote: git push -u <remote> <branch(master by default></remote></urlProvideByGitHub></RemoteRepoName>

78
Q

Steps to pull code down from github :

A

1: Clone the repot: get clone <url>
1.5: because it was cloned do not need to set-up remote, like someone original pushing
3: if there are remote changed, you can use "git pull"</url>

79
Q

How do I install apache, start it, check it’s status?

A

yum install httpd
service httpd start
service httpd status

80
Q

How do I view apache access and error logs?

A

cat /var/log/httpd/access_log
cat/vat/log/httpd/error_log

81
Q

Where is the apache(httpd) config file?

A

/etc/httpd/conf/httpd.conf

82
Q

What is the difference between apache web and Apache Tomcat?

A

Apache web = web server
Apache Tomcat = App server

83
Q
A