DEB vs RPM

FREE Online Courses: Your Passport to Excellence - Start Now

In this document, you will learn what DEB and RPM are, and understand the commands used by their package managers: rpm and dpkg. You will also learn commands that are used along with the package managers and how to do simple tasks like installing, checking, removing, and a lot more.

What are DEB and RPM in Linux?

When you first look at .deb and .rpm, they look like file extensions, which is absolutely correct, but there is more to it. We all know that linux has many different distros like Ubuntu, kali, Manjaro, Fedora, etc. DEB is the software package extension as well as the format for the Debian linux; distribution of Linux. RPM on the other hand is the software package extension as well as the format for the linux distributions based on Red hat.

Before we compare them, let us take a closer look at what DEB and RPM are.

1. DEB

A DEB file is a software package that is used by linux distributions that are based on Debian, like Ubuntu, Linux mint, Deepin, AntiX, Kali and so many more. The DEB files are most commonly used to update or install UNIX applications. The file itself contains two files with .TAR (abbreviation for Tape Archives) extension. One is for installable data and the other is for installer control information.

For performing various tasks on .deb files like installing, removing, checking, etc, we need a package manager. Debian-related files have dpkg as their package manager. dpkg stands for Debian Package.

The basic syntax for the dpkg command is:

dpkg <options> actions

First let us take a look at options that are used along with the dpkg command before we see how to perform actions like installing, removing, checking .deb files.

dpkg command options

a.-i <package.deb>

This option is also written as: –install <package.deb>. It installs packages into the system.

b. –unpack <package.deb>

This option will unpack the package without doing any configuration.

c. –configure <package>

This option is used to configure an unpackaged package.

d. -r <package>

This option is also written as: –remove <package.deb>. It removes a package that has been installed previously. This option will remove only the package, and not other files like the configuration files.

e. -P <package>

It is also written as:–purge<package>. This option will purge (remove) a previously installed or an already removed package. Unlike the remove option, the purge option deletes even other files like the configuration files.

f. –get-<selections>

This option fetches packages with the selections you have entered.

g. -b <directory>

It is also written as: –build<directory>. This option builds a .deb package.

h. -c <package.deb>

It is also written as:–contents <package.deb>. This option will list all the contents that are present in the .deb package.

i. -l <pattern>

It is also written as:–list <pattern>. This option will list all the packages by matching them with the pattern you have entered.

j. -I <package.deb>

It is also written as:–info <package.deb>. This option will show the information about the package you asked for.

k. -s <package>

It is also written as: –status <package.deb>. This option will show the status of an already installed file.

l. -S <pattern>

It is also written as: –search <package.deb>. This option will search the already installed packages for the pattern you have entered.

m. -R

It is also written as: –recursive. This option is used to handle actions recursively in the target directory and subdirectories.

Examples using dpkg command options

Now that you have seen the options used with the dpkg command, let us see a few examples on how to use them:

a. Installing a package

To install a debian package using the -i or –options, use the syntax:

sudo dpkg -i <package.deb>

b. Removing a package

To remove a debian package from your system (note that it will still keep other files, like configuration) use the following command:

sudo -r <package>

c. Purging a package

To install a debian package using the -P or –purge, using the syntax:

sudo dpkg -P <package>

d. Showing contents of a package

To display all the contents of the package, run the command:

dpkg -c <package.deb>

e. Checking if the package is installed

To check if a package is already installed in your system run the command:

dpkg -s <package.deb>

f. Install all packages from a Directory

Use the options -R and -i recursively with the following syntax to install all packages from the directory you specify:

sudo dpkg -R -i <directory>

g. Showing package information

To show information of the package, use the command:

dpkg -I <package.deb>

h. Unpacking package contents

To Unpack the content which are present in the package (just like unzipping folders), use the command:

sudo dpkg --unpack <package.deb>

i. Listing packages in system

To list the packages which are known, use the command:

dpkg - l

This command will give the output as the status, name of the package, version, architecture, description and other details. It is important to know how to read the status of the package shown on the screen.

The status of a package is shown by 2 letters: the first tells the actions selection and the second gives information about the package status.

Let us see the different letters showing information on actions selection and package status:

i. Action selection

  • u – unknown
  • i – installed
  • r – remove
  • p – purge
  • h – hold

ii. Package status

  • i – package is not installed
  • t – pending triggers
  • W – awaiting Triggers
  • F – half configured
  • U – unpacked package
  • H – Half installed package
  • c – configuration files
  • n – package is not installed

Now that we have covered DEB, let us take a look at RPM in the same way.

2. RPM in Linux

Just like DEB is related to the Debian distro of Linux, an RPM file is a software package that is used by linux distributions based on Red Hat Linux, like Fedora, Rocky, Alma, CentOS, and many more. Infact RPM itself is an abbreviation for Red hat Package Manager. Just like dpkg is the package manager for Deb, the package manager for RPM is RPM itself.

RPM was created 25 years ago. It was written and developed by Erik Troan and Marc Ewing in 1997. RPM was initially meant for use in Red Hat Linux, but today it is used in many linux distributions like clearOS, Alma Linux, CentOS, openSUSE, Oracle Linux, Fedora, OpenMandriva, rocky linux and so many other distros (which are based on Red Hat Linux).

RPM works only on packages that are built on .rpm format. The tool allows users to update, installm query, check, uninstall and manage system software in Unix/Linux operating systems derived from Red hat.

The basic syntax for the dpkg command is:

rpm <options> actions

RPM has 5 basic modes:

1. Install

2. Remove

3. Upgrade

4. Verify

5. Query

First let us take a look at options that are used along with the rpm command before we see how to perform the tasks mentioned above.

rpm command options

a. – i

This option installs the package you want.

b. – v

This option provides verbose for a nicer display.

c. – h

This option shows hash marks for percentage, to make things a little understandable.

d. – q

This option queries a package.

e. – p

This option lists the capabilities the package provides.

f. – R

This option lists the capabilities on which the package depends.

g. – nodeps

It is an abbreviation for ‘no dependencies’ The above option will run no dependencies check .

h. – q

This option will check if a package with the name you entered exists or not.

i. – ql

This option is used to view all the files of an installed package.

j. – qa

This option will list all the recently installed packages.

k. – U

This option upgrades any RPM package.

l. – qi

This option is an abbreviation for ‘query info’ and it gives you all the information about an already installed package like the name, version, release, size, etc.

m. – qip

This option is an abbreviation for ‘query info package’ and it gives you all the information about any rpm package from the internet like the name, version, release, size, etc.

Note: The difference between the options ‘-qi’ and ‘-qip’ is that ‘-qi’ will give details only if the package is installed, whereas ‘-qip’ can provide information about any rpm package on the web.

n. – qdf

This option is an abbreviation for ‘query document file’ and it gives you the list of the available documentation of an already installed package.

o. – Vp

This option is an abbreviation for ‘verify package’ and verifies the package by comparing the information of the installed files of the package to the files in the rpm database.

p. – e

This option removes/erases a package.

Examples using rpm command options.

Now that you have seen the options used with the rpm command, let us see how to perform the above 5 simple tasks using combinations of the options you have learnt.

1. Installing a package

For installing a package, the main option is ‘-i’, but for better readability and understandability we use the options ‘-v’ and ‘-h’ as follows:

rpm -ivh <package.rpm>

Before you install the package, if you wish to check whether all the files of the package are downloaded or not, you can run the command:

rpm -qpR <package.rpm>

2. Removing a package

For removing a package you use the command :

rpm -e <package.rpm>

3. Upgrading a package

You can upgrade the older version of the package to the latest version by using the command:

rpm -Uvh <package.rpm>

Note: When you upgrade your package, the operating system will not only upgrade to the latest version, but it will also maintain the backup of the older version. This is an advantage because if the new version does not run properly, you can switch back to the older version anytime.

4. Verifying a package

You can verify the contents of a specific installed rpm package by using the command:

rpm -Vp <package.rpm>

If you wish to verify all of the installed rpm packages, you can do so by using the command:

rpm -Va

5. Querying

There are many things you can query in a package, like the documentation, details, etc. by using the ‘-qdf’, ‘qi’ and ‘qip’ options mentioned above like this:

rpm -qdf <package.rpm>

rpm -qip <package.rpm>

rpm -qi <package.rpm>

These are some of the tasks that can be done on rpm files using the command options discussed above.

“.deb” vs “.rpm”

Now that we have seen what DEB and RPM are, it is now time to answer the question at hand: “.deb” or “.rpm”. Now, to be honest, this is not a versus battle to bring out a champion like ‘Messi’ V.S ‘Ronaldo’ or ‘Ford’ V.S ‘Ferrari’.

Most importantly we cannot compare packages or package managers, because all they do is do tasks like installing, removing, verifying. Both .deb and .rpm have nearly the same number of options and can perform the exact same tasks. The only thing that is a clear cut difference is the operating systems they support.

Even if you compare the operating systems, Debian and Red hat, you will not get a clear winner. In fact each is designed and developed for its own intended purpose, where Red hat is used mainly for servers, whereas Debian is used for Distribution. Both operating systems have nearly the same number of packages too. Most importantly, you can always convert .rpm to .deb and vice versa using the alien command:

alien -r <package-name>.deb

DEB vs RPM

DEBRPM
Deb files are the files that are used for debian Linux based operating systems.Rpm files are the files that are used for Red Hat Linux based operating systems.
Few examples of Debian based operating systems are Ubuntu, Kali, Linux Mint, Deepin, parrot OS.Few examples of Red hat based operating systems are Clear OS, rocky linux, Cent OS, alma Linux
Deb files have a package manager called dpkg..RPM files have RPM itself as a package manager
dpkg is the acronym for Debian package.RPM stands for redhat package manager.
DEB was developed by the debian project community.RPM was developed by the community of the red hat project
The debian project community accepts patches in DEB files which are not yet mainstream.The red hat project community is extremely strict, and does not allow patches in their ROM files.
DEB files depend on a ‘control file’ for defining the software that is to be installed for the target application to function properly.RPM files depend on a ‘spec file’ for which version of the application is going to be installed, and information regarding which smaller application will need to be installed for its proper functioning.
DEB carries a large number of scripts that deal with automation.RPM files carry a large number of scripts that deal with automation

Summary

Even though at the end we could not deduce a clear winner, we still learnt a great deal about DEB vs RPM. We took a deep dive into what DEB and RPM are including their package managers. We looked at the different options which can be used with the commands and how to use them in various tasks like installing, deleting, checking, verifying and a lot more.

Did we exceed your expectations?
If Yes, share your valuable feedback on Google

follow dataflair on YouTube

Leave a Reply

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