π§ Fedora DNF Cheat Sheet¶
π¦ Installing & Removing¶
-yβ auto-confirm yes
π Updating¶
--refreshβ ignore old cache, fetch fresh repo data
π Searching & Info¶
π Repositories¶
Manage repos with config-manager (from dnf-plugins-core):¶
sudo dnf config-manager --add-repo <url> # add new repo
sudo dnf config-manager --set-enabled <repoid>
sudo dnf config-manager --set-disabled <repoid>
π Example¶
Letβs say you want to add the Docker CE repo (so you can install Docker directly from Dockerβs official packages).
-
Add the repo:
-
Then install Docker:
π Different vendors (like Oracle, Microsoft, Google) give you a similar .repo URL or a .repo file to place in /etc/yum.repos.d/. Once added, you can install their packages with normal dnf install.
π§Ή Cleaning Cache¶
sudo dnf clean all # clear ALL cached metadata & packages
sudo dnf makecache # rebuild cache with fresh repo metadata
- Use
clean allif cache is outdated/corrupted or you want to free space. - Use
makecacheto pre-load fresh repo info for faster installs/search.
π΅οΈ Useful Extras¶
dnf list installed # show installed packages
dnf list available # show available packages
dnf list updates # show upgradable packages
dnf provides /path/to/file # find which package owns a file
π If Package is Missing¶
-
Flatpak (universal packages):
Example:
-
Vendor repo: add vendorβs
.repo(withconfig-manageror manual file in/etc/yum.repos.d/), then install viadnf install.
β Quick Survival Rules¶
- Try
dnffirst (Fedora repos). - If not there β use Flatpak (Flathub).
- Still missing β add vendor repo.
- If things act weird β
sudo dnf clean all && sudo dnf makecache.
π Understanding dnf config-manager¶
π§ What is dnf config-manager?¶
config-manageris a subcommand (plugin) ofdnf.- Itβs not installed by default on minimal Fedora systems, but it comes with the package
dnf-plugins-core. If you donβt have it, install it:
Once installed, you get extra commands like dnf config-manager.
π·οΈ What does it do?¶
Itβs used to manage DNF/YUM repo configurations. Think of it as a helper to enable, disable, or add new repositories without manually editing files.
π© Common Flags (Options)¶
--add-repo <url>β Add a new repository (from a.repofile or repo URL).--set-enabled <repoid>β Enable a repo that exists but is disabled.--set-disabled <repoid>β Disable a repo temporarily or permanently.
Example:¶
Enable the fedora-modular repo:
Disable it:
π Manual Alternative¶
Without config-manager, you could manually place .repo files into:
Each .repo file is just a config text file telling DNF where to fetch packages.
Example file /etc/yum.repos.d/docker.repo:
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://download.docker.com/linux/fedora/$releasever/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://download.docker.com/linux/fedora/gpg
β Summary:
dnf config-manager= a helper command fromdnf-plugins-core.--add-repo= quick way to add new repos.- Other useful flags:
--set-enabled,--set-disabled. - If you donβt want to use it, you can always just drop a
.repofile into/etc/yum.repos.d/.