How to install rpm in linux

RootUsers

Guides, tutorials, reviews and news for System Administrators.

How To Install An RPM File In Linux

RPM files exist to make the software installation and upgrading process easier. They allow us to simply use an RPM file to install a software package, and when combined with package managers such as Yum or DNF we will also get all required dependencies downloaded and installed easily.

Not all distributions of Linux support RPM. Generally RPM files are used in RHEL based distributions such as CentOS and Fedora to name a couple, however it has also been ported elsewhere. If you find that your distribution does not support installing an RPM file, you may need to look at other options such as .deb files in Ubuntu/Debian.

If you’ve downloaded an RPM file from the Internet, there are a couple of tools you can use to install it. Personally I prefer to use Yum/DNF, these act like a front-end to the RPM command and will maintain an up to date database of package dependencies.

Install RPM File With Yum

Normally when installing a package from a repository with the yum command, you would run ‘yum install httpd’ and it will simply download the required RPM file from a configured repository. We can instead use ‘yum install file.rpm’ and specify a local RPM file that we have to install.

[[email protected] ~]# yum instsall httpd-2.4.6-45.el7.centos.x86_64.rpm Loaded plugins: fastestmirror, langpacks Examining httpd-2.4.6-45.el7.centos.x86_64.rpm: httpd-2.4.6-45.el7.centos.x86_64 Marking httpd-2.4.6-45.el7.centos.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.4.6-45.el7.centos will be installed --> Processing Dependency: httpd-tools = 2.4.6-45.el7.centos for package: httpd-2.4.6-45.el7.centos.x86_64 Loading mirror speeds from cached hostfile * base: centos.mirror.serversaustralia.com.au * extras: ftp.swin.edu.au * updates: centos.mirror.serversaustralia.com.au --> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-45.el7.centos.x86_64 --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-45.el7.centos.x86_64 --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-45.el7.centos.x86_64 --> Running transaction check ---> Package apr.x86_64 0:1.4.8-3.el7 will be installed ---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed ---> Package httpd-tools.x86_64 0:2.4.6-45.el7.centos will be installed ---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================== Package Arch Version Repository Size =================================================================================================== Installing: httpd x86_64 2.4.6-45.el7.centos /httpd-2.4.6-45.el7.centos.x86_64 9.4 M Installing for dependencies: apr x86_64 1.4.8-3.el7 base 103 k apr-util x86_64 1.5.2-6.el7 base 92 k httpd-tools x86_64 2.4.6-45.el7.centos base 84 k mailcap noarch 2.1.41-2.el7 base 31 k Transaction Summary =================================================================================================== Install 1 Package (+4 Dependent packages) Total size: 9.7 M Total download size: 309 k Installed size: 10 M Is this ok [y/d/N]: y Downloading packages: (1/4): apr-1.4.8-3.el7.x86_64.rpm | 103 kB 00:00:00 (2/4): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:00 (3/4): httpd-tools-2.4.6-45.el7.centos.x86_64.rpm | 84 kB 00:00:00 (4/4): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00 --------------------------------------------------------------------------------- Total 247 kB/s | 309 kB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : apr-1.4.8-3.el7.x86_64 1/5 Installing : apr-util-1.5.2-6.el7.x86_64 2/5 Installing : httpd-tools-2.4.6-45.el7.centos.x86_64 3/5 Installing : mailcap-2.1.41-2.el7.noarch 4/5 Installing : httpd-2.4.6-45.el7.centos.x86_64 5/5 Verifying : httpd-tools-2.4.6-45.el7.centos.x86_64 1/5 Verifying : mailcap-2.1.41-2.el7.noarch 2/5 Verifying : httpd-2.4.6-45.el7.centos.x86_64 3/5 Verifying : apr-util-1.5.2-6.el7.x86_64 4/5 Verifying : apr-1.4.8-3.el7.x86_64 5/5 Installed: httpd.x86_64 0:2.4.6-45.el7.centos Dependency Installed: apr.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-45.el7.centos mailcap.noarch 0:2.1.41-2.el7 Complete!

We can also use ‘yum localinstall file.rpm’, however the man page notes that this is maintained for legacy reasons only and suggests using install instead.

Читайте также:  Dns spoofing kali linux

Not only is the httpd RPM file that we specified installed, but so are the listed additional dependencies that the httpd package needs to work properly.

Note that unlike the RPM command covered later, yum automatically resolves the dependencies for us and will download and install any additional packages from our configured repositories.

If you’d like further information on using yum, see our 25 yum command examples here.

Install RPM File With DNF

DNF is the next version of Yum, it’s another package manager for working with RPM files. DNF syntax is fairly similar to the Yum command, as shown below we can install our RPM file in the same way.

[[email protected] ~]# dnf install httpd-2.4.6-45.el7.centos.x86_64.rpm Extra Packages for Enterprise Linux 7 - x86_64 9.7 MB/s | 12 MB 00:01 Using metadata from Thu Dec 29 21:31:01 2016 Dependencies resolved. =================================================================================================== Package Arch Version Repository Size =================================================================================================== Installing: httpd x86_64 2.4.6-45.el7.centos @commandline 2.7 M Transaction Summary =================================================================================================== Install 1 Package Total size: 2.7 M Is this ok [y/N]:

As of Fedora 22 DNF has replaced Yum, so that’s useful to be aware of although it has not yet made its way into RHEL/CentOS where Yum is still the king.

If you’d like further information on using dnf, see our 25 dnf command examples here.

Install RPM File With RPM Command

For comparison, we can also use the rpm command with the -i option to install a specified RPM package. This is not however capable of automatically resolving the dependencies for us, as shown by the errors below we would have to go out and manually download these additional packages, which then themselves may have further package dependencies. This situation is commonly referred to as dependency hell, and is something package managers help us avoid.

[[email protected] ~]# rpm -i httpd-2.4.6-45.el7.centos.x86_64.rpm error: Failed dependencies: /etc/mime.types is needed by httpd-2.4.6-45.el7.centos.x86_64 httpd-tools = 2.4.6-45.el7.centos is needed by httpd-2.4.6-45.el7.centos.x86_64 libapr-1.so.0()(64bit) is needed by httpd-2.4.6-45.el7.centos.x86_64 libaprutil-1.so.0()(64bit) is needed by httpd-2.4.6-45.el7.centos.x86_64

How To Download RPM Files

Usually RPM files will be downloaded from some random page on the Internet, however it’s possible to also download an RPM file from a repository directly using the yumdownloader command. Simply specify the package that you want to download after yumdownloader and it will download a copy of the RPM file that is used to install the package into the current working directory.

[[email protected] ~]# yumdownloader httpd Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos.mirror.serversaustralia.com.au * extras: ftp.swin.edu.au * updates: centos.mirror.serversaustralia.com.au httpd-2.4.6-45.el7.centos.x86_64.rpm | 2.7 MB 00:00:00 [[email protected] ~]# ls -la httpd-2.4.6-45.el7.centos.x86_64.rpm -rw-r--r--. 1 root root 2827204 Nov 20 10:14 httpd-2.4.6-45.el7.centos.x86_64.rpm

This can be a useful way to quickly download a RPM package file using yum to copy elsewhere, perhaps to a Linux server that is in an isolated network without Internet access for example.

Читайте также:  Tp link tl wn7200nd kali linux

Summary

We have covered three different methods for installing RPM files in Linux here. While using Yum/DNF are the preferred options for the reasons mentioned such as automatic dependency resolution, we can also use the rpm command with the -i option to install an RPM file in supported Linux distributions.

Share this:

Источник

Установка RPM-пакетов в Ubuntu

Как установить RPM в Ubuntu

Установка программ в операционной системе Ubuntu производится путем распаковки содержимого из DEB-пакетов или с помощью скачивания необходимых файлов из официальных либо пользовательских хранилищ. Однако иногда программное обеспечение не поставляется в таком виде и хранится только в формате RPM. Далее мы бы хотели рассказать о методе инсталляции библиотек такого рода.

Устанавливаем RPM-пакеты в Ubuntu

RPM — формат пакетов различных приложений, заточенный под работу с дистрибутивами openSUSE, Fedora. По умолчанию в Ubuntu не предусмотрены средства, позволяющие произвести инсталляцию сохраненного в этом пакете приложения, поэтому придется выполнять дополнительные действия, чтобы вся процедура прошла успешно. Ниже мы разберем весь процесс пошагово, детально рассказывая обо всем поочередно.

Перед тем как переходить к попыткам установить RPM-пакет, внимательно ознакомьтесь с выбранным ПО — возможно, его удастся найти на пользовательском или официальном репозитории. Кроме этого, не поленитесь зайти на официальный сайт разработчиков. Обычно там находится несколько версий для скачивания, среди которых часто встречается и подходящий для Ubuntu формат DEB.

Проверить доступность пакетов на сайте программы для Ubuntu

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

Шаг 1: Добавление репозитория Universe

Порой для установки определенных утилит требуется расширение системных хранилищ. Одним из лучших репозиториев считается Universe, который активно поддерживается сообществом и периодически обновляется. Поэтому начать стоит именно с добавления новых библиотек в Ubuntu:

  1. Откройте меню и запустите «Терминал». Сделать это можно другим способом — просто нажмите на рабочем столе ПКМ и выберите нужный пункт. Запустить терминал через меню в Ubuntu
  2. В открывшейся консоли следует ввести команду sudo add-apt-repository universe и нажать на клавишу Enter. Добавление репозитория Universe в Ubuntu
  3. Вам потребуется указать пароль учетной записи, поскольку действие выполняется через рут-доступ. При вводе символы отображаться не будут, вам надо только ввести ключ и нажать на Enter. Ввод пароля для добавления репозитория в Ubuntu
  4. Будут добавлены новые файлы или же появится уведомление о том, что компонент уже включен во все источники. Завершение добавления репозитория в Ubuntu
Читайте также:  Linux mint yandex mirror
  • Если файлы были добавлены, обновите систему, прописав команду sudo apt-get update . Обновить системные файлы в Ubuntu
  • Дождитесь завершения обновления и переходите к следующему шагу. Процедура обновления системных файлов в Ubuntu
  • Шаг 2: Установка утилиты Alien

    Для осуществления поставленной сегодня задачи мы будем задействовать простую утилиту под названием Alien. Она позволяет конвертировать пакеты формата RPM в DEB для дальнейшей их установки в Ubuntu. Процесс добавления утилиты не вызывает особых сложностей и выполняется одной командой.

    1. В консоли напечатайте sudo apt-get install alien . Установить утилиту Alien в Ubuntu
    2. Подтвердите добавление, выбрав вариант Д. Подтвердить добавление файлов в Ub
    3. Ожидайте завершения скачивания и добавления библиотек.

    Шаг 3: Преобразование пакета RPM

    Теперь переходим непосредственно к конвертированию. Для этого у вас на компьютере или подключенном носителе уже должен храниться необходимый софт. После завершения всех настроек останется произвести всего несколько действий:

    1. Откройте место хранения объекта через менеджер, щелкните на нем ПКМ и выберите пункт «Свойства». Перейти к свойствам RPM-пакета в Ubuntu
    2. Здесь вы узнаете информацию о родительской папке. Запомните путь, он понадобится вам в дальнейшем. Узнать родительскую папку пакета в Ubuntu
    3. Перейдите к «Терминалу» и введите команду cd /home/user/folder , где user — имя пользователя, а folder — название папки хранения файла. Таким образом, с помощью команды cd произойдет переход в директорию и все дальнейшие действия будут осуществляться в ней. Перейти в необходимую папку через терминал в Ubuntu
    4. Находясь в нужной папке, введите sudo alien vivaldi.rpm , где vivaldi.rpm — точное название нужного пакета. Учтите, что .rpm в конце дописывать обязательно. Запустить процесс конвертирования в DEB Ubuntu
    5. Снова введите пароль и дождитесь окончания конвертирования. Ввод пароля для начала процесса кон

    Шаг 4: Установка созданного DEB-пакета

    После успешной процедуры преобразования вы можете перейти в ту папку, где изначально хранился пакет RPM, поскольку и конвертирование производилось в этой директории. Там уже будет храниться пакет с точно таким же названием, но формата DEB. Он доступен для установки стандартным встроенным средством или любым другим удобным методом. Развернутые инструкции по этой теме читайте в отдельном нашем материале далее.

    Нахождение готового пакета DEB в Ubuntu

    Как видите, пакетные файлы RPM все-таки инсталлируются в Ubuntu, однако следует отметить, что некоторые из них несовместимы с этой операционной системой вовсе, поэтому ошибка появится еще на стадии конвертирования. При возникновении такой ситуации рекомендуется отыскать RPM-пакет другой архитектуры или попытаться все-таки найти поддерживаемую версию, созданную специально для Ubuntu.

    Источник

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