|$ curl https://forge-ai.dev/api/markdown?path=docs/linux/packages
$cat docs/package-management.md
updated Recently·18 min read·published

Package Management

◆Linux◆Packages◆apt◆dnf◆Beginner🎯Free Tools
Introduction

Package managers handle software installation, dependency resolution, upgrades, and removal. Knowing your distribution's package manager saves time and keeps systems consistent and secure.

apt (Debian / Ubuntu)
apt.sh
Bash
1sudo apt update # refresh package index
2sudo apt upgrade # upgrade installed packages
3sudo apt full-upgrade # upgrade with dependency changes
4sudo apt install nginx # install a package
5sudo apt remove nginx # remove package, keep config
6sudo apt purge nginx # remove package and config
7sudo apt autoremove # clean unused dependencies
8sudo apt search nginx # search packages
9apt show nginx # package details
dnf (Fedora / RHEL / Rocky)
dnf.sh
Bash
1sudo dnf update
2sudo dnf install nginx
3sudo dnf remove nginx
4sudo dnf search nginx
5dnf info nginx
6sudo dnf autoremove
pacman (Arch Linux)
pacman.sh
Bash
1sudo pacman -Syu # sync, refresh, upgrade
2sudo pacman -S nginx # install
3sudo pacman -R nginx # remove
4sudo pacman -Rs nginx # remove with unused dependencies
5sudo pacman -Ss nginx # search
6pacman -Qi nginx # info
apk (Alpine Linux)
apk.sh
Bash
1apk update
2apk add nginx
3apk del nginx
4apk search nginx
5apk info nginx
ℹ

info

Alpine is extremely popular for Docker containers because its package index is small and images are minimal.
Universal Package Formats
universal.sh
Bash
1# Snap (Ubuntu, cross-distro)
2sudo snap install code --classic
3sudo snap remove code
4
5# Flatpak (cross-distro, sandboxed)
6flatpak install flathub com.spotify.Client
7flatpak run com.spotify.Client
8
9# AppImage
10chmod +x MyApp.AppImage
11./MyApp.AppImage
Installing From Source
source.sh
Bash
1# Typical build workflow
2cd /tmp
3curl -L -o app.tar.gz https://example.com/app.tar.gz
4tar -xzf app.tar.gz
5cd app
6./configure --prefix=/usr/local
7make
8sudo make install
⚠

warning

Installing from source bypasses the package manager and makes updates and uninstallation harder. Prefer packaged versions when available.

Community

Get help on Slack, Discord or VIP

Stuck on a guide? Join the community and ask.