2 ways to Install Unrar on Rocky Linux | AlmaLinux 8

Learn the commands to install Unrar tool on AlmaLinux 8 and Rocky Linux 8 to uncompress or compress RAR archive format files using the terminal.

Packing files into archives and reducing their size using compression algorithms is a common operation in the data processing. A basic distinction is made between archives and compressed files. An archive is an uncompressed container for files. This archive can be compressed using compression methods. However, there are a few formats that also include compression, such as RAR, gzip, bzip2, 7z, Brotli, and more…

Well, Unrar is not available to use by default for AlmaLinux or Rocky Linux because it is not available to install using the base or APPstream repository. Then how will you extract RAR compressed files? For that, you can follow this tutorial.

Steps to install and use Unrar on AlmaLinux | Rocky Linux 8

The two methods given here have their own benefits. If you use the RPM Fusion method, then you can get the future stable updates for Unrar by just running the system update command. Whereas in the other method no doubt we get the latest version by manually downloading the binary but the downside is you won’t get updates automatically; this implies, with every version update the user has to download and install by self as we have shown in this article.

#1st method using RPM Fusion repo

1. Requirements

Redhat based Linux such as Rocky/AlmaLinux/CentOS/Fedora
A non-root sudo user
Internet connection

 

2. Add RPM Fusion repository

Well, as I said Unrar package is not available to download through the default system repository, hence to get it we can add the RPM Fusion non-free repository on our RPM-based Linux. Here is the command to add version 8 of the repository.

sudo dnf install dnf-plugins-core -y
sudo dnf install https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm

Add RPM Fusion Non Free repository

 

3. Run DNF update

To properly integrate the RPM Fusion repository into our AlmaLinux or Rocky 8, run the system update command:

sudo dnf update

 

4. Command to install unrar on AlmaLinux | Rocky Linux 8

That’s it, we already have set the things we require for the installation of Unrar on either Almalinux or Rocky Linux 8. Use your DNF package manager along with the “install” argument to get this software on your system.

sudo dnf install unrar -y

Install Unrar AlmaLinux or Rocky Linux 8

 

5. To check the version

To confirm which version is currently installed on your system, we can use the given command:

unrar

unrar version check linux

 

6. Uninstall or remove

If you don’t require the RAR package got from the Fusion repo, then we can easily delete the same, using:

sudo dnf remove unrar

 

#2nd method using Tarball file

Note: If you have already used the repository method to install the rar/unrar, then first remove the same.

6. Get the latest Unrar version on Almalinux

In the previous step, you got the Unrar from the Fusion repository but that will not be the latest one. For that, you can use directly download the binary of Unrar available on its official website of it. Open your browser and point it to the aforementioned website link.

Click the Linux x64 link and download the file.

download Linux unrar from its offcial website

Open your command terminal.

As whatever we download from the browser goes directly into the Downloads folder by default, hence first switch to that.

cd Downloads

Extract the downloaded Tarball file:

tar -xf rarlinux-x64-*.tar.gz
cd rar
sudo cp -v rar unrar /usr/local/bin/

to check version

unrar

comamnd to check rar version

To remove the same in the future, just delete the copied rar and unrar binaries

sudo rm /usr/local/bin/rar
sudo rm /usr/local/bin/unrar

 

6. How to use Unrar to extract RAR files

Once the installation is done we can either use this archiving tool to compress files in RAR or decompress the already existing files.

To decompress or extract RAR files:

Syntax:

unrar e filename.rar

Replace the filename.rar with the file name you want to extract.

To extract the file into some folder or directory, use the following

unrar e filename.rar /target-directory/

Example:

unrar e h2s.rar /opt/

 

7. To extract as directory structure

Use this command if you want to extract the file as its directory structure.

unrar -x filename.rar

 

8. List archive contents

If you have a RAR file and want to extract

unrar l[t[a],b] filename.rar

For example:

unrar l[t[a],b] h2s.rar

 

9. Unrar or uncompress some password protected RAR file

Well, there are many times when we get a password-protected RAR file from the web or over email. Use -p option.

Syntax:

unrar -x -p filename.rar

Example:

unrar -x -p h2s.rar

 

10. To create a RAR file on Almalinux or Rocky Linux

If you want to compress folder files in a rar format. Then you can do that as well using the command terminal.

rar a your-file.rar targert-folder or file

your-file.rar– Replace with the file name that you want to give to your RAR file.

target-folder or file: Replace it with the folder or file that you want to compress and create a RAR file

For example – We have a folder called demo and now I want to compress and create a rar format file of  it, the command will be like this:

rar a myimages.rar /media/photos

 

Other Articles:

How to install Unrar Debian 11 Bullseye or 10 Buster Linux
How to install VLC Player on Almalinux 8 / Rocky Linux 8
Linux Zip Commands to Archive or Unarchive files

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.