How to Install UNRAR on Debian

Unrar extracts RAR archive files on Debian. Whether you are unpacking downloaded software, restoring backup archives, or working with compressed media collections, you need a dependable tool that handles current RAR formats. The proprietary implementation from RARLAB supports modern RAR4 and RAR5 archives (including encrypted and multi-part sets), while the unrar-free package only handles legacy RAR1-RAR3 files.

This guide shows how to install both implementations, explains their differences, provides a quick capability comparison, and covers practical extraction examples (basic, password-protected, integrity testing, and multi-part archives). It also clarifies common pitfalls so you can choose the right package for long-term use.

These instructions cover Debian 13 (Trixie), Debian 12 (Bookworm), and Debian 11 (Bullseye). Commands work identically across all supported releases unless noted otherwise. Debian 13 uses DEB822 repository format by default, while Debian 11 uses the legacy sources.list format.

Compare RAR Extraction Options

Debian ships two RAR extraction packages. RARLAB’s non-free version supports current archive formats; unrar-free is open-source but limited to older RAR generations. If you need broad format and encryption support, choose RARLAB’s version. Only select unrar-free for strict licensing environments where you exclusively process legacy archives.

ImplementationPackageBinary / CommandSupported RAR VersionsLicensePrimary Use CaseLimitations
RARLAB Unrar (Recommended)unrar (non-free)unrarRAR1-RAR5 (full support incl. encryption & multi-part)Freeware (proprietary)Modern archives from current WinRAR and cross-platform sourcesNot open-source; packaged in non-free component; extraction only
unrar-freeunrar-freeunrar-freeRAR1-RAR3 onlyGPL (open-source)Auditable extraction of legacy RAR archivesNo RAR4/RAR5, no modern encryption, limited feature set

For most users, RARLAB’s unrar is recommended because it handles all modern RAR formats, supports encryption, and receives regular upstream security updates. Only choose unrar-free if your environment requires open-source licensing and you work exclusively with legacy archives created before 2013.

RARLAB’s Unrar (Recommended)

RARLAB’s proprietary version handles modern RAR4 and RAR5 formats created by recent WinRAR versions. RARLAB pushes upstream updates promptly for security and compatibility, supports password-protected and encrypted archives, and works reliably across UNIX-like systems and Windows. It only extracts; to create RAR files you need the separate rar package or use alternative formats like 7z or tar.xz.

unrar-free (Open-Source Alternative)

The open-source unrar-free package provides auditable source code. It cannot decode newer compression/encryption features found in RAR4/RAR5 archives (proprietary algorithm constraints), so it is limited to legacy RAR1-RAR3 files. It is suitable only if your workflows never involve modern archives and compliance demands a fully open-source tool.

Choose RARLAB’s implementation for any general-purpose desktop, server, or mixed-platform environment. Use unrar-free only for narrowly scoped, legacy archive processing where modern formats will never appear.

Update Debian Before Installation

Update your package index and apply pending upgrades first. Refreshing the package cache before installation reduces dependency resolution issues and ensures the newest archive metadata for non-free components.

sudo apt update && sudo apt upgrade

Install Unrar on Debian

Option 1: Install RARLAB’s Unrar (Recommended)

RARLAB’s version resides in Debian’s non-free component. Ensure contrib and non-free (and on Debian 12/13 optionally non-free-firmware) are enabled before installing.

Step 1: Enable the Non-Free Repository Component

Debian 13 (Trixie) and Debian 12 (Bookworm) use the modern DEB822 .sources format by default. Edit the main sources file to add the required components:

sudo sed -i 's/Components: main$/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources

This command adds contrib, non-free, and non-free-firmware to all repository entries in the DEB822 sources file. If your file already includes these components, the command makes no changes.

Debian 11 (Bullseye) uses the legacy /etc/apt/sources.list format. For Debian 11, edit /etc/apt/sources.list directly and append contrib non-free to each deb line. Do not add non-free-firmware on Debian 11 as this component does not exist on Bullseye.

For detailed step-by-step guidance on enabling these repositories, including manual editing methods and verification steps, refer to the guide on enabling Contrib and Non-Free repositories on Debian.

Step 2: Update the Repository List

After enabling the components, refresh your package list to fetch the non-free package metadata:

sudo apt update

Step 3: Install RARLAB’s Unrar

Install RARLAB’s Unrar (non-free):

sudo apt install unrar

Step 4: Verify the Installation

Verify the installation by running the unrar command without arguments. The tool displays its version and usage information:

unrar

Expected output on Debian 13 (version may differ on older releases):

UNRAR 7.12 freeware      Copyright (c) 1993-2025 Alexander Roshal

Usage:     unrar <command> -<switch 1> -<switch N> <archive> <files...>
               <@listfiles...> <path_to_extract/>

The unrar command does not support a --version flag. Running the command without arguments displays both the version and usage information. Version numbers differ by Debian release: Debian 12 includes version 6.21, and Debian 11 includes version 6.00.

This version supports RAR4 and RAR5 (plus legacy formats), encrypted archives, and multi-part sets. It cannot create new RAR archives.

Option 2: Install Open-Source unrar-free

The unrar-free package does not support RAR4 or RAR5 formats. Commands and functionality also differ from the proprietary version. Only choose this option if you work exclusively with older RAR files and require open-source tools.

Install the open-source alternative from the main repository (no non-free components required):

sudo apt install unrar-free

Verify the installation:

unrar-free --version

Expected output on Debian 13:

unrar-free 0.3.1

Version numbers differ by Debian release: Debian 12 includes unrar-free 0.1.3. The binary is always named unrar-free, not unrar.

Extract RAR Files with Practical Examples

After installing your chosen package, use these examples for common tasks (listing, full extraction with path preservation, flat extraction, password prompts, integrity testing, and multi-part handling). For other archive formats see guides on extracting .gz and .tgz files, unzipping directories, or installing 7-Zip on Debian.

Extraction with RARLAB’s Unrar

Extract a RAR archive with full directory paths preserved (current directory destination):

unrar x archive.rar

The x command preserves the directory structure. Use e to extract files into the current directory without recreating subdirectories:

unrar e archive.rar

Extract to a specific destination directory:

unrar x archive.rar /path/to/destination/

List archive contents without extracting:

unrar l archive.rar

Extract a password-protected archive (the tool prompts interactively for the password):

unrar x protected-archive.rar

Optional inline password (avoid if shell history retention is a concern):

unrar x -pYOURPASSWORD protected-archive.rar

Inline passwords appear in your shell history. Use interactive password entry for sensitive archives, or prefix the command with a space (in bash with HISTCONTROL=ignorespace) to prevent history logging.

Test archive integrity without extracting:

unrar t archive.rar

Extract a multi-part set by specifying only the first volume (for example, archive.part01.rar or archive.rar when accompanied by archive.r00, archive.r01):

unrar x archive.part01.rar

Extraction with unrar-free

If you installed unrar-free, use its binary directly (limited to legacy formats):

unrar-free archive.rar

Extract to a specific destination by first creating and changing to the target directory (unrar-free focuses on simple extraction):

mkdir -p /path/to/destination && cd /path/to/destination && unrar-free /path/to/archive.rar

Handle Untrusted Archives Safely

Treat RAR archives from unknown sources cautiously. Malicious archives can contain executable files, path traversal exploits, or symlink attacks. Before extracting untrusted content:

  • List the archive contents first with unrar l archive.rar to inspect file names and paths
  • Extract to an isolated directory rather than your home folder
  • Scan extracted content with a malware scanner if available (for example, ClamAV: sudo apt install clamav then clamscan -r extracted_directory)

Fix Common Unrar Errors

Remove Duplicate Installations

If you installed both packages, each uses a different binary name: RARLAB’s package installs unrar (technically a symlink to unrar-nonfree), and unrar-free installs unrar-free. There is no direct file conflict, but keeping both is redundant. Remove the one you do not need:

sudo apt remove unrar-free

Or remove the proprietary version if you only need legacy extraction:

sudo apt remove unrar

Password-Protected Archives Fail to Extract

If an archive fails with a password error, first confirm you are using RARLAB’s Unrar (unrar-free lacks modern encryption support). Re-enter the password carefully when prompted. For RAR5 archives with AES-256 encryption, only RARLAB’s version can decrypt them.

If you receive “CRC failed” or “No files to extract” errors despite entering the correct password, the archive may be corrupted. Test integrity first:

unrar t protected-archive.rar

“Unsupported RAR Format” Error

If unrar-free returns “unsupported format,” the archive uses RAR4 or RAR5 features. The open-source version cannot decode these formats. Switch to RARLAB’s implementation:

sudo apt remove unrar-free && sudo apt install unrar

“Unable to Locate Package unrar” Error

This error means the non-free component is not enabled in your APT sources. Verify the component is enabled:

grep -r "non-free" /etc/apt/sources.list /etc/apt/sources.list.d/

If no output appears, enable the non-free component using the steps in the installation section, then run sudo apt update before trying again.

Remove Unrar from Debian

If you no longer need RAR extraction capabilities, remove the installed package and clean up unused dependencies.

Remove RARLAB’s Unrar

sudo apt remove unrar
sudo apt autoremove

Remove unrar-free

sudo apt remove unrar-free
sudo apt autoremove

Neither package stores user configuration files in your home directory, so you do not need additional cleanup.

Verify Removal

Confirm the package is no longer installed:

apt-cache policy unrar

Expected output after removal:

unrar:
  Installed: (none)
  Candidate: 1:7.1.8-1
  Version table:
     1:7.1.8-1 500
        500 http://deb.debian.org/debian trixie/non-free amd64 Packages

The “Installed: (none)” line confirms successful removal. The Candidate version remains available for future installation if needed.

Conclusion

RARLAB’s Unrar (non-free) reliably handles RAR4/RAR5 archives, encryption, and multi-part sets, making it the practical choice for nearly all Debian users. The unrar-free package remains valuable only for legacy, compliance-focused workflows. With the correct package installed, you can list, test, and extract RAR archives confidently while applying safe practices for passwords and suspicious content.

2 thoughts on “How to Install UNRAR on Debian”

  1. (py) 16:18:41al@alsdesk:~$ sudo apt install unrar
    Package unrar is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    Error: Package ‘unrar’ has no installation candidate
    (py) 16:18:57al@alsdesk:~$ sudo apt install unrar-free
    Package unrar-free is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    Error: Package ‘unrar-free’ has no installation candidate
    (py) 16:19:06al@alsdesk:~$

    Reply
    • Thanks for reporting this, Alfred. You were absolutely right. The article had an incorrect command when you tried it in April. The guide showed sudo apt-add-repository contrib non-free, which is not a valid Debian command and would have failed silently, leaving your repositories unchanged. This explains why both packages showed “no installation candidate.”

      The article has been rewritten with the correct repository configuration. For Debian 12 and 13, use this command to enable the non-free components:

      sudo sed -i 's/Components: main$/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources

      Then refresh the package cache and install:

      sudo apt update
      sudo apt install unrar

      For unrar-free, no repository changes are needed since it’s in the main component. If it still shows unavailable after apt update, check your base repository configuration in /etc/apt/sources.list.d/debian.sources to ensure the main component is enabled and the URIs point to valid Debian mirrors.

      Your report helped identify a fundamental error in the original guide. Thank you for taking the time to document what you encountered.

      Reply

Leave a Comment

Let us know you are human: