Operate running Systems Flashcards

1
Q

multiple ways to reboot a system

A
# reboot
# shutdown -r now
# sudo init 6
# telinit 6
# shutdown -r +3                  reboot after 3 minutes
# shutdown -r 10:35             reboot at 10:35
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Multiple ways to shutdown a system

A
# shutdown -h now
# sudo init 0
# sudo telinit 0
# poweroff
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Boot Process

A
  1. Bios initializes
  2. Bootloader is then called by the Bios
  3. Bootloader loads the first kernel image
  4. Kernel then mounts file systems and starts the appropriate system services.
  5. The system services finish starting up, and a login screen is presented
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

BIOS

A
  • Basic Input Output System
  • installed on a small chip on the motherboard
  • initializes basic peripherals on the system, sets the system clock, and searches for the boot device
  • once boot device is detected, the program installed(known as bootloader) is executed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

BootLoader(GRUB)

A
  • Default RHEL bootLoader is GRUB
  • GRUB loads the first kernel image listed in its configuration file
  • Then hands control of the rest of the boot process to the Linux kernel
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Kernel boot process

A
  • Kernel detects hardware on the system
  • Kernel loads device drivers from its initial RAM file system initramfs-.img
  • Mounts the root file system in read only mode
  • init is then loaded(starts the init process)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Last stages of startup

A
  • init runs the necessary scripts in /etc/init
  • /etc/inittab is read for the default runlevel
  • runlevel scripts for the appropriate runlevel are started
  • user is presented with a login screen
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Runlevels

A

0, shutdown
1, single: Maintenance level
2. level without some network resources(for example lack of NFS)
3. Multi-user level without graphical interface
4. None
5. Multi-user level with graphical interface
6. reboot

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

to check current run level

A

runlevel

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

to change current run level

A
# init x
# telinit x
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Boot into different run level at boot time

A

Press the letter i when you see the bootloader. At the grub menu press the a key to append an argument to the kernel boot line. Enter argument at the end of the parameter, then press enter.

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

upstart

A
  • Originally developed for Ubuntu
  • replaced the old system V init System
  • SysV init started services Sequentially
  • Upstart starts services in parallel
  • Provides a much faster boot experience
  • Review man 5 and man 8 for upstart
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

init

A
  • init is the first process (PID 1)
  • All other processes are child process from init
  • /sbin/init
  • configuration files for init|upstart are in /etc/init
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

rcs.conf

A
  • /etc/init/rcs.conf
  • Primary script that gets called from Upstart
  • first it executes /etc/rc.d/rc.sysinit script
  • reads /etc/inittab for default run level
  • finally it switches to default runlevel
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

rc.sysinit

A
  • /etc/rc.d/rc.sysinit
  • sets system hostname
  • starts networking
  • Mounts and checks file Systems
  • runs plymouth
  • sets SELinux state
  • send messages to /var/log/dmesg
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Plymouth

A

provides the progress bar that we see during system bootup

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

inittab

A
  • /etc/inittab
  • Used to be the main script file that init uses during system startup
  • it has been demoted with RHEL6 with upstar
  • sets the default system runlevel
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

rc.conf

A
  • /etc/rc.conf
  • called by the /etc/init/rcs.conf file, uses default runlevel as set in /etc/inittab
  • fires up the scripts located in /etc/rc.d/rcx.d/ (where x is the default runlevel)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

some important startup scripts

A
  • /etc/sysconfig/init
  • – sets colors for plymouth, determines if single user mode will need a password or not etc.
  • /etc/init/tty.conf
  • –creates terminals accessed through ctrl + alt + F1 - F6
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

/etc/rc.d/rcx.d

A

check which scripts are run in different run level. Replace x for 0 - 6

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

K vs S before service startup scripts

A

K is for kill and the S is for start

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

chkconfig

A
use chkconfig to start or kill services at startup
# chkconfig servicename on
# chkconfig servicename off
# chkconfig --list servicename    check if service name is on or off
# chkconfig --level 35 atd on      allow a service to start at specific runlevel(3,5)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Cancel schedule shutdown

A

shutdown -c

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

top command

A

display an instantaneous image of a server’s activity

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

to get details about process

A

ps -edf

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

to start a process with a low priority

A

nice - n 10 ./script.sh

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

To change the priority of an already running process

A
Get the process's PID (example using PID 789( then type):
# renice +5 789
Alternative way
# renice +5 `pgrep script.sh`
28
Q

Killing processes

A
# kill -9 789    PID 789
# pkill script.sh
#killall httpd
29
Q

display details about IO activities

A

iostat

30
Q

display network card activities

A

netstat -a

31
Q

get details about virtual memory activities

A
# vmstat 5
the virtual memory activities include: memory, swap, run queue, cpu, usage, etc). This example runs it every 5 seconds
32
Q

get a full report of a server activity

A

sar -A

33
Q

ps

A

Report a snapshot of the current processes. It helps you see what processes are being run, what files & commands they are being run with, who they are being run by, as well as their process ID

34
Q

To see every process on the system using standard syntax

A
# ps -e
# ps -eF
# ps -ef
# ps -ely
35
Q

to see every process on the system using BSD syntax

A
# ps ax
# ps aux
36
Q

to print a process tree

A
# ps -ejh
# ps axjf
37
Q

to get info about threads

A
# ps -elf
# ps axms
38
Q

to get security info

A
# ps -eo euser,ruser,suser,fuser,f,comm,label
# ps axz
# ps -em
39
Q

to see every process running as root (real & effective ID) in user format

A

ps -U root -u root u

40
Q

pstree

A

shows which processes are running, but also the parent processes that started each one. It displays a snapshot of that informatin in a tree like diagram

41
Q

pstree command examples

A
# pstree
# pstree -p   shows also the PID for each individual process that are running)
# pstree -a  shows us any command line options that will run with a particular process)
42
Q

other ps command examples

A
# ps -u username
# ps -u   shows your own processes
43
Q

top command options

A

use the h key while in top to see all the commands that you can use with it. The q key will quit top. To change the nice value while in top, press the r key, to renice a process, then enter the pid of a process, then the renice value we want the process to have

44
Q

system monitor

A

to access from the GUI, click applications -> system tools -> system Monitor

45
Q

nice value

A

Nice values range from negative 20 to 19 (-20,19) with negative 20 being the highest nice value and 19 being the lowest nice value. The nigher the number the less cpu time a process gets. The default value that a process get when it starts is zero

46
Q

System logs

A

All system logs are located under /var/log.

47
Q

/var/log/messages

A
  • standard system logs

- include messages from all system software, boot issues, not related to the kernel

48
Q

/var/log/dmesg

A
  • messages are added to this log during boot time
  • includes messages from the kernel during the boot process
  • also includes info about hardware devices that are connected
49
Q

/var/log/secure

A
  • messages from anything security related, including tcp-wrappers(a security measure for network services), logins, etc
50
Q

/var/log/audit/audit.log

A
  • messages from selinux subsystems

- contains AVC(Access Vector Cache) messages

51
Q

/var/log/boot.log

A

system boot up messages

52
Q

/var/log/httpd

A

contains logs from configured web sites

53
Q

utilities to use with system logs

A
# tail -f
# dmesg  monitor kernel boot messages
# sealert  for selinux messages
# aurepart -> for selinux messages
54
Q

syslog

A
is the core service that records & monitors system logs on a system. in RHEL6 the original syslog daemon has been replaced with the rsyslog daemon. vi /etc/rsyslog.conf to check out the rules section. After making changes there, you can reload the service instead of restarting it:
# service rsyslog reload
by default syslog uses port 514
55
Q

To access virtual console

A

virt-manager

56
Q

Connect to a virtual machine

A

virsh console vm.example.com

57
Q

KVM

A
  • Kernel-based Virtual Machine
  • each virtual machine is viewed as a single process
  • Multiple tools that are available to manage machine guests
  • – virsh - command line tools for guest management
  • – virt-manager - graphical front end for libvirt
58
Q

To check if your machine qualifies for virtualization

A

cat /proc/cpuinfo | grep “vmx|svm”

59
Q

To install virtualization

A
# yum groupinstall virtualization
# chkconfig libvirtd on
# service libvirtd start
60
Q

KVM guests consists of two main components

A
  • Guess XML file = contains details on Ram assigned, cpu amount, location of hard disk image files
  • guess hard disk file - either in Raw(pre-allocated) or qemu file formats, ending in .img extension
61
Q

XML configured files for KVM are stored in

A

/etc/libvirt/qemu/name-of-guest.xml

62
Q

hard disk files for KVM are stored in

A

/var/lib/libvirt/images

63
Q

Virsh command examples:

A

virsh
virsh# nodeinfo view guest status
virsh# list –all view a listing of guests on the hypervisor
virsh# shutdown guestname shutting down a guest
virsh# start guestname start guest
virsh# destroy guestname similar to pulling the plug
virsh# dominfo guestname info on guest
virsh# undefine guestname to delete a virtual machine
virsh# autostart guestname enabled autostart
virsh# autostart guestname –disable disabled autostart
virsh# help
virsh# exit

64
Q

view virtual guests processes

A

ps -aux | grep qemu

65
Q

To access virt-manager from the GUI

A

click Applications -> System Tools -> virtual machine Manager

66
Q

the ntsysv command

A

ntsysv
Allows you to configure services to start on bootup
You’ll get a text base gui you can check or uncheck services. Only modify the service in the current run level

67
Q

System-config-services

A
- A gui service configuration tool. It's not installed by default
# yum install system-config-services
# system-config-services
or access through the gui
System - Administration - Service