Run Specific unrar Version Without Overwriting Default

Running a specific version of unrar alongside an existing system installation requires isolating the alternative binary to prevent it from conflicting with your default package manager. By downloading or compiling the target version into an independent directory, you can invoke it using relative paths, absolute paths, or custom shell aliases without altering your primary /usr/bin/unrar executable.

Step 1: Obtain the Specific unrar Version

Download the required version's pre-compiled Linux binary or source code directly from the official RARLAB repository or release archives. If downloading source code, extract the archive and compile the binary locally:

tar -xvf unrarsrc-X.X.X.tar.gz
cd unrar
make -f makefile

This compiles a standalone unrar executable inside the current working directory without performing a system-wide installation.

Step 2: Place the Binary in an Isolated Directory

Do not move the resulting executable to standard system paths like /usr/bin/ or overwrite /usr/local/bin/unrar. Instead, store the binary in an isolated location, such as a designated directory in /opt or your user home directory:

sudo mkdir -p /opt/unrar-custom
sudo cp unrar /opt/unrar-custom/
sudo chmod +x /opt/unrar-custom/unrar

Alternatively, you can place it in ~/.local/bin/ with a unique name to prevent naming collisions:

cp unrar ~/.local/bin/unrar-custom
chmod +x ~/.local/bin/unrar-custom

Step 3: Run the Custom Version Directly

To use the custom version without invoking the system default, call the binary by its explicit path:

# Using an absolute path
/opt/unrar-custom/unrar x archive.rar

# Using a renamed local binary
~/.local/bin/unrar-custom x archive.rar

Step 4: Create a Command Alias (Optional)

If you need frequent access to the secondary version, configure a persistent alias in your shell configuration file (such as ~/.bashrc or ~/.zshrc):

alias unrar-custom='/opt/unrar-custom/unrar'

Apply the changes:

source ~/.bashrc

Now, typing unrar will continue to run your standard system default, while typing unrar-custom will execute your specific standalone version.

Step 5: Verify the Active Versions

Confirm that both versions remain independent by checking their version numbers:

# Check the system default
unrar | head -n 2

# Check the custom version
/opt/unrar-custom/unrar | head -n 2