Various guides and experiments

Install RPM packages on Arch Linux

I recently found myself wanting to upload music to Google Music from my computer with Arch Linux but found that they only had RPM and APT (.deb) packages available for download. It’s fairly straightforward to install an RPM on Arch:

  1. Download the RPM for your architecture (64- or 32-bit)
  2. Install rpmextract for extracting the RPM and any dependencies the program has (libidn for Google Music Manager for example) with pacman
  3. Now create a new folder, move the RPM file to it and go there
  4. Run and you’ll get a directory structure based on the root (/) in the current directory
  5. Copy the files to where they belong in your own file hierarchy

There are some downsides to this, though. For example you won’t be able to easily uninstall the program, nor will it warn you if you remove any of the dependencies. That’s why I thought it would be a better idea to create an Arch package out of it.

To create an Arch package basically all you need is to create a PKGBUILD file which contains all of the information about the package you’re about to create. Here are their own instructions (which contains a lot more information but also takes longer to figure out if all you want to do is convert an RPM package) and here’s a reference for the different variables you can use in a PKGBUILD file.

This is what my PKGBUILD file ended up like:

# Maintainer: Anders Mårtensson <>
pkgdesc="A program necessary to upload audio files to your Google Music library."

build() {
  cd "$pkgdir" ../google-musicmanager-beta_current_x86_64.rpm

As you can see it’s pretty straight-forward:

  • Name of the program (lowercase, no spaces, etc.)
  • Version (Google says “current” and I couldn’t bother figuring out the actual version number so I went with it)
  • An internal version number that should increment by one for every change to the package
  • A short description (less than about 80 characters)
  • The architecture (i686, x86_64, both or any)
  • A URL to the official site of the package (optional)
  • License (GPL, BSD, unknown, etc.)
  • Any dependencies the program might have (separated by space, no comma)
  • Dependencies only required to build but not run the program
  • Any options (in this case there were some empty directories after extraction which I found unnecessary so I used the emptydirs option)
  • A list of source files (these will be downloaded when installing if they’re URLs, but you can also provide local files putting them in the same folder as the PKGBUILD file)
  • A list of md5sums for the files (you can get these by running “makepkg -g” in the folder with the files).
  • Finally there’s the build script which does the extracting

Once you’ve created the PKGBUILD file run “makepkg” in the folder and watch it create the .pkg.tar.xz file for use with pacman! Install it with pacman -U and you’re done. It will complain if you are missing dependencies and you can remove the package with pacman -R just like when installing with pacman -S. Simple, huh?

How a session of doing this might look:

mkdir package # might want a more descriptive folder ;)
cd package
cp /usr/share/pacman/PKGBUILD.proto PKGBUILD # it's a prototype file to save a lot of keypresses
vim PKGBUILD # modify it to fit your package
makepkg -g # will download any files specified and spit back an md5sum line, copy it
vim PKGBUILD # paste in the md5sums returned from the previous command
makepkg # you may get complaints about dependencies you don't have installed, install them and run until it goes till the end
pacman -U *.pkg.tar.xz # and it's installed!

Posted in Guides | 9 Comments

9 responses to “Install RPM packages on Arch Linux”

  1. Sean says:

    Thank you for such a great howto :) Could you update these instructions with respect to the requirements of pacman 4.1?

  2. satanselbow says:

    18 months later BUT! – Thanks for this pointed me in the right direction when I was tying myself up in knots following the wiki :D

  3. Taras says:

    It’s helped. Thank you!

  4. Claus Conrad says:

    Thanks for the tutorial!

  5. David Ford says:

    Great tutorial, I’ve built the package, however it does not install the packages in the required directories. It says it has installed the package with 0.00MiB Total Installed Size. I copied the files manually to the required directories and was able to get the package working, however, I am going to play around with the PKGBUILD and makepkg for a bit and see if I can get it install correctly. I am running Linux arch 3.13.6-1. I’ll let you know how this goes…

  6. David Ford says:

    I added this to the end of my PKGBUILD file and it seemed to build correctly as it built an empty file without it. I installed with pacman -U and everything works!

    package() {
    cd $srcdir
    rsync -ruDq $srcdir $pkgdir

  7. Ivan D'hond says:

    Thank you very much for your concise and good explanations.
    Helped me like a charm.

  8. Dave M says:

    I had to update the PKGBUILD file to use the new package() function rather than build(). That worked fine, but then I get this error:

    ==> Extracting sources…
    -> Extracting plexmediaserver- with bsdtar
    ==> Removing existing $pkgdir/ directory…
    ==> Entering fakeroot environment…
    ==> Starting package()…
    no package supplied
    ==> ERROR: A failure occurred in package().

    I do have the rpmextract script installed and if I run it directly on the command line it works just fine. No clue what to do about this.

  9. Hi-Angel says:

    Since people complains for “package()”, and I’ve had the same problem, here’s a working example I wrote.

    pkgdesc=”A simple chat client”
    makedepends=(‘rpmextract optipng’)

    build() {
    cd “$srcdir” ../schat2-2.3.2_6e5f9aa-1.1.x86_64.rpm
    package() {
    mv $srcdir/usr $pkgdir/ #/usr is the only top-level dir in the package
    cd $pkgdir/
    mv usr/lib64 usr/lib #lib64 is a symlink, which for some reason causes an error

Leave a Reply

Your email address will not be published. Required fields are marked *