1. Overview

On Arch Linux, we carry out a lot of configurations manually to have fine control over our system. Although there are a lot of packages in the Arch repository and AUR, we might still need some packages in those repositories.

For that reason, we’ll need to manually install packages that are designed for other distributions, such as RPM and DEB. In this tutorial, we’ll solely focus on installing the RPM packages on Arch-based distributions.

First, we’ll look at what’s inside the RPM package. Then, we’ll go over the package installation mechanism under Arch Linux. Lastly, we’ll cover the rpmextract and the alien utilities.

2. The RPM File

RPM stands for Red Hat Package Manager. As we can guess, it’s a package manager that is used in the distributions based on Red Hat. The RPM file, however, is an archive that contains the installation binaries and related assets of a package. An RPM file ends with the .rpm extension.

The RPM file makes it easy for us to distribute, install, uninstall, and upgrade packages because all the installation and metadata files are embedded into a single archive.

Now, the question is, why would we need to install RPM packages on Arch Linux? Well, the AUR contains a plethora of user-maintained packages. However, there are still some packages that might not be available there — mostly proprietary software.

These packages are available on the web in other formats like DEB or RPM. Therefore, we’ll need a workaround to install and use these packages under Arch Linux.

3. Installing RPM Packages on Arch Linux

3.1. PKGBUILD

All the packages available in the AUR are provided by vendors. Each one of these packages contains a file called PKGBUILD, which is a shell script that contains the variables required to build and install the package.

We can use a PKGBUILD file and use the RPM file as the source file. We can provide the installation instruction in the package() function inside PKGBUILD.

Let’s take a look at a basic PKGBUILD template that we can use to install a package:

pkgname="rpm-package-name"
pkgver="0.0.1"
pkgrel="1"
pkgdesc="Mini description of the RPM package."
arch=("x86_64")

source=("filename.rpm")

sha256sums=("SKIP")

package() {
  find $srcdir/ -mindepth 1 -maxdepth 1 -type d | xargs cp -r -t "$pkgdir"
}

Let’s break it down:

  • the first five variables define the mandatory package information
  • the source variable defines the path to the RPM package — usually the current directory
  • the sha256sums variable defines whether to carry out the checksum
  • the package function defines how to install the package

We can edit these variables as needed for the package.

Conventionally, we put the source file in the same directory as the PKGBUILD directory. Once our PKGBUILD file is ready, we can simply use the makepkg utility to install the package.

3.2. Extraction with bsdtar

The makepkg utility uses bsdtar to extract source files. Fortunately, it can also extract RPM files without issues. Therefore, we don’t need to use tools like rpmextract and, thus, we avoid adding a make dependency.

3.3. Dependencies

Sometimes, a program might need dependencies to be installed first. So, we’ll need to specify these dependencies in the depends variable in the PKGBUILD:

depends=('cups: printing support'
         'alsa-lib: sound support'
         'giflib: GIF images support'
         'libjpeg: JPEG images support'
         'libpng: PNG images support')

Apart from that, we can also specify optional dependencies that the users can install by themselves when needed:

optdepends=('sane: scanners support'
            'libgphoto2: digital cameras support')

4. An Example

Now that we have some idea about the RPM file and the Arch package installation process, we’ll install a program called tixati.

4.1. First Steps

Before installing the package, we’ll need to download the RPM file and put it inside a directory:

$ mkdir -p /tmp/tixati
$ cd /tmp/tixati
$ curl -L "https://download2.tixati.com/download/tixati-2.89-1.x86_64.rpm" -o tixati-2.89-1.x86_64.rpm

4.2. PKGBUILD

Now, we’ll need to create a PKGBUILD file for the program:

pkgname=tixati
pkgver=2.89
pkgrel=1
pkgdesc="A powerful P2P file sharing BitTorrent software."
arch=('x86_64')

depends=('gtk2' 'hicolor-icon-theme' 'dbus-glib' 'traceroute')
optdepends=('gconf: for shell integration')

source=('tixati-2.89-1.x86_64.rpm')

sha256sums=('SKIP')

package() {
  find $srcdir/ -mindepth 1 -maxdepth 1 -type d | xargs cp -r -t "$pkgdir"
}

We provided the required dependencies, which will be installed before the installation of tixati using pacman. In the package function, we basically copy everything from the src directory to the pkg directory to create a pkg file.

4.3. Package Installation

Now, we will install tixati using the makepkg utility:

$ makepkg -si
  • -s syncs the runtime dependencies required for tixati
  • i installs tixati

Indeed, without the -i option, we’ll be given a .pkg file that we can manually install using pacman:

$ pacman -U tixati-2.89-1.x86_x64.pkg

If everything goes well, we’ll find the tixati binary in the /usr/bin directory:

$ ls -l /usr/bin/tixati
-rwxr-xr-x 1 root root 55223672 Jun 21 21:39 /usr/bin/tixati

5. Alternative: rpmextract and alien

On Arch Linux, the packages are supposed to be as close to vanilla as possible. That’s why we didn’t use any external installation utilities. However, if we’re lazy, we can use rpmextract and alien.

The rpmextract utility is a wrapper around bsdtar, which we can use to extract RPM archives. alien, on the other hand, is a utility that can convert an installation package from one format to another.**

So, if we have a DEB file, we can simply convert it to an RPM file and then use rpmextract to extract that archive:

$ alien --to-rpm --scripts tixati-2.89-1.x86_64.deb
$ rpmextract.sh tixati-2.89-1.x86_64.rpm
$ cp -r usr/ /

We also copied the extracted usr/ to the root directory, which will be merged together.

6. Conclusion

In this article, we saw how we could install RPM files under Arch-based distros. First, we covered what the RPM file is and how we can install it using PKGBUILD and mkpkg. Next, we put it all together in a practical example.

Finally, we briefly discussed the rpmextract and alien utilities as an alternative to manually installing RPM packages.