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
to get details about process
ps -edf
26
to start a process with a low priority
nice - n 10 ./script.sh
27
To change the priority of an already running process
``` Get the process's PID (example using PID 789( then type): # renice +5 789 Alternative way # renice +5 `pgrep script.sh` ```
28
Killing processes
``` # kill -9 789 PID 789 # pkill script.sh #killall httpd ```
29
display details about IO activities
iostat
30
display network card activities
netstat -a
31
get details about virtual memory activities
``` # vmstat 5 the virtual memory activities include: memory, swap, run queue, cpu, usage, etc). This example runs it every 5 seconds ```
32
get a full report of a server activity
sar -A
33
ps
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
To see every process on the system using standard syntax
``` # ps -e # ps -eF # ps -ef # ps -ely ```
35
to see every process on the system using BSD syntax
``` # ps ax # ps aux ```
36
to print a process tree
``` # ps -ejh # ps axjf ```
37
to get info about threads
``` # ps -elf # ps axms ```
38
to get security info
``` # ps -eo euser,ruser,suser,fuser,f,comm,label # ps axz # ps -em ```
39
to see every process running as root (real & effective ID) in user format
ps -U root -u root u
40
pstree
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
pstree command examples
``` # 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
other ps command examples
``` # ps -u username # ps -u shows your own processes ```
43
top command options
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
system monitor
to access from the GUI, click applications -> system tools -> system Monitor
45
nice value
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
System logs
All system logs are located under /var/log.
47
/var/log/messages
- standard system logs | - include messages from all system software, boot issues, not related to the kernel
48
/var/log/dmesg
- 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
/var/log/secure
- messages from anything security related, including tcp-wrappers(a security measure for network services), logins, etc
50
/var/log/audit/audit.log
- messages from selinux subsystems | - contains AVC(Access Vector Cache) messages
51
/var/log/boot.log
system boot up messages
52
/var/log/httpd
contains logs from configured web sites
53
utilities to use with system logs
``` # tail -f # dmesg monitor kernel boot messages # sealert for selinux messages # aurepart -> for selinux messages ```
54
syslog
``` 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
To access virtual console
virt-manager
56
Connect to a virtual machine
virsh console vm.example.com
57
KVM
- 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
To check if your machine qualifies for virtualization
cat /proc/cpuinfo | grep "vmx\|svm"
59
To install virtualization
``` # yum groupinstall virtualization # chkconfig libvirtd on # service libvirtd start ```
60
KVM guests consists of two main components
- 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
XML configured files for KVM are stored in
/etc/libvirt/qemu/name-of-guest.xml
62
hard disk files for KVM are stored in
/var/lib/libvirt/images
63
Virsh command examples:
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
view virtual guests processes
#ps -aux | grep qemu
65
To access virt-manager from the GUI
click Applications -> System Tools -> virtual machine Manager
66
the ntsysv command
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
System-config-services
``` - 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 ```