Add repository on Fedora 41 with DNF5

How to add a repository on DNF5, the right way.

Another quick tip. I was setting up the Hashicorp repository for a vagrant install and noticed that their instructions do not work on Fedora 41.

These are the official instructions:

sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
sudo dnf -y install vagrant

Adding a repository like that does not work on DNF5. The correct syntax is:

sudo dnf config-manager addrepo --from-repofile=https://rpm.releases.hashicorp.com/fedora/hashicorp.repo

Everything else stays the same.