https://www.nburles.co.uk/raspberrypi/installing-unrar-on-the-raspberry-pi

A basic version of "unrar" can be installed simply with:

apt-get install unrar-free

However this is unable to handle the RAR v3.0 format (which most .rar files probably use). For this we must use "unrar-nonfree", which isn't in Raspbian's repositories. Not to worry, it can be installed easily enough using the APT system...

Firstly ensure that the following line exists in your /etc/apt/sources.list (and isn't commented - i.e. the line doesn't start with a #):

deb-src http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpi

Then run:

apt-get update

Now it's a simple matter to install the application...

apt-get build-dep unrar-nonfree

apt-get source -b unrar-nonfree

dpkg -i unrar_*_armhf.deb