How to install packages from testing on Arch Linux

The reason I have stuck with Arch Linux and have looked past the
issues I’ve had with it, is because of the availability of newer
packages without the need of additional package mangers.

That said, I started working on a new project recently, and wasn’t quite ready
to move things into Docker containers. It’s written in Node.js and when I went
to check which version of Node I was running, I was aghast to find out I was
running version 11.15.0, a full point release behind the latest!

Sure, I have nvm installed, but between you and me, I absolutely hate using a
tool like that. I’d much rather run the latest and greatest version locally, and
then Dockerize things accordingly when I need to do any version juggling.

I’m not entirely sure why the Node.js version currently provided by Arch by
default is so behind, but I wasn’t going to sit around, so I went to the Arch
package search, and checked to see if there were any other versions I could
install.

Sure enough, out in Community-Testing there was the most recent version of
Node.js, version 12.8.1 at the time of this writing. But I had never installed a
package from testing on Arch.

Hell, only recently had I learned about pinning versions of packages on Arch
Linux
due to some breaking changes with the latest version of
terraform.

Turns out, it’s about as painless as it is to add new repositories on Debian.
First, you need to open and edit /etc/pacman.conf:

su -c 'vim /etc/pacman.conf'

Jump to the bottom of the file and you’ll see some lines that look like this:

# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.

#[testing]
#Include = /etc/pacman.d/mirrorlist

[core]
Include = /etc/pacman.d/mirrorlist

[extra]
Include = /etc/pacman.d/mirrorlist

#[community-testing]
#Include = /etc/pacman.d/mirrorlist

[community]
Include = /etc/pacman.d/mirrorlist

As you can see, the testing repositories are disabled. Depending on which
repository you want to install from, simply uncomment it out. For me, that was
the [community-testing] repository.

After you save the file, you will need to sync the new repository:

pacman -Sy

And then install the package you want, making sure to add the name of the
repository you’d like to install from to the package name:

pacman -S community-testing/nodejs

That’s all there is to it! Now you can run even more up to date (and potentially
unstable) software on your Arch system 🙂

Keep in mind that many packages in testing rely on other testing packages, so
depending on what you’re trying to install, you very well may need to install
other packages from the testing repository.

Incidentally, this is what I had encountered when installing the testing version
of Node. Initially it had worked fine, but after a full upgraded of my system,
it started to bark about a missing symbol.

Because of this, I ended up needing to downgrade back to the stable version of
Node. Initially, I just installed from the version from the community
repository:

pacman -S community/nodejs

Which worked well at the time, but then I noticed I had a pending upgrade
waiting. Turns out, it was the nodejs package eagerly awaiting to be upgraded
back to the community-testing version.

I couldn’t find a way to suppress the upgrade to the testing version, while
still allowing upgrades from the stable channel, so I simply re-commented out
the testing repository in /etc/pacman.conf.

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.