← Packages & Services
Linux · Packages & Services

How to install a package in Linux

Install a package and its dependencies with dnf install on RHEL/Oracle Linux and apt install on Debian/Ubuntu.


Install software from the configured repositories. Run as root. Dependencies are resolved automatically.

Installing pulls in dependencies and runs as root. On a production server, know what is being installed and prefer your organisation's approved repositories.

# RHEL / Oracle Linux
sudo dnf install <pkg>

# Debian / Ubuntu (refresh metadata first)
sudo apt update
sudo apt install <pkg>

# Install a local package file
sudo dnf install ./<pkg>.rpm      # RHEL/OL
sudo apt install ./<pkg>.deb      # Debian/Ubuntu

# Verify
rpm -q <pkg> || dpkg -l <pkg>
Linuxdnfinstall