Linux+ lab: Ubuntu and AlmaLinux package families
XK0-006 is family-neutral, so a question may name apt or dnf, ufw or firewalld, AppArmor or SELinux. This guide introduces one machine of each kind and asks both the same four questions, so the pairs are learned together rather than twice.
Start Here Guide 2 of 28 Beginner
- PlatformsUbuntu 26.04 LTS + AlmaLinux 10.2
- Mandatory access controlAppArmor on Ubuntu, SELinux enforcing on Alma
- Firewallufw / nftables 1.1.6
- TimeAbout 14 min
Ubuntu 26.04 LTS and AlmaLinux 10.2. Both are current at the time of writing. The Ubuntu host's login shell is zsh, which matters exactly once - and this page is where it comes up.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| LPLUS-A01 | 192.168.0.73 | Ubuntu 26.04 LTS | Debian-family host - apt, ufw, netplan, AppArmor | 2 Core | 4 GB | 50 GB |
| LPLUS-B01 | 192.168.0.74 | AlmaLinux 10.2 | RPM-family host - dnf, firewalld, NetworkManager, SELinux | 2 Core | 4 GB | 50 GB |
This guide includes
Use this before the hands-on guides. This matters because a question may name apt or dnf, ufw or firewalld - four tools differ between the families, and either may be the one asked about.
- meeting the two machines, one of each family
- learning the four tools that differ between them
- asking which package owns a file, and getting two different answers
- finding the access control and the firewall each machine starts with
Before you start
- guide 1 - the domains these machines are for.
-
The two machines
One of each family. Everything on this path runs on one or both.
bash Example session . /etc/os-release; echo "$PRETTY_NAME"; uname -r; hostnamectl | head -3Ubuntu 26.04 LTS7.0.0-30-generic Static hostname: lplus-a01 Icon name: computer-vm Chassis: vm 🖴. /etc/os-release; echo "$PRETTY_NAME"; uname -r; hostnamectl | head -3AlmaLinux 10.2 (Lavender Lion)6.12.0-211.7.3.el10_2.x86_64 Static hostname: lplus-b01 Icon name: computer-vm Chassis: vm 🖴Expected result
Ubuntu 26.04 LTSon kernel7.0.0-30-generic;AlmaLinux 10.2on6.12.0-211.7.3.el10_2.x86_64.Success conditionYou know which machine is which.
-
The four tools that differ
Package manager, firewall, access control, shell. Ask each host what it has.
bash Example session printf '%-14s %s\n' shell "$BASH_VERSION" pkg "$(command -v apt-get dpkg | tr '\n' ' ')" fw "$(command -v ufw | tr '\n' ' ')" mac "$(command -v aa-status apparmor_status 2>/dev/null | head -1)"shellpkg /usr/bin/apt-get /usr/bin/dpkgfw /usr/sbin/ufwmac /usr/sbin/aa-statusprintf '%-14s %s\n' shell "$BASH_VERSION" pkg "$(command -v dnf rpm | tr '\n' ' ')" fw "$(command -v firewall-cmd | tr '\n' ' ')" mac "$(command -v getenforce | tr '\n' ' ')"shellpkg /usr/bin/dnf /usr/bin/rpmfw /usr/bin/firewall-cmdmac /usr/sbin/getenforceExpected resultUbuntu:
apt-get/dpkg,ufw,aa-status- andshellis blank. RHEL:dnf/rpm,firewall-cmd,getenforce,shell 5.2.26.Success conditionYou can identify a machine's family from its tooling in one command.
-
The same question, two answers
Which package owns a file - the most useful query in Domain 1.
bash Example session echo "which package owns /usr/bin/ssh?"; dpkg -S /usr/bin/sshwhich package owns /usr/bin/ssh?openssh-client: /usr/bin/sshecho "which package owns /usr/bin/ssh?"; rpm -qf /usr/bin/sshwhich package owns /usr/bin/ssh?openssh-clients-9.9p1-23.el10_2.alma.1.x86_64Expected result
openssh-client: /usr/bin/sshon Ubuntu;openssh-clients-9.9p1-7.el10_0.x86_64on RHEL.Success conditionYou can go from a file to its package on either family.
-
Access control and firewall, as found
Both machines have a mandatory access control layer and a firewall. Neither pair is configured the same.
bash Example session echo "is the mandatory access control layer on?"; aa-status --enabled 2>/dev/null && echo "AppArmor: enabled" || sudo aa-status 2>&1 | head -2is the mandatory access control layer on?sudo: aa-status: command not foundecho "is the mandatory access control layer on?"; getenforce; sestatus 2>/dev/null | head -3is the mandatory access control layer on?EnforcingSELinux status: enabledSELinuxfs mount: /sys/fs/selinuxSELinux root directory: /etc/selinuxecho "what is the firewall doing?"; sudo ufw status | head -2what is the firewall doing?sudo: ufw: command not foundecho "what is the firewall doing?"; sudo firewall-cmd --state; sudo firewall-cmd --get-default-zonewhat is the firewall doing?runningpublicExpected result
AppArmor: enabledon Ubuntu;EnforcingandSELinux status: enabledon RHEL. Firewall:Status: inactiveon Ubuntu,runningin zonepublicon RHEL.Success conditionYou know the default posture of each family.
Troubleshooting
$BASH_VERSIONis empty.Why: The current shell is not bash - zsh, dash or something else.
Fix:Nothing is wrong. Use a shebang in scripts; check with
ps -p $$ -o comm=.whichbehaves differently between hosts.Why: It is an external program, packaged differently, and not always installed.
Fix:Use
command -v- a POSIX shell builtin.lsb_release: command not found.Why: Not installed on a minimal system of either family.
Fix:
. /etc/os-releaseand use$PRETTY_NAMEor$ID.A port is open on one host and blocked on the other.
Why: Ubuntu's ufw ships inactive; RHEL's firewalld ships running.
Fix:
ufw statusorfirewall-cmd --list-all. Check before blaming the service.A package name from a guide does not exist.
Why: Package names differ between families -
openssh-clientagainst-clients.Fix:Search by the command:
dnf provides */sshorapt-file search bin/ssh.