1. Repositories
Trusted online locations from which Linux downloads package metadata and software packages.
Beginner note: Do not add random repositories unless you trust the source.
Learn how Linux installs software safely using repositories, packages, dependencies, and smart tools like APT and DNF. Think of this module as your first guided visit to the Linux software warehouse. π¬
Beginners often ask: βWhy do we use apt or dnf? Why not download installers from random websites?β Linux package managers solve that problem by using trusted repositories, package metadata, dependency checks, signatures, and a local installed-package database.
| Linux concept | Restaurant idea |
|---|---|
| Repository | Menu or kitchen source |
| Package manager | Waiter who understands the menu |
| Package | Dish you order |
| Dependency | Ingredients or side dishes needed |
| Install | Order and receive the dish |
| Update | Refresh the menu and upgrade dishes |
| Remove | Take the dish off your table |
A repository is like a safe warehouse. The package manager checks what is available, selects the right package, pulls required helper packages, installs files in correct places, and records what changed.
Trusted online locations from which Linux downloads package metadata and software packages.
Beginner note: Do not add random repositories unless you trust the source.
A package contains software files, metadata, version information, and install/remove instructions.
Examples: tree, curl, vim, net-tools.
Extra packages required for another package to work correctly.
Simple idea: Some tools need helper libraries before they can run.
Installation downloads the package and places its files in the right directories.
sudo apt install tree -ysudo dnf install tree -y
Updating keeps package information and installed software current.
Ubuntu: apt update refreshes metadata; apt upgrade upgrades installed packages.
Removal uninstalls the package. Some configuration files or unused dependencies may remain depending on the command.
Careful: never remove critical system packages casually.
Click the button and watch the package journey. This sequence is the core idea behind both APT and DNF.
Find the package name before installing.
Read package details, description, version, and dependencies.
Install the package and required dependencies.
Run the command or check package ownership.
Refresh package metadata and upgrade when appropriate.
Uninstall safely when no longer needed.
A package may rely on libraries and helper packages. The package manager solves this dependency puzzle for you.
Ubuntu/Debian systems commonly use APT. RHEL/Rocky/Fedora-family systems commonly use DNF.
| Task | Ubuntu / Debian | RHEL / Rocky | Beginner meaning |
|---|---|---|---|
| Refresh package metadata/cache | sudo apt update | sudo dnf makecache | Refresh local knowledge of available packages. |
| Upgrade installed packages | sudo apt upgrade -y | sudo dnf upgrade -y | Upgrade installed software after reviewing changes. |
| Install package | sudo apt install tree -y | sudo dnf install tree -y | Install a new tool. |
| Remove package | sudo apt remove tree -y | sudo dnf remove tree -y | Uninstall a package. |
| Search package | apt search tree | dnf search tree | Find package names. |
| Show package info | apt show tree | dnf info tree | See details before installing. |
| List installed files | dpkg -L tree | rpm -ql tree | See files installed by package. |
| Find owner of a file | dpkg -S /usr/bin/tree | rpm -qf /usr/bin/tree | Find which package owns a file. |
apt update refreshes the package list; it does not upgrade installed packages by itself. To upgrade installed packages, use apt upgrade after reviewing what will change. On DNF systems, metadata is refreshed automatically when needed, but sudo dnf makecache is the direct cache-refresh command and sudo dnf check-update checks whether updates are available.
Use the tab for your distribution. These labs are safe for a training VM and use the small tree utility.
treetree, use it, verify it, and remove it.sudo apt update
Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease
Reading package lists... Done
Building dependency tree... Done
All packages are up to date.
Exact repository names and package counts can differ.
sudo apt install tree -y
sudoRun as administratoraptUbuntu package toolinstallInstall packagetreePackage name-yAnswer yes automaticallytree /etc | head
/etc
βββ adduser.conf
βββ alternatives
βββ apparmor
βββ apt
βββ bash.bashrc
βββ bindresvport.blacklist
βββ ca-certificates
...
Your output may differ depending on installed packages and distribution version.
tree --version
which tree
dpkg -S /usr/bin/tree
sudo apt remove tree -y
sudo apt autoremove -y
This removes packages that were installed automatically and are no longer required. Always review output on production systems.
treetree package using DNF, test it, inspect ownership, and remove it.dnf search tree
Last metadata expiration check: ...
================ Name Exactly Matched: tree =================
tree.x86_64 : File system tree viewer
sudo dnf install tree -y
sudoRun as administratordnfRHEL/Rocky package toolinstallInstall packagetreePackage name-yAnswer yes automaticallytree /etc | head
/etc
βββ NetworkManager
βββ adjtime
βββ aliases
βββ alternatives
βββ bashrc
βββ chrony.conf
...
Directory contents vary by OS release and installed roles.
tree --version
which tree
rpm -qf /usr/bin/tree
rpm -ql tree | head
sudo dnf remove tree -y
sudo dnf makecache
sudo dnf check-update
sudo dnf upgrade -y
check-update can return a non-zero exit code when updates are available. That does not automatically mean failure.
apt search tree
apt show treednf search tree
dnf info treedpkg -L tree | headrpm -ql tree | headAnswer these like a Linux admin debugging a training VM. Correct answers increase the fun meter.
/usr/bin/tree?Package-management errors are normal in labs. Teach learners to read the error, understand the cause, and try a safe fix.
| Error / Symptom | Likely meaning | Safe fix |
|---|---|---|
tree: command not found | tree is not installed. | Install using sudo apt install tree -y or sudo dnf install tree -y. |
Unable to locate package tree | APT metadata may be outdated or repository unavailable. | Run sudo apt update, then retry. Check internet/DNS if it still fails. |
Could not resolve host | DNS or network problem. | Check ping 8.8.8.8, resolvectl status, and VM network settings. |
Permission denied | Command needs root/admin privileges. | Use sudo if appropriate. |
Could not get lock /var/lib/dpkg/lock | Another APT process is running. | Wait. Check updates/installers. Avoid deleting lock files unless you understand the risk. |
No match for argument: tree | DNF cannot find package in enabled repositories. | Check enabled repos using dnf repolist and network connectivity. |
sudo apt remove python3
sudo dnf remove systemd
sudo dnf remove glibc
Removing critical packages can break the operating system. In production, always review the transaction summary before confirming removals.
Search and read package details before installing. Do not blindly install unknown packages on production systems.
Package managers show what will be installed, upgraded, removed, or replaced. Train yourself to read that summary.
For servers, record what you installed, why you installed it, and how to rollback if needed.
# Ubuntu/Debian
apt policy tree
apt show tree
dpkg -L tree | head
# RHEL/Rocky
sudo dnf info tree
rpm -ql tree | head
rpm -qf /usr/bin/tree
Choose the best answer. This is meant for live classroom recap or self-check.
tree?The floating coach explains the current section in English instead of simply reading the document. It can pause, resume, replay, ask quick checks, repeat with a different analogy, and give small package-management incidents.
The coach gives a short explanation of the selected section, focusing on meaning, command intent, and real-world use.
If a learner says βnot understood,β the coach switches analogies: restaurant, courier, toolbox, library, or warehouse.
Short scenarios train troubleshooting reflexes: stale APT index, unavailable repository, missing command, and safe removals.
βA package manager is a trusted software delivery assistant. It checks repositories, reads package metadata, resolves dependencies, downloads packages, installs files in correct locations, and records what was installed. Ubuntu uses APT; RHEL/Rocky uses DNF. Always inspect before installing and review before removing.β
Search β Info β Install β Verify β Remove