Linux packages.

How to Install and Remove Local Packages in Linux, From .deb to .rpm

Each Linux distribution has its own package format and package management system. The most common package formats are .deb (for Debian-based systems) and .rpm (for Red Hat-based systems). This article covers how to install, remove, and manage local packages across different distributions.

Introduction to Local Packages

Local package installation in Linux refers to manually installing software packages that are downloaded as standalone files, rather than from a distribution’s package repository. This is useful when a package is not available in the default repositories, requires a specific version, or is distributed as a standalone file by the developer (or you just want to use a custom version compiled by a third party with functionalities that differ from the mainstream compilation in the repositories).

Local package installation is useful when a package is unavailable in repositories or requires manual installation. Each Linux distribution has its own package management system for handling .deb, .rpm, and other package formats. Learning these commands ensures smooth installation, removal, and maintenance of software on your system.


Local Package Installation

Debian-based Distributions (.deb)

Debian-based distributions, such as Ubuntu, Debian, and Linux Mint, use dpkg and APT for package management.

Installing a Local .deb Package

sudo dpkg -i package-name.deb   # Installs a .deb package

If the installation fails due to missing dependencies, run:

sudo apt --fix-broken install   # Resolves missing dependencies

Alternatively, you can install .deb packages using APT:

sudo apt install ./package-name.deb   # Installs and resolves dependencies

Red Hat-based Distributions (.rpm)

Red Hat-based distributions, such as Fedora, CentOS, and RHEL, use RPM and DNF for package management.

Installing a Local .rpm Package

sudo rpm -ivh package-name.rpm   # Installs a .rpm package

To install .rpm packages while handling dependencies automatically, use:

sudo dnf install package-name.rpm  # Installs an .rpm package and resolves dependencies

For older systems using YUM:

sudo yum localinstall package-name.rpm

Arch-based Distributions (Pacman)

Arch Linux and its derivatives (such as Manjaro) use Pacman for package management. Local packages are installed using pacman -U.

Installing a Local Package

sudo pacman -U package-name.pkg.tar.zst   # Installs a local Arch package

For packages from the AUR (Arch User Repository), use an AUR helper like yay:

yay -U package-name.pkg.tar.zst

openSUSE (Zypper)

openSUSE uses Zypper for package management.

Installing a Local .rpm Package

sudo zypper install package-name.rpm  # Installs an .rpm package

Removing Local Packages

Debian-based Distributions

sudo dpkg -r package-name   # Removes a package but keeps configuration files
sudo dpkg --purge package-name   # Removes the package and its configuration files

To remove dependencies that are no longer needed:

sudo apt autoremove

Red Hat-based Distributions

sudo rpm -e package-name   # Removes an installed RPM package

For DNF-based systems:

sudo dnf remove package-name

Arch-based Distributions

sudo pacman -R package-name    # Removes a package
sudo pacman -Rns package-name  # Removes package and unused dependencies

openSUSE (Zypper)

sudo zypper remove package-name   # Removes a package

Verifying Installed Packages

To check if a package is installed:

Debian-based:

dpkg -l | grep package-name

Red Hat-based:

rpm -q package-name

Arch-based:

pacman -Q package-name

openSUSE:

zypper se --installed-only package-name

More About Installing Packages in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *