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

Lesson 6 - Booting, Initializing, and Virtualizing Linux - Part 2

This document discusses Linux boot processes, initialization systems like SysVinit and systemd, managing services and runlevels, configuring and modifying systemd, shutting down and rebooting Linux systems, and using Linux as a virtualization guest.

Uploaded by

Linh Hà
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Lesson 6 - Booting, Initializing, and Virtualizing Linux - Part 2

This document discusses Linux boot processes, initialization systems like SysVinit and systemd, managing services and runlevels, configuring and modifying systemd, shutting down and rebooting Linux systems, and using Linux as a virtualization guest.

Uploaded by

Linh Hà
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Lesson 6: Booting, Initializing

and Virtualizing Linux

This document is created by Nguyen Hoang Chi [email protected] Page 1


Objectives covered

o 101.2 Boot the system (weight: 3)


o 102.2 Install a boot manager (weight: 2)
o 101.3 Change runlevels / boot targets and shutdown or reboot
system (weight: 3)
o 102.6 Linux as a virtualization guest (weight: 1)

This document is created by Nguyen Hoang Chi [email protected] Page 2


Change runlevels/boot targets
and shutdown or reboot system

This document is created by Nguyen Hoang Chi [email protected] Page 3


Initialization systems

SysVinit Upstart systemd

This document is created by Nguyen Hoang Chi [email protected] Page 4


SysVinit - Runlevels

Redhat based distros

Debian based distros

This document is created by Nguyen Hoang Chi [email protected] Page 5


SysVinit – core files & directories
/etc/inittab

# grep :initdefault: /etc/inittab id:5:initdefault:

/etc/init.d

# ls -1F /etc/init.d/ anacron*


atd*
[...]
crond*
cups*
[...]
ntpd*
[...]
ypbind* yum-updatesd*

/etc/rc.d

# ls /etc/rc.d/
init.d rc0.d rc2.d rc4.d rc6.d rc.sysinit
rc rc1.d rc3.d rc5.d rc.local

This document is created by Nguyen Hoang Chi [email protected] Page 6


SysVinit – working with runlevels

Default # grep :initdefault: /etc/inittab


runlevel id:5:initdefault:

Current # runlevel
runlevel N5

# init 3
# runlevel
Change N3
runlevel # telinit 3
# runlevel
N3

This document is created by Nguyen Hoang Chi [email protected] Page 7


SysVinit – service utilities

This document is created by Nguyen Hoang Chi [email protected] Page 8


systemd – Unit types
Unit types Description
.service describes how to manage a service or application on the server
.mount defines a mountpoint on the system to be managed by systemd
.automount configures a mountpoint that will be automatically mounted
.swap describes swap space on the system
.target describes information about a target unit of systemd, which is used for
grouping units and as well-known synchronization points during start-up
.path defines a path that can be used for path-based activation
.timer defines a timer that will be managed by systemd, similar to a cron job
for delayed or scheduled activation
.snapshot A .snapshot unit is created automatically by the systemctl
snapshot command
.device describes a device that has been designated as
needing systemd management by udev or the sysfs filesystem
others .slice, .scope, .socket

This document is created by Nguyen Hoang Chi [email protected] Page 9


systemd – Service Unit files

/etc/systemd/system/

/run/systemd/system/

/usr/lib/systemd/system/

This document is created by Nguyen Hoang Chi [email protected] Page 10


systemd – Service Unit file sections - Unit

This document is created by Nguyen Hoang Chi [email protected] Page 11


systemd – Service Unit file sections - Service

This document is created by Nguyen Hoang Chi [email protected] Page 12


systemd – Service Unit file sections - Install

This document is created by Nguyen Hoang Chi [email protected] Page 13


systemd – Target Unit files

This document is created by Nguyen Hoang Chi [email protected] Page 14


Steps to modify systemd configuration files

Copy config file to /etc/systemd/system/ to


modify (overridden) or create a subdirectory
named as <unit name>.d (Eg:
/etc/systemd/system/ntpd.d/) and create a
config file with .conf extension (extended)

Edit or adding new configuration to the config


file

Running the following command to review the


overridden or modified unit files
# systemd-delta

Reload the systemd daemon with following


command to make those changes effective
# systemctl daemon-reload

This document is created by Nguyen Hoang Chi [email protected] Page 15


systemd – systemctl utilities

systemctl [OPTIONS] COMMAND [NAME]

This document is created by Nguyen Hoang Chi [email protected] Page 16


systemd – systemctl other commands

Command Descriptions
list-units list of the units currently loaded in the Linux system
list-unit-files List of the available unit files and their enablement state
cat Display the unit file content
get-default Show the default target of the Linux system
is-active Displays active for running services and failed for any
service that has reached a failed state.
is-enabled Displays enabled for any service that is configured to
start at system boot and disabled for any service that is
not configured to start at system boot.
is-failed Displays failed for any service that has reached a failed
state and active for running services.

This document is created by Nguyen Hoang Chi [email protected] Page 17


systemd – systemctl other commands
Command Descriptions
is-system-running Determine system’s operational status
isolate Change to different target unit

Available oerational statuses

This document is created by Nguyen Hoang Chi [email protected] Page 18


Shutdown the system

shutdown [OPTION] TIME [WALL-MESSAGE]

shutdown option Descriptions


-r Restarting system after shutting down
-P Power off the system
-H Halt the system
-c Cancel the previous shutdown command

This document is created by Nguyen Hoang Chi [email protected] Page 19


Notifying users

Method Descriptions
/etc/issue Contains text to be displayed on the tty
terminal login screens
/etc/issue.net Contains logon screen messages for remote
logins
/etc/motd Message of the Day file, contains text that is
displayed after a user has logged into a tty
terminal
notify-send command Sends messages to a user employing the GUI
wall ends messages (called wall messages) to users
logged into a tty terminal or who have a GUI
terminal emulator open and have their
message status set to “yes.”

This document is created by Nguyen Hoang Chi [email protected] Page 20


Linux as a virtualization guest

This document is created by Nguyen Hoang Chi [email protected] Page 21


Virtualization concepts

This document is created by Nguyen Hoang Chi [email protected] Page 22


Virtualization concepts

Notes:
- Enable virtualization feature on your CPU
- Some hypervisor require x64 CPU

To specify your CPU feature:


# grep ^flags /proc/cpuinfo

- Intel based need: vmx


- AMD based need: svm

This document is created by Nguyen Hoang Chi [email protected] Page 23


Creating VM methods

Cloning

VM from Import
from OVF P2V
scratch

Deploy
Template

This document is created by Nguyen Hoang Chi [email protected] Page 24


Container vs VM

This document is created by Nguyen Hoang Chi [email protected] Page 25


Cloud computing – Infrastructure as a Service

This document is created by Nguyen Hoang Chi [email protected] Page 26


Question...!

This document is created by Nguyen Hoang Chi [email protected] Page 27

You might also like