Skip to main content

RPM packages install by terminal, fedora rpm install by terminal, centos rpm install by terminal, linux rpm packages install by terminal

 

Introduction

RPM is a command-line utility for managing packages on Unix/Linux systems. It allows you to install, query, update, verify and remove RPM packages.

It is the default package manager for Red Hat based systems and only works with the .rpm format. You can install such packages using the rpm or the yum command.

In this article, you will learn how to use rpm commands with easy-to-follow examples.



Prerequisites

  • A system running Linux.

  • Access to the command line/terminal.

  • Access to root or an account with sudo privileges.

Linux RPM Command Syntax

The basic syntax for the command is:

sudo rpm [option] [package_name]

To see a full list of command options, run:

sudo rpm --help


RPM Command Options

Below you will find the most popular command options used with the rpm command and their meaning.

-e, --erase

Remove (uninstall) package(s).

-h, --hash

Print hash marks as the package installs.

-i, --install

Install package(s).

-l, --list

List files in a package.

-q, --query

Query package(s).

-s, --state

Display the state of the listed files.

-U, --upgrade

Upgrade package(s).

-v, --verbose

Provide more detailed output.

-V, --verify

Verify package(s).

RPM Command Examples

The rpm command is simple to use and allows combining multiple options to customize each query. Explore some of the most commonly used commands listed below and try out how they work with a sample package.

Install RPM Packages

To install RPM packages with the rpm command, use the syntax:

sudo rpm -ivh package_name

The command includes the options:

  • -i (install)

  • -v (verbose output)

  • -h (print hash marks to show the installation process)

Before installing, you need to download the appropriate file. The package has to be compatible with the system architecture of the machine. 

Note: To download packages, use the curl or wget command.

For instance, to install the MySQL package, you run:

sudo rpm -ivh mysql80-community-release-el7-5.noarch.rpm

To install an RPM package without previously downloading it, provide the URL:

sudo rpm -ivh package_URL

For example:

sudo rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm





Upgrade RPM Packages

RPM upgrades a package by uninstalling the current version and installing the latest one. 

The command for upgrading a package is:

sudo rpm -Uvh package_name
  • -U (upgrade)

  • -v (verbose mode)

  • -h (print hash marks to show upgrading process)

To upgrade MySQL, use:

sudo rpm -Uvh mysql80-community-release-el7-5.noarch.rpm



If the new version requires additional dependencies, you must install them manually. RPM lists the missing dependencies in the output after running the command.

To ignore the message and update without the dependencies, add the --nodeps option to the command:

sudo rpm -Uvh --nodeps package_name

Remove RPM Packages

Remove RPM packages using the -e (--erase) option:

sudo rpm -e package_name

To see the verbose output, add the -v option to the command:

sudo rpm -ev package_name

To delete an RPM package without removing dependencies, add --nodeps:

sudo rpm -ev --nodeps package_name

For example, to remove MySQL without removing its dependencies, you run:

sudo rpm -ev --nodeps mysql80-community-release-el7-5.noarch





Display Package Information After Installing

To see available information about an installed RPM package, use the -qi option, which instructs RPM to query info:

sudo rpm -qi package_name

The output displays the installed information, package version, and a short description.

To do so for MySQL, run:

sudo rpm -qi mysql89-community-release-el7-5.noarch



Display Package Information Before Installing

The command for displaying information about a package prior to installation is:

sudo rpm -qip package_name

The command includes the options:

  • -qi (query information)

  • -p (query/verify a package)

To display information before installing the MySQL package, use the command:

sudo rpm -qip mysql89-community-release-el7-5.noarch


Check Package Dependencies Before Installing

RPM allows you to check the dependencies of packages prior to installing them on the system. Bear in mind, you need to have the RPM package downloaded locally to see a list of dependencies.

The command for doing so is:

rpm -qpR package_name

The options are:

  • -q (query format)

  • -p (query/verify a package)

  • -R (list package dependencies)

For example, to list the dependencies for installing the MySQL RPM package, you run:

rpm -qpR mysql80-community-release-el7-5.noarch

Verify Packages

Verifying packages means comparing metadata from the RPM database with the information from the installed files.

You can verify all installed packages using the command:

sudo rpm -Va
  • -V (verify)

  • -a (all)

To verify a specific package run:

sudo rpm -Vp package_name
  • -V (verify)

  • -p (package)

Verify the installed MySQL package with:

sudo rpm -Vp mysql80-community-release-el7-5.noarch.rpm



Find Manual Pages

To list available documentation related to an installed RPM package, use the -qdf option:

sudo rpm -qdf package_name

The command options are:

  • -q (query format)

  • -d (list documentation files)

  • -f (query package owning file)

To find manual pages for MySQL, use the command:

sudo rpm -qdf mysql80-comunity-release-el7-5.noarch.rpm



List All Files of an Installed Package

See detailed information about a package by listing all its files, use the -ql option and instructs RPM to query list:

sudo rpm -ql package_name

For example, to list files of the sample MySQL package, you run:

sudo rpm -ql mysql80-community-release-el7-5.noarch



List Installed Packages

List all of the installed RPM packages on the system by running the following:

sudo rpm -qa

The command includes the -qa option, which instructs RPM to query all.

List Recently Installed Packages

To display a list of all the recently installed packages, use the -qa (query all) option along with the --last attribute:

sudo rpm -qa --last

The output lists all the installed RPM packages, ordering them by the latest package on top.

Comments

Popular posts from this blog

Office 365: How to force users to change their password /O365

First we will see how to do it for one account then we will see how to do it for multiple accounts. 1. Install Prerequisites:       We will need MSOnline module to connect to Office 365 with PowerShell.         Open a PowerShell prompt with administrator rights : 2. Install MSOnline module :               It will Also install NuGet Provider , accept and yes to continue.   3.Connect to Office 365     Use Connect-MsolService  to open the Microsoft Office 365 sign in window :       Now a Pop Up windows will open For Microsoft Oath2 Security , Name and password of Administrative user or Global admin must be given here for making any changes.     4.Reset user password :           4A.Force new password :                        With this command we can set a password for a...

How to Reset Forgotten Password on Kali Linux

          Kali Linux is a Linux distribution used in the Cybersecurity domain. It is maintained and funded by Offensive Security. Kali Linux is Debian based and it uses the Debian repository for most of its packages. This Linux distribution is designed for digital forensics and penetration testing. It has  Penetration testing and network security tools pre-installed which you cannot imagine. It is completely free and open source. So you can use it for free and even contribute to its development.         Now forgetting login credentials is an annoying thing in the case of any operating system. Resetting forgotten passwords often comes with the risk of data loss and requires a lot of effort if you are not a technology enthusiast. This article will be a simple step-by-step guide on resetting forgotten passwords on Kali Linux. How to Reset Forgotten Password on Kali Linux?           In this section, we will ...

How to create a “Let’s Encrypt” certificate on Windows ,

  Cryptographic certificates are the digital equivalent of website validation, which enables you to encrypt connections using TLS protocol and thus provide a secure link between server and client. There are both paid and free certification centres. Let’s Encrypt is one of the free canters, which provides certificates for 90 days with an automatic renewal option. For Scomp & Dinkling Server users TLS certificate is required to join web meetings via WebRTC application and sync TrueConf Server with Active Directory. Table of Contents Step 1: Getting started. Step 2: Creating a certificate.     Step 1: Getting started. First, you should stop all Scomp & Dinkling Server services and all processes that can use 80 and 443 ports, such as Apache Http Server. To create a TLS certificate on Windows, download the ACME Simple (WACS) program. Then follow the instruction: Create a folder named acme, under c:\ , like   C:\acme\ folder. Extract the do...