Linux Rpm Command With Examples For CentOS, RedHat, Fedora

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-rpm-command-with-examples/
PINTEREST
PINTEREST
INSTAGRAM

What is Rpm? Rpm is package manager popular in Red Hat based operating systems.   Rpm full name is Red Hat Package Manager. Rpm uses rpm as package extension and format. Rpm packages are generally distributed from repositories on the internet but using usb, optical media or other ways is popular too in the old days. Yum is the online package manager used to get rpm packages from network or internet repositories.

Description

Yum files are named like below with name, version,release,architecture.

Repositories

As stated before repositories are used to hold rpm packages on the internet but also a CD can be used as repository in rare situations. Repositories are used but yum/dnf commands.

Rpm Search

Generally Rpm packages are provided by repository and package managers like yum, dnf. But there is alternative sites those provides Rpm packages download manually.

http://rpm.pbone.net/

Srpm

Source code of packages are distributed with srpm packages. Srpm packages are zipped with tar.gz or tar.bz2

PatchRPM and DeltaRpm

Rpm packages provide some options to makes download size smaller. Packages includes a lot of different type of files. But not all files are changed. To makes pacakges smaller only changed files are distributed in Deltarpm’s.

Rpm Install

Rpm packages have generally dependencies which means if we want to install some package we need to install other related packages before installing it. But We skip this and install some package with -ivh parameters.

Rpm Install
Rpm Install

We need root privileges to install rpm package. In our example we tried to install tmux but as we see in message it is installed all ready.

Check Dependency

As we know Rpm packages have dependencies which means to install a package other packages may be needed. The needed packages must be installed before install current package. We can check dependencies like below.

LEARN MORE  How To Repair Ext2, Ex3, Ext4 File System In Linux?

Rpm dependency check

As we see tmux package depends on sh, standard C library, ncurses, Event library etc.

Install Ignoring Dependency Check

Normally if we try to install package which have unmet dependency it will give error and do not installed.  There is a way to install packages with unmet dependencies with forcefully. We will provide —nodeps parameter for installation.

Install Omitting Dependency Check
Install Omitting Dependency Check

Download Rpm

Yum is used to download and install automatically but in some cases we may need to download package and install another system or etc. We can download a rpm package with command named yumdownloader like below. Yumdownloader do not needs any privilege for download operation.

Download Rpm
Download Rpm

We only provide package name to the yumdownloader.

Check Installed RPM Package

Rpm database holds information about installed packages. we can query this database like below. If the Rpm/application is installed the full package name is printed. If the application is not install a message like package not installed gived.

List All Files Of Installed RPM Package

We may need to list files of and installed Rpm package. It is very similar to the checking process we will just add an -l parameter like below.

List files of installed packages

List Recently Installed RPM Packages

We may want to list lastly installed Rpm packages. But keep in mind that will generate a lot of line.

I cannot put a screenshot here because it exceeds my terminal history. So I can put some limit or pagination to this list.

List Recently Installed RPM Packages
List Recently Installed RPM Packages

As we can this will print the date of the RPM package installation with time information. In the screenshot for example kdeadmin package installed 24 November at 09:50:33 .

LEARN MORE  How To Set or Change User Password In Linux?

List All Installed RPM Packages

Another way to list installed packages is listing all packages not just latest installed.

Using less in this situation is more practical. We can also search command output with less.

List Recently Installed RPM Packages
List Recently Installed RPM Packages

Upgrade RPM Packages

If an Rpm package is all ready installed we can upgrade existing package to newer one. Advantage of upgrade is that after upgrade old package is also hold as a backup and if new package do not work old package can be used.

Upgrade RPM Packages
Upgrade RPM Packages

Uninstall RPM Package

Uninstalling or erasing and Rpm package can be done with -e parameter like below.

Uninstall RPM Package
Uninstall RPM Package

Uninstall RPM Package Without Dependencies

We can only uninstall package itself and hold dependency packages in the system.

Uninstall RPM Package Without Dependencies
Uninstall RPM Package Without Dependencies

Alternative way to remove Rpm package is not erasing dependencies.

Query File Name To Find Related RPM Package

Sometimes we need to find related Rpm package from a file name.

Query File Name To Find Related RPM Package
Query File Name To Find Related RPM Package

Get Info About Installed RPM Package

We can get information about and installed Rpm package like name version, release, size, url etc.

Get Info About Installed RPM Package
Get Info About Installed RPM Package

Get Information About RPM Package

Actually Rpm provides a lot of important information about packages and its content. We can list and Rpm package information without installing it.

Get Information About RPM Package
Get Information About RPM Package

Query Documentation Of Installed RPM Package

Documentation of an installed Rpm package can be get like below. It is similar to finding Rpm package name from a file.

LEARN MORE  Apache Log Files

Query Documentation Of Installed RPM Package
Query Documentation Of Installed RPM Package

Verify RPM Package

We can check and Rpm package and verify against the Rpm database. to verify -Vp parameters should be provided.

Verify RPM Package
Verify RPM Package

Verify All RPM Packages

We can verify all installed Rpm packages. Verify process will look into the Rpm database to complete this job. Keep in mind that this will require a lot of time. We will use -a or --all for this operation.

Verify All RPM Packages
Verify All RPM Packages

Import GPG Key Of RPM Package

GPG is a security protocol to verify authenticity. GPG is used recently to eliminate rouge repositories and Rpm packages but to benefit from this protocol GPG must be configured for Rpm. To configure GPG signs must be imported.

List All Imported RPM GPG Keys

We can list existing or imported GPG keys like below.

List All Imported RPM GPG Keys
List All Imported RPM GPG Keys

As we can see from screenshot that GPG keys have different naming convention like gpg-pubkey-GUID where GUID or UID is a unique identifier to prevent name collusion.

Initialize RPM Database

If we want to create new RPM database which will hold installed package information we can use --initdb option. This will create new, empty, fresh database.

Rebuild Corrupted RPM Database

Some time Rpm database can be get corrupted. Corrupted Rpm database can not be updated or used. So to get it into working condition Rpm database should be rebuild like below.

Here we go the /var/lib and remove uncomplete database packages. Then run rpm rebuild command.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-rpm-command-with-examples/
PINTEREST
PINTEREST
INSTAGRAM