The Tor Project maintains its own RPM package repository for CentOS and RHEL and Fedora.
Note: The symbol # refers to be running the code as root. That means you should have access to a user account with system administration privileges, e.g your user should be in the sudo group.
Here's how you can enable Tor Package Repository for both CentOS and RHEL and Fedora:
1. Enable epel repository (only for CentOS and RHEL)
# dnf install epel-release -y
2. Add the following to /etc/yum.repos.d/tor.repo
For CentOS or RHEL:
name=Tor for Enterprise Linux $releasever - $basearch
name=Tor for Fedora $releasever - $basearch
3. Install the Tor package
Then you can install the latest Tor package.
# dnf install tor -y
Using it for the first time, you will have to import the GPG public key.
Importing GPG key 0x3621CD35:
Userid : "Kushal Das (RPM Signing key) <firstname.lastname@example.org>"
Fingerprint: 999E C8E3 14BC 8D46 022D 6C7D E217 C30C 3621 CD35
From : https://rpm.torproject.org/fedora/public_gpg.key
Is this ok [y/N]: y