Linux install rpm command

Содержание
  1. Команда RPM в Linux
  2. Установка, обновление и удаление пакетов RPM
  3. Запрос пакетов RPM
  4. Проверка пакетов RPM
  5. Выводы
  6. 20 Practical Examples of RPM Commands in Linux
  7. Some Facts about RPM (RedHat Package Manager)
  8. There are five basic modes for RPM command
  9. Where to find RPM packages
  10. 1. How to Check an RPM Signature Package
  11. 2. How to Install an RPM Package
  12. 3. How to check dependencies of RPM Package before Installing
  13. 4. How to Install a RPM Package Without Dependencies
  14. 5. How to check an Installed RPM Package
  15. 6. How to List all files of an installed RPM package
  16. 7. How to List Recently Installed RPM Packages
  17. 8. How to List All Installed RPM Packages
  18. 9. How to Upgrade a RPM Package
  19. 10. How to Remove a RPM Package
  20. 11. How to Remove an RPM Package Without Dependencies
  21. 12. How to Query a file that belongs which RPM Package
  22. 13. How to Query a Information of Installed RPM Package
  23. 14. Get the Information of RPM Package Before Installing
  24. 15. How to Query documentation of Installed RPM Package
  25. 16. How to Verify a RPM Package
  26. 17. How to Verify all RPM Packages
  27. 18. How to Import an RPM GPG key
  28. 19. How to List all Imported RPM GPG keys
  29. 20. How To rebuild Corrupted RPM Database
  30. If You Appreciate What We Do Here On TecMint, You Should Consider:
  31. RPM Commands in Linux with Examples
  32. How to get RPM packages
  33. Basic modes for RPM command
  34. Examples for RPM package
  35. Install
  36. 1) How to know information of RPM package without installing
  37. 2) How to install RPM package
  38. 3) How to check an installed RPM package
  39. 4) How to List all files for particular installed RPM package
  40. 5) How to list recently installed RPM packages
  41. 6) How to install RPM package without dependencies
  42. 7) How to replace RPM package installed
  43. Remove
  44. 8) How to uninstall RPM package
  45. Upgrade
  46. 9) How to upgrade RPM package installed
  47. Query
  48. 10) How to query all installed package
  49. 11) How to query particular package
  50. 12) How to query a file that belongs which RPM Package
  51. Verify
  52. 13) How to get information for a particular package
  53. 14) How to verify a RPM package
  54. 15) How to verify all RPM packages
  55. Read Also:

Команда RPM в Linux

Менеджер пакетов RPM (RPM) — это мощная система управления пакетами, используемая Red Hat Linux и ее производными, такими как CentOS и Fedora. RPM также относится к команде rpm и формату файла .rpm . Пакет RPM состоит из архива файлов и метаданных, включая такую информацию, как зависимости и место установки.

В этом руководстве мы поговорим о том, как использовать команду rpm для установки, обновления, удаления, проверки, запроса и иного управления пакетами RPM.

Установка, обновление и удаление пакетов RPM

Обычно для установки нового пакета в дистрибутивах на основе Red Hat вы используете команды yum или dnf , которые могут разрешить и установить все зависимости пакетов.

Вы всегда должны предпочитать использовать yum или dnf rpm при установке, обновлении и удалении пакетов.

Перед установкой пакета RPM вы должны сначала загрузить пакет в свою систему с помощью браузера или инструментов командной строки, таких как curl или wget .

При установке пакетов RPM убедитесь, что они созданы для вашей системной архитектуры и вашей версии CentOS . Будьте особенно осторожны при замене или обновлении важных системных пакетов, таких как glibc, systemd или других служб и библиотек, которые необходимы для правильного функционирования вашей системы.

Только root или пользователи с привилегиями sudo могут устанавливать или удалять пакеты RPM.

Чтобы установить пакет RPM с rpm , используйте параметр -i , за которым следует имя пакета:

Параметр -v указывает rpm показывать подробный вывод, а параметр -h показывает индикатор выполнения, отмеченный хешем.

Вы можете пропустить загрузку и указать URL-адрес RPM-пакета команде rpm :

Чтобы обновить пакет RPM, используйте параметр -U . Если пакет не установлен, он будет установлен:

Если пакет, который вы устанавливаете или обновляете, зависит от других пакетов, которые в настоящее время не установлены, rpm отобразит список всех недостающих зависимостей. Вам придется скачать и установить все зависимости вручную.

Чтобы установить пакет RPM без установки всех необходимых зависимостей в системе, используйте параметр —nodeps :

Чтобы удалить (стереть) пакет RPM, используйте параметр -e :

Параметр —nodeps также полезен, когда вы хотите удалить пакет, не удаляя его зависимости:

Параметр —test указывает rpm запускать команду установки или удаления, фактически ничего не делая. Он только показывает, будет ли команда работать или нет:

Читайте также:  0x0000405 принтер windows 10

Запрос пакетов RPM

Параметр -q указывает команде rpm выполнить запрос.

Чтобы запросить (найти), установлен ли определенный пакет, передайте имя пакета команде rpm -q . Следующая команда покажет вам, установлен ли в системе пакет OpenJDK 11 :

Если пакет установлен, вы увидите что-то вроде этого:

Передайте -i чтобы получить больше информации о запрошенном пакете:

Чтобы получить список всех файлов в установленном пакете RPM:

Если вы хотите узнать, к какому установленному пакету принадлежит конкретный файл, введите:

Чтобы получить список всех установленных пакетов в вашей системе, используйте параметр -a :

Проверка пакетов RPM

При проверке пакета команда rpm проверяет, существует ли каждый файл, установленный пакетом, в системе, дайджест файла, право собственности, разрешения и т. Д.

Чтобы проверить установленный пакет, используйте параметр -V . Например, чтобы проверить пакет openldap, вы должны запустить:

Если проверка прошла успешно, команда не выведет никаких результатов. В противном случае, если некоторые из проверок не пройдут, отобразится символ, указывающий на неудачный тест.

Например, следующий результат показывает, что mTime файла был изменен («T»):

Обратитесь к странице руководства RMP о том, что означает каждый символ.

Чтобы проверить все установленные пакеты rpm, выполните следующую команду:

Выводы

rpm — это низкоуровневый инструмент командной строки для установки, запроса, проверки, обновления и удаления пакетов RMP. При установке пакетов RPM следует предпочесть использование yum или dnf поскольку они автоматически разрешают все зависимости за вас.

Для получения дополнительных сведений обо всех доступных параметрах команд введите в терминале man rpm или посетите веб-сайт RPM.org .

Если у вас есть какие-либо вопросы или отзывы, не стесняйтесь оставлять комментарии.

Источник

20 Practical Examples of RPM Commands in Linux

RPM (Red Hat Package Manager) is an default open source and most popular package management utility for Red Hat based systems like (RHEL, CentOS and Fedora). The tool allows system administrators and users to install, update, uninstall, query, verify and manage system software packages in Unix/Linux operating systems. The RPM formerly known as .rpm file, that includes compiled software programs and libraries needed by the packages. This utility only works with packages that built on .rpm format.

20 Most Useful RPM Command Examples

This article provides some useful 20 RPM command examples that might be helpful to you. With the help of these rpm command you can managed to install, update, remove packages in your Linux systems.

Some Facts about RPM (RedHat Package Manager)

  1. RPM is free and released under GPL (General Public License).
  2. RPM keeps the information of all the installed packages under /var/lib/rpm database.
  3. RPM is the only way to install packages under Linux systems, if you’ve installed packages using source code, then rpm won’t manage it.
  4. RPM deals with .rpm files, which contains the actual information about the packages such as: what it is, from where it comes, dependencies info, version info etc.

There are five basic modes for RPM command

  1. Install : It is used to install any RPM package.
  2. Remove : It is used to erase, remove or un-install any RPM package.
  3. Upgrade : It is used to update the existing RPM package.
  4. Verify : It is used to verify an RPM packages.
  5. Query : It is used query any RPM package.

Where to find RPM packages

Below is the list of rpm sites, where you can find and download all RPM packages.

Read Also :

Please remember you must be root user when installing packages in Linux, with the root privileges you can manage rpm commands with their appropriate options.

1. How to Check an RPM Signature Package

Always check the PGP signature of packages before installing them on your Linux systems and make sure its integrity and origin is OK. Use the following command with –checksig (check signature) option to check the signature of a package called pidgin.

2. How to Install an RPM Package

For installing an rpm software package, use the following command with -i option. For example, to install an rpm package called pidgin-2.7.9-5.el6.2.i686.rpm.

RPM command and options
  1. -i : install a package
  2. -v : verbose for a nicer display
  3. -h: print hash marks as the package archive is unpacked.

3. How to check dependencies of RPM Package before Installing

Let’s say you would like to do a dependency check before installing or upgrading a package. For example, use the following command to check the dependencies of BitTorrent-5.2.2-1-Python2.4.noarch.rpm package. It will display the list of dependencies of package.

Читайте также:  Windows log file issues
RPM command and options
  1. -q : Query a package
  2. -p : List capabilities this package provides.
  3. -R: List capabilities on which this package depends..

4. How to Install a RPM Package Without Dependencies

If you know that all needed packages are already installed and RPM is just being stupid, you can ignore those dependencies by using the option –nodeps (no dependencies check) before installing the package.

The above command forcefully install rpm package by ignoring dependencies errors, but if those dependency files are missing, then the program will not work at all, until you install them.

5. How to check an Installed RPM Package

Using -q option with package name, will show whether an rpm installed or not.

6. How to List all files of an installed RPM package

To view all the files of an installed rpm packages, use the -ql (query list) with rpm command.

7. How to List Recently Installed RPM Packages

Use the following rpm command with -qa (query all) option, will list all the recently installed rpm packages.

8. How to List All Installed RPM Packages

Type the following command to print the all the names of installed packages on your Linux system.

9. How to Upgrade a RPM Package

If we want to upgrade any RPM package “–U” (upgrade) option will be used. One of the major advantages of using this option is that it will not only upgrade the latest version of any package, but it will also maintain the backup of the older package so that in case if the newer upgraded package does not run the previously installed package can be used again.

10. How to Remove a RPM Package

To un-install an RPM package, for example we use the package name nx, not the original package name nx-3.5.0-2.el6.centos.i686.rpm. The -e (erase) option is used to remove package.

11. How to Remove an RPM Package Without Dependencies

The –nodeps (Do not check dependencies) option forcefully remove the rpm package from the system. But keep in mind removing particular package may break other working applications.

12. How to Query a file that belongs which RPM Package

Let’s say, you have list of files and you would like to find out which package belongs to these files. For example, the following command with -qf (query file) option will show you a file /usr/bin/htpasswd is own by package httpd-tools-2.2.15-15.el6.centos.1.i686.

13. How to Query a Information of Installed RPM Package

Let’s say you have installed an rpm package and want to know the information about the package. The following -qi (query info) option will print the available information of the installed package.

14. Get the Information of RPM Package Before Installing

You have download a package from the internet and want to know the information of a package before installing. For example, the following option -qip (query info package) will print the information of a package sqlbuddy.

15. How to Query documentation of Installed RPM Package

To get the list of available documentation of an installed package, use the following command with option -qdf (query document file) will display the manual pages related to vmstat package.

16. How to Verify a RPM Package

Verifying a package compares information of installed files of the package against the rpm database. The -Vp (verify package) is used to verify a package.

17. How to Verify all RPM Packages

Type the following command to verify all the installed rpm packages.

18. How to Import an RPM GPG key

To verify RHEL/CentOS/Fedora packages, you must import the GPG key. To do so, execute the following command. It will import CentOS 6 GPG key.

19. How to List all Imported RPM GPG keys

To print all the imported GPG keys in your system, use the following command.

20. How To rebuild Corrupted RPM Database

Sometimes rpm database gets corrupted and stops all the functionality of rpm and other applications on the system. So, at the time we need to rebuild the rpm database and restore it with the help of following command.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

Читайте также:  Горячие клавиши для открытия проводника windows

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

Источник

RPM Commands in Linux with Examples

RPM(Redhat Package Manager) is a command line package management utility used for installing, uninstalling, updating, querying and verifying software packages.

This tutorial I will explain some of the most common Linux rpm commands for a system admin. Some of the RPM Based Linux Distros are Redhat, Centos, Fedora, and OpenSuse. Yum and DNF are frontends for RPM Management which have more features and could overcome the limitations it has.

How to get RPM packages

There are several methods available to get RPM packages as shown below.

  1. software CD/DVD
  2. CentOS Mirror
  3. RedHat (Need account)
  4. Any open repository websites

Basic modes for RPM command

  • Install : It is used to install any RPM package.
  • Remove : It is used to erase, remove or un-install any RPM package.
  • Upgrade : It is used to update the existing RPM package.
  • Query : It is used to query any RPM package.
  • Verify : It is used to verify RPM packages.

Examples for RPM package

GeoIP application GeoIP-1.5.0-11.el7.x86_64.rpm is a RPM Package Library for country/city/organization to IP address or hostname mapping . GeoIP is the package name, version is 1.5.0-11.el7 , release is 7 and architecture .x86_64 .

Install

1) How to know information of RPM package without installing

After we have downloaded a package and we want to know the information of a package before installing. We can use -qip option (query info package) to list the information of a package.

2) How to install RPM package

We can use -ivh parameters to install a particular package as shown below.

3) How to check an installed RPM package

We can use -q option with package name, It will show whether an rpm package installed or not.

4) How to List all files for particular installed RPM package

We can list all the files of an installed rpm packages, By using the -ql option with rpm command.

5) How to list recently installed RPM packages

We can use -qa option with —last , It will list all the recently installed rpm packages.

6) How to install RPM package without dependencies

We can use -ivh parameters with —nodeps stands for no dependencies check, To install a particular package without dependencies, As shown below.

7) How to replace RPM package installed

We can use -ivh —replacepkgs parameters to replace a particular package installed as shown below.

Remove

8) How to uninstall RPM package

We can use -e parameters to uninstall particular package installed without dependencies (don’t check dependencies) as shown below.

Now type command below to ensure the GeoIP not installed.

Upgrade

9) How to upgrade RPM package installed

We can use -Uvh parameters to upgrade a particular package installed as shown below.

Query

10) How to query all installed package

We can use -a parameters along with q to query all installed packages on the server as shown below.

11) How to query particular package

We can use grep command to find about a particular package is installed or not as shown below.

12) How to query a file that belongs which RPM Package

In example number 9 we type command to list all files of an installed RPM package, Now we want to know /usr/lib64/libGeoIP.so.1.5.0 file belongs which RPM Package.

Verify

13) How to get information for a particular package

We can use -i parameters along with q to get information for a particular package as shown below.

14) How to verify a RPM package

We can verify a package by comparing information of installed files of the package to the rpm database, By using -Vp option (verify package).

15) How to verify all RPM packages

We can verify all the installed rpm packages, By using -Va option (verify all).

Read Also:

An rpm package consists of program files, config files and a list of compiled software programs and libraries needed by the packages(dependencies). This rpm utility only works with packages that built on ‘.rpm’ format.

Источник

Оцените статью