How to Install UNRAR on CentOS 9 Stream
You’ll learn how to get the official RAR extraction tool onto a fresh CentOS 9 Stream box, whether you prefer the quick package‑manager route or want the latest source build.
Why You Need UNRAR
When dealing with legacy backups or third‑party software that only ships as a .rar file, the native `unzip` won’t cut it. The official RAR binary from Rarlab is the most reliable way to extract those archives without corrupting data.
Pre‑flight Checklist
* Confirm you’re running CentOS 9 Stream (not Stream 10 or a different distribution).
* Make sure you have sudo/root access; installing system packages requires it.
* Check that your firewall isn’t blocking the package repositories—`dnf` will fail silently if it can’t reach them.
Installing from RPM Fusion Free
1. Add the EPEL repository first – many third‑party repos depend on it.
sudo dnf install -y epel-release
2. Enable the RPM Fusion free repo – this is where the `unrar` package lives.
The command below adds the repo and imports its GPG key in one fell swoop.
sudo dnf config-manager --set-enabled rpmfusion-free-updates
3. Install UNRAR
sudo dnf install -y unrar
This pulls down a statically linked binary, so you’ll have `unrar` ready to go in `/usr/bin`.
4. Verify the installation
unrar x test.rar
If it extracts without errors, you’re good.
Why this matters: using the repo keeps your system up‑to‑date automatically; you never have to hunt down source patches or deal with dependency hell.
Compiling from Source (Latest Version Only)
Sometimes the packaged version is a few releases behind, especially if you need features like 64‑bit support for very large archives.
1. Install build tools and dependencies
sudo dnf groupinstall -y "Development Tools"
2. Download the newest source tarball
(Replace `5.9` with whatever the current release is.)
wget https://www.rarlab.com/rar/rarlinux-5.9.tar.gz tar xf rarlinux-5.9.tar.gz cd rarlinux-5.9
3. Compile and install
make sudo cp unrar /usr/local/bin/
4. Test it – the same `unrar x` command as before.
Why compile: you’ll get the freshest bug fixes and any new compression options that the rpm‑based release hasn’t caught up to yet.
Common Pitfalls
* Missing GPG key – If `dnf` complains about a signature, double‑check that the RPM Fusion repo is correctly enabled.
* Outdated dnf cache – Run `sudo dnf clean all && sudo dnf makecache` before installing.
* Conflicting binaries – Having both `/usr/bin/unrar` and `/usr/local/bin/unrar` can confuse scripts; choose one or adjust your PATH.
A real-world snag I’ve seen: after a major CentOS Stream 9 upgrade, the `unrar` command vanished because the base repo dropped it. Re‑enabling RPM Fusion was the fastest fix.