Rpm file install 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.

Читайте также:  Удаленное управление пользователями 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.

Читайте также:  Kali linux decode base64

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:

Источник

How to Install RPM Packages on Ubuntu

RPM is a package format used by Red Hat-based derivatives like CentOS, RHEL or Fedora. The name comes from the RPM Package Manager (RPM), a free and open-source package management system for installing, uninstalling, and managing software packages in Linux.

Is it possible to install .rpm files on Debian based distributions like Ubuntu? The answer is yes. However, you need to be careful as it could lead to package dependency conflicts.

Follow the steps in this tutorial to learn how to install .rpm packages on Ubuntu.

tutorial on installing rpm packages on Ubuntu

  • A user account with sudo privileges
  • Access to a terminal/command line
  • apt package manager (included by default)

Steps to Install an RPM Package on Ubuntu

Install Alien Package

To improve the stability of the installation process, we need to convert the .rpm file to a .deb file format.

Alien is a useful tool that facilitates conversions between Red Hat rpm, Debian deb, Stampede slp, Slackware tsz, and Solaris pkg file formats.

To install Alien follow these steps:

1. Check the status of the Universe distribution component:

sudo add-apt-repository universe

2. Make sure that your repositories are up-to-date:

3. The following command installs the Alien conversion tool:

sudo apt-get install alien

Convert .rpm Files to .deb Format

Now that Alien has been installed, it’s time to convert the files to the .deb format to complete the installation. Go to the folder where the .rpm file is located and enter the following command:

sudo alien packagename.rpm

This command instructs the Alien tool to initiate the conversion process of the .rpm file to a .deb file.

Читайте также:  Intel corporation pro wireless 2200bg linux

Note: You need to log in as a user with sudo access to install packages on Ubuntu.

Install the converted .rpm package on Ubuntu

Once the conversion has run its course, enter the following command to start the installation:

sudo dpkg –i packagename.deb

You have successfully installed a converted .rpm file on Ubuntu.

How to Install .rpm Package Directly on Ubuntu

The command we’ll use below installs a .rpm package in Ubuntu without previously converting it to a .deb file format.

This command can lead to serious compatibility issues if you attempt to run it with important system packages. RPM was not developed initially for Debian based distributions. As we have already installed Alien, we can use the tool to install RPM packages without the need to convert them first.

To complete this action, enter this command:

sudo alien –i packagename.rpm

You have now directly installed an RPM package on Ubuntu. Keep in mind that installing packages in formats that are not native to Ubuntu can pose a significant risk.

By following the tutorial, you have installed an RPM package on Ubuntu. Understanding the installation processes and the available options significantly reduce the likelihood of something going wrong. Check out our article on how to use the RPM command in Linux.

If you were planning to update essential system packages, a better option would be to use Ubuntu repositories and find adequate alternative packages.

Источник

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