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
linux command: whoami
Tells me my user
26
linux command: id
tells me current user, userid and groups
27
How do I change my logged in user?
su OtherUser
28
How do I SSH into a different system with a different name than currently logged into?
ssh username@host
29
linux command: curl http://www.site.com/file.txt -O
this will download a file. the -O specifies to save it to file otherwise it would just pipe to screen.
30
linux command wget http://www.site.com/file.txt -O MyFile.txt
downloads a file using -O to save it and a file after to give it name
31
Linux command: cat /etc/*release*
will display details about the OS
32
What is RPM?
Redhat Package Manager (runs on redhate therefor centos)
33
what are rpm switch -i -e -q ?
rpm -i telnet.rpm installs a package rpm -e telnet.rpm removes a package rpm -q telnet.rpm queries a package
34
Does RPM install prereqs? how about YUM?
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
How does YUM know where to find files?
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
command to view the list of yum repositories?
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
command: yum list
Lists installed yum packaged
38
command: yum remove ansible
remove ansible
39
command: yum --showduplicates list ansibles
Shows if there are duplicates available inside of the yum repos.
40
command: yum install -y ansible-2.4.2.0
the ansible-2.4.2.0 will specify which ansible to install when there are duplicates across repos.
41
command: RPM -qa
List all installed RPM packages can | grep also
42
how do I start and stop the httpd server?
New way: systemctl start httpd "system cuddle" systemctl stop httpd old way: service httpd start
43
How do I check a service status?
systemctl status httpd
44
how do I enable or disable a service to start at system startup?
systemctl enable httpd systemctl disable httpd
45
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.
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
Linux CMD: ip link
provides basic network information for all ETH adapters.
47
What command do you use to assign an IP address to a network adapter "eth0" in linux?
ip address add 192.168.1.10/24 dev eth 0 - note persistent across restart /etc/network/inerfaces for persistent
48
What is the linux command to view the local route table?
Route
49
What is the command to add a route in linux?
ip route add 192.168.2.0/24 via 192.168.1.1
50
Linux : how do I assign the default gateway as 192.168.2.1?
ip route add default via 192.168.2.1 Also could : ip route add 0.0.0.0 via 192.168.2.1
51
If I have a linux host behaving as a router, how do I enable packet forwarding?
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
Linux DNS: How to I set a manual DNS entry for 192.168.1.11 as host DB
cat >> /etc/hosts 192.168.1.11. DB
53
Linux how do I assign a DNS server to a host?
cat /etc/resolv.conf namerserver 192.168.1.100
54
Linux : How do I change If the local DNS or the DNS server should be checked first when resolving names?
cat /etc/nsswitch.conf hosts : files dns This means it will. check local first, swap if you want to check DNS server first.
55
Linux: How do I add a local DNS suffix for mycompany.com
cat >> /etc/resolv.conf search mycompany.com
56
Linux commands: download, extract and check java version
wget https://download.java.net tar -xvf VersionDownoads.tar.gz idk(FromOutput)/bin/java -version or java -version
57
What is Java JDK?
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
In java what is the summary for Develop - compile - run
Develop: write the code for MyClass.java Complies : Javac MyClass.java Run : java MyClass
59
In Java, what is JAR(Java Archive)? How about WAR(Web Archive)?
JAR combines all necessary class files and dependencies into a single distributiatble package. WAR is specifically structured to be a web app
60
What is the command to create a JAR file for service1.class and service2.class
jar cf MyApp.jar service1.class service2.class This will also create a META-INF/manifest.mf that will show the contents.
61
How of I run a JAR java app?
java -jar MyApp.jar
62
In Java how do add documentation to MyClass.java
javadoc -d doc MyClass.java
63
What are popular build tools for Java? give examples of what they do use ANT as an example
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
64
How do you install apache ant?
Sudo yum install -y ant
65
what is apache ant?
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
What is node.js?
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
How do you install node.js?
Add the repository: 1: curl -sL https://rpm.nmodesource.com/setup_13.x | bash - then install: 2: yum install nodejs
68
How do I identify the node.js version?
node -v
69
What is node.js NPM?
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
how can you tell the version of node.js NPM?
npm -v unrelated to install npm package use : npm install MyPackage
71
Why is Python pip? how can I tell the version?
pip = Python Package Manager pip3 -V or pip2 -V or pip -V
72
How do install python flask with pip?
pip install flask bonus: pip show flask - will show where flash installed
73
A large python app may require many packages to install. You could install all packages with pup one at a time, or:
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
What is a python .egg file in python?
This is a python package that is installed with the python easy_install command. so : easy_install install MyApp
75
What is a python wheels? .whl file?
It is a python package like .egg files. you install with : pip install app.whl
76
Overview of GIT start to finish:
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
Steps to submit to GitHub
1: set up local repo, and commit local 2: create GitHub repo on GitHub web ui ----Transfer to remote repo 3: get remote add - this tells local repo remote is available. 4: push from local to remote: git push -u
78
Steps to pull code down from github :
1: Clone the repot: get clone 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"
79
How do I install apache, start it, check it's status?
yum install httpd service httpd start service httpd status
80
How do I view apache access and error logs?
cat /var/log/httpd/access_log cat/vat/log/httpd/error_log
81
Where is the apache(httpd) config file?
/etc/httpd/conf/httpd.conf
82
What is the difference between apache web and Apache Tomcat?
Apache web = web server Apache Tomcat = App server
83