The unrar program, which serves to open and extract popular .rar archives, is often available for install from repositories of a given Linux distribution. That should make installing it easy by using your distribution's package management system. That can be either a graphical user interface program like Ubuntu Software Center, or a command like tool like apt-get.
Some distributions may, however, require you to enable or add an additional repository to those included by default, which is usually the one containing various proprietary packages. This is because unrar, with the exception of the unrar-free package (which doesn't support all .rar files), is proprietary software. It's not open source. Some distributions avoid including non-free or non open source software by default, because they want to encourage using only Free Open Source Software, either for philosophical or practical reasons.
With that said, here is how to install unrar in the few most popular Linux distributions.
Ubuntu, Linux Mint
This also covers all of the Ubuntu variants like Xubuntu, Kubuntu, and Lubuntu. I know, those names are kinda hilarious when you string them together like that! But on to the install:
sudo apt-get install unrar
Debian is the grandaddy of Ubuntu, but it follows a quite different philosophy, and so does not enable the non-free repository by default. To enable it run (or copy-paste) the following command:
sudo echo 'deb ftp://ftp.us.debian.org/debian/ wheezy non-free deb http://security.debian.org/ wheezy/updates non-free deb http://volatile.debian.org/debian-volatile wheezy/volatile non-free' >> /etc/apt/sources.list.d/wheezy.non-free.list
If by the time you read this you're running a newer version than Debian 7 (codenamed "wheezy"), just replace "wheezy" above with the new codename.
After adding the repository you should update the package database to make new packages available for install:
sudo apt-get update
And then you can install the same way you would in Ubuntu:
sudo apt-get install unrar
In Fedora you need to add a RPM Fusion Non-Free repository before you can install unrar. Not to worry, this is pretty easy. Just follow the simple instructions provided at RPMFusion.org.
It involves downloading and launching a couple of files, and following prompts on the screen. Command line set up options are also shown.
Once you have it you can simply run the following command to install:
sudo yum install unrar
Speaking of Fedora it may be worth mentioning that Korora, a Fedora-based distribution, enables this repository by default so if you use Korora all you need to do is run the above yum command.
sudo zypper install unrar
That should be it for openSUSE since the "non-oss" (non open source) repository, which contains unrar, is added and enabled by default.
pacman -S unrar
Same story as openSUSE.
If you're running any other Linux distribution chances are it is a derivative of any of the above or otherwise contains unrar in its official repositories. As a last resort option, which you probably wont need, you can download unrar directly from the RarLabs web site.
The RAR for Linux package, available for download there, contains both unrar and rar binaries as well as the makefile that allows you to easily install them. Just extract the package to any directory, then in the command line change the directory you are in to the extracted directory, and run the make command as a superuser.
In other words:
cd Downloads/rar/ && sudo make
The make command will copy the binaries to locations where Linux is looking for binaries, so you can run the rar and unrar commands as normal.
Don't do this, however, unless you really have to. Chances are your distro has unrar packaged up already and available for install. You can also check for that at pkgs.org (if your distro is listed).