Back to Blog

Solution to Error E: Package 'unrar' has no installation candidate when installing rar/unrar on Ubuntu

This error message indicates that apt-get cannot find a package named unrar in any of its configured repositories. While enabling the "multiverse" repository and running sudo apt-get update might resolve this for some, an alternative and robust solution is to download and compile the official RAR/unRAR tools directly from the developer, rarlab.com. This method ensures you get the latest stable version and bypasses any repository-related issues.

Understanding RAR and unRAR

RAR is a proprietary archive file format that supports data compression, error recovery, and file spanning. It was developed by Eugene Roshal. While many Linux systems use open-source alternatives like zip and tar.gz, RAR remains a popular format, especially for sharing large files. The unrar utility is the command-line tool specifically designed to extract files from .rar archives. Since the RAR format is proprietary, the unrar utility often needs to be obtained from the official source or through non-free repositories.

Solution Overview: Manual Installation from Source

The most reliable way to install unrar when apt-get fails is to manually download the official Linux binaries from the rarlab website and compile them. This process involves a few straightforward steps:

  1. Prepare your system by ensuring necessary build tools are installed.
  2. Determine your system's architecture (32-bit or 64-bit).
  3. Download the appropriate RAR for Linux package from rarlab.com.
  4. Extract the archive and compile the source code.
  5. Verify the installation and confirm unrar is operational.

Let's walk through each step in detail.

Step 1: Prepare Your System (Prerequisites)

Before you can compile software from source, your Ubuntu system needs to have the necessary development tools installed. The build-essential package is a meta-package that includes a C/C++ compiler (GCC), make, and other utilities required for compiling most software.

Open your terminal and run the following commands to update your package lists and install build-essential: