Quiz: Debian & Ubuntu Ecosystem¶
5 questions
L0 (1 questions)¶
1. What is the difference between 'apt update' and 'apt upgrade'?
Show answer
'apt update' refreshes the package index (downloads the list of available packages and versions). 'apt upgrade' installs newer versions of installed packages. Always run update before upgrade, otherwise upgrade sees nothing to do.L1 (3 questions)¶
1. How does AppArmor differ from SELinux in approach and coverage?
Show answer
AppArmor is path-based (restricts by filename), SELinux is label-based (restricts by inode label). AppArmor only protects processes with loaded profiles — unconfined processes have zero MAC protection. SELinux covers ALL processes by default. AppArmor is simpler; SELinux is more comprehensive. Debugging: aa-complain/aa-logprof (AppArmor) vs audit2why/audit2allow (SELinux). *Common mistake:* The biggest trap coming from RHEL: assuming if AppArmor isn't blocking, nothing is wrong. Unconfined processes have no protection at all.2. How does Docker bypass UFW firewall rules, and how do you fix it?
Show answer
Docker manipulates iptables directly, inserting its own DOCKER chain before UFW rules. A port published with -p 3306:3306 is open to the world even if UFW denies 3306. Fix: bind to localhost with -p 127.0.0.1:3306:3306, or set DOCKER_IPTABLES=false and manage rules manually.3. How do you configure a static IP using Netplan on Ubuntu?
Show answer
Create /etc/netplan/01-config.yaml with: network: version: 2, ethernets: eth0: addresses: [192.168.1.100/24], routes: [{to: default, via: 192.168.1.1}], nameservers: {addresses: [8.8.8.8]}. Apply with 'sudo netplan apply'. Use 'sudo netplan try' first for safe testing (auto-reverts after 120s).L2 (1 questions)¶
1. How do you properly add a third-party APT repository on modern Ubuntu (22.04+)?
Show answer
1. Download and dearmor GPG key: curl -fsSL https://example.com/key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/example.gpg.2. Add repo with signed-by: echo 'deb [signed-by=/usr/share/keyrings/example.gpg] https://repo.example.com/apt stable main' | sudo tee /etc/apt/sources.list.d/example.list.
3. sudo apt update. The old apt-key method is deprecated.