Package Management in Linux

Packages  in Linux

Packages are archives that contain binaries of software, configuration files, and information about dependencies.

The main features that most package management applications provide are:

Package downloading: you can download packages from package repositories which are provided by operating system. Here only authenticated packages can be downloaded from a single trusted provider.

Dependency resolution: Packages contain metadata which provides information about what other files are required by each respective package. This allows applications and their dependencies to be installed with one command.

Debian and Ubuntu Package Management

The Debian package management system is based on tool dpkg with the very popular apt system.

.deb packaged for Debian are often compatible with Ubuntu.

 Advanced Packaging Tool (APT)

Basic commands are

apt-get install package-name(s) –

Installs the package(s) specified, along with any dependencies.

apt-get remove package-name(s) –

 Removes the package(s) specified, but does not remove dependencies.

apt-get autoremove –

Removes any orphaned dependencies, meaning those that remain installed but are no longer required.

apt-get clean –

 Removes downloaded package files (.deb) for software that is already installed.

apt-get purge package-name(s) –

 Combines the functions of remove and clean for a specific package, as well as configuration files.

apt-get update –

 Reads the /etc/apt/sources.list file and updates the system’s database of packages available for installation. Run this after changing sources.list.

apt-get upgrade –

Upgrades all packages if there are updates available. Run this after running apt-get update.

dpkg -i package-file-name.deb – Installs a .deb file.

Fedora and CentOS Package Management

Fedora and CentOS belong to Red Hat Enterprise Linux (RHEL). Their main differences stem from how packages are chosen for inclusion in their repositories.

CentOS uses yum Yellowdog Updater, while  Fedora uses the  dnf package manager.

Yellow Dog Updater, Modified (YUM)


You can use the following commands to interact with YUM:

yum install package-name(s) –

 Installs the specified package(s) along with any required dependencies.

yum erase package-name(s) –

Removes the specified package(s) from your system.

yum search search-pattern –

Searches the list of package names and descriptions for packages that match the search pattern and provides a list of package names, with architectures and a brief description of the package contents.

Note that regular expression searches are not permitted.

yum deplist package-name(s) –

 Lists all of the libraries and modules that the named package depends on, along with the names of the packages (including versions) that provide those dependencies.

yum check-update –

Refreshes the local cache of the yum database so that dependency information and the latest packages are always up to date.

yum info package-name(s) –

The results of the info command provides the name, description of the package, as well as a link to the upstream home page for the software, release versions and the installed size of the software.

yum reinstall package-name(s) –

Erases and then downloads a new copy of the package file and re-installs the software on your system.

yum localinstall local-rpm-file –

Checks the dependencies of a local .rpm file and then installs it.

yum update optional-package-name(s) –

Downloads and installs all updates including bug fixes, security releases, and upgrades, as provided by the distributors of your operating system. Note that you can specify package names with the update command.

yum upgrade –

 Upgrades all packages installed in your system to the latest release.


Dandified YUM (DNF)

DNF is the modern extension of the YUM package manager.

•     dnf install package-name(s) –

Installs the specified package(s) along with any required dependencies. dnf install can also accept .rpm files in place of a package name, to install directly from a downloaded RPM.

dnf remove package-name(s) –

Removes the specified package(s) from your system, along with any package(s) that depend upon them.

dnf search search-pattern –

Searches the list of package names and descriptions for packages that match the search pattern and provides a list of package names, with architectures and a brief description of the package contents.

Note that regular expression searches are not permitted.

dnf provides package-name(s) –

Lists all of the libraries and modules that the named package depends on, along with the names of the packages (including versions) that provide those dependencies.

dnf check-update –

Refreshes the local cache of the DNF database so that dependency information and the latest packages are always up to date.

dnf info package-name(s) –

Provides the name and description of the package as well as a link to the upstream home page for the software, release versions, and the installed size of the software.

dnf reinstall package-name(s) –
Erases and then downloads a new copy of the package file and re-installs the software on your system.

dnf upgrade optional-package-name(s) –

Downloads and installs all updates including bug fixes, security releases, and upgrades for a specific package.

dnf upgrade –

With no arguments, upgrade upgrades all packages installed in your system to the latest release.

dnf config-manager --add-repo example.repo

Adds a .repo file as a DNF repository.

dnf config-manager --set-enabled example-repo

Enables a DNF repository.

dnf config-manager --set-disabled example-repo

Disables a DNF repository.

 Package Management in Arch Linux with Pacman

Arch Linux uses binary packages in a .tar.xz format.

Pacman

The pacman tool is very powerful, but it is also very simple.

There are three core commands for basic package management:

pacman --query package-name(s) or pacman -Q –

Searches the package database for a package name and version number.

pacman --sync package-name(s) or pacman -S –

Installs new packages, downloads new content for the database and/or upgrades the system, depending on the options and the named package or packages.

pacman --remove package-name(s) or pacman -R –

 Removes the named package or packages.




Comments

Related Posts Plugin for WordPress, Blogger...