systemd-nspawn
, systemctl
Main Linux components include:
Grub or systemd-boot
, loads kernel and starts
init
.
Interacts with the hardware, some low-level processes (e.g. wireguard).
Primarily systemd
(alternatives include
runit
, etc). Starts long-running tasks.
System responsible for securily installing applications into the environemnt.
Session managers, window managers, graphical applications, etc.
/bin
- user binaries./sbin
- system binaries./lib
- .so
files, internal binaries,
kernel modules./etc
- configuration files./tmp
- temporary files, cleared on boot./var
- runtime files./opt
- locally installed applications./boot
- kernels, .efi
and such./dev
- pseudo. all peripherals and block devices./run
-/proc
- pesudo. process tree.Describes various components operated on by systemd
.
Uses
systemdctl -t help
to see all types,systemctl list-units
to see all units available on the machine.
Common types:
fstab
but systemd.Common targets:
poweroff.target
: shutdown.rescue.target
: rescue shell.multi-user.taget
: nongraphical multiuser.graphical.target
: graphical multiuser.reboot.target
: reboot.Unit example:
[Unit]
ConditionSecurity=audit
Description=Kernel Auditing
[Service]
ExecStart=@audit-disable audit-start
ExecStop=@audit-stop audit-stop
RemainAfterExit=true
Type=oneshot
[Install]
WantedBy=basic.target
systemd-nswpawn
Gives you some interesting controls, integrates with the systemd ecosystem (targets, timers, etc.). Otherwise not much better than any other container runtime.
All systemd services log stdout/stderr (configurable) to
joutnalctl
, which also includes logs from systemd
itself.
systemd-run
can launch a binary in an environment
controlled by systemd.
Xorg and Wayland are methods of displaying objects to screen. Xorg is a single server and wayland is a protocol, which requires any wayland server. Session managers handle login, run specific window managers from a specific user. Window managers handle displaying windows. Graphical environment (Gnome, KDE, etc.) do all of that.
When building graphical environemnt you should choose between Xorg and Wayland, unless you use a GE which handles that for you.
Just use sddm
.
Can be tiling, do window placement, run on Xorg or Wayland.
Tiling on Xorg:
i3
and forksbspmw
Xmonad
Tiling on Wayland:
sway
and forkshyperland
awesomewm
See terminals for
tty
internals.
Main function of a terminal is translating keystrokes into
tty
actions and displaying its output.
Can run on Wayland or Xorg, provide various features depending on how much you want. Important features include tabs, GPU rendering, ligatures.
Examples:
kitty
- also supports images.alacritty
st
KDE, Gnome and Xfce are primary examples. Run on Wayland, but that's configurable. Chose whichever looks better to you.
pulseaudio
and
pipewire
.dunst
.picom
.In graphical environments main avenue of IPC is D-Bus. It allows applications to trigger code execution in other applications, get structured information from them. Example of D-Bus usage is reading currently playing song from a web-browser. KDE, GNOME and other DE's utilize it heavily for communication between different components or for providing interface to lower-level components like power management.
Servers work generally the same apart from not having graphical environment. Newer approach to servers sees them as fully temporary - services should be independent of their environment, servers themselves should be declarative as much as possible. Popularized by cloud computing, this approach makes for simpler deployment, scaling, etc.
Under a declarative approach deployment of a service doesn't require any actions apart from realising saved configuration. Examples of fully declarative tools include Terraform and NixOS.
A concept, meaning that almost the entire FS tree is treated as temporary files. Under this concept, any necessary state is declared ahead of time and stored separately. Containers are impermanent, and this concept can be applied to physical servers too.
Key tools in running a Linux installation include:
find
/fd
grep
/ripgrep
sed
Consider vim
and tmux
.
If storage allows, use backup software like btrbk
,
restic
or burp
. Encrypt backups if needed.