Every Linux distribution has its own set of package
management tools that come by default with these distributions. They utilize
various package formats and tools to manage these packages.
Red Hat Enterprise Linux uses the RPM package format and utilizes RPM and YUM for package management. Ubuntu is a Debian-based Linux distribution and is freely available for use, with a comprehensive package management system. Ubuntu utilizes the .deb packaging format and tools for package management, such as apt and dpkg.
In this guide, you will learn
about the Ubuntu package management tools, a fundamental feature of the Ubuntu
system administration. You will learn how to use apt in Ubuntu for managing
packages, updating your system and installing software from repositories. You
will also learn how the dpkg command in Ubuntu helps you manually install and
manage .deb files. This will serve as a quick reference for when you learn how
to perform package management tasks in these systems.
Ubuntu uses apt and dpkg as package management tools to
install, delete, update, upgrade and manage the packages. Both tools have their
own way of handling packages; let's see the detailed working of these tools.
Before learning how to use the APT and DPKG in the Ubuntu, it is helpful to understand the fundamentals of the Linux operating system. you are new to the Linux, read our beginner guide on What is Linux? An Introduction to Linux and Its Popular Distributions.
is a standard command-line tool in Debian-based Linux
distributions used for installing, deleting, updating, and upgrading software
packages and system-related components. APT interacts with software
repositories to download the packages and install them on the system,
automatically manages dependencies and ensures system stability. This guide
will help the system administrators understand the Ubuntu package
installation using APT and tracking of updates and upgrades of installed packages.
3. APT Search Package
If you don’t know about the package description, then use the search option with apt, which will display the complete description of all the components of that package, with the function of each component. As you can the description of postfix below.
4. APT Show Package
This is used to show the package details. Let's look at the details of the postfix package command is
#sudo apt show postfix
The Package management in Linux is usually performed through the terminal. you are new to working with the Linux commands, check our tutorial on 10 Linux Basic Commands Every Beginner Should Know.
5. APT Update
The basic purpose of the update command is to synchronize the indexes of package files from their sources or repositories before the package installation. Command is
#sudo apt update
6. APT Upgrade
The main difference between update and upgrade is, upgrade is used to install the latest version of software that is currently installed on the local system. It compares the locally installed packages with the updated list of packages from repositories and downloads the new version, then replaces with old one. This upgrades existing packages but doesn’t install packages. To see the upgradeable packages command is
#sudo apt list --upgradable
7. APT Install
To install the Apache2 package using the apt command is
#sudo apt install apache2
Here is the
package information. It requires dependencies that will be installed with this
package. The space required for installation, and then you can proceed by
pressing y or n to cancel.
When installing the software packages, files are placed in the different directories within the Linux filesystem. The filesystem structure will help you to manage the installed software more effectively. Read our guide on Linux Directory Structure and File System – Beginners to Pro Guide.
9. APT Full Upgrade
The apt full-upgrade command is used to perform a complete upgrade of all installed packages. It will remove existing packages if necessary to avoid dependency conflicts and upgrade the packages. It downloads and installs all the packages for which updates are available.
#sudo apt full-upgrade
10. Add/Remove Repositories
To add the repositories to the system command is
#sudo add-apt-repository "deb https://dl.winehq.org/wine-builds/ubuntu/ $(lsb_release -cs) main"
Dpkg is a low-level package management tool normally used
in Debian-based Linux distributions such as Ubuntu. It is used to install,
delete and management of individual .deb packages. It is not capable of
managing dependencies automatically or downloading the packages from
repositories. Dpkg has limited capabilities as compared to apt; it is not
recommended as a primary tool for package installation and management. Here you
will learn about some uses of dpkg.
Different Linux distributions use the different package management systems. For example, Red Hat based systems use the RPM and YUM or DNF. You can read this in our guide on RHEL 9 Package Management Guide: How to Install, Update & Remove Packages.
1. Display dpkg version
Let's see the version of dpkg
2. Dpkg Help
To see the help for the dpkg command is
#sudo dpkg --help
for the available
options and switches to use for package management. 
3. Dpkg Install
To install chat-gpt.deb package command is
#sudo dpkg -i ChatGPT_1.1.0_linux_x86_64.deb ## or
#sudo dpkg --install ChatGPT_1.1.0_linux_x86_64.deb 
4. Dpkg Status
Displays package status details. If you give the command with the -s option with any package, it will show all the installed packages. To view the status of a specific package, use the -s option followed by the package name. As you can see below
#sudo dpkg -s zstd
Or
5. Dpkg List Files
To list the files that the package own command is
#sudo dpkg -L zstd
Or
#sudo dpkg --listfiles zstd
6. dpkg List Packages Concisely
To list all the packages or to list only a specific package, the command is
#sudo dpkg -l zstd
Or
7. Architecture of dpkg
installs
To print the
architecture of the dpkg install command is
#sudo dpkg --print-architecture 
8. dpkg unpack a package
To unpack the package
command
#sudo dpkg –unpack
flashplugin-installer_11.2.202.350ubuntu1_amd64.deb 
#sudo
dpkg-reconfigure zstd
11. Get Package Selections
To fetch the package name by the selection command is
12. Remove Package
To remove the package command is
#sudo dpkg -r zstd
Best Practices for Ubuntu Package Management
The Software management is one of the core responsibilities of a Linux system administrator. Learn more about managing the user access and permissions in our tutorial on Managing Users and Groups in Linux – A Complete Guide for Beginners.
Dpkg is a low-level package management tool normally used
in Debian-based Linux distributions such as Ubuntu. It is used to install,
delete and management of individual .deb packages. It is not capable of
managing dependencies automatically or downloading the packages from repositories.
Dpkg has limited capabilities as compared to apt; it is not recommended as a
primary tool for package installation and management. Here you will learn about
some uses of dpkg.
Continue to visit seeklinux for more information and updates.





















Post a Comment