It can be done, because dnf can be made to point to a repository on a local disk instead of one on the internet. However, the local disk needs to have the packages in their rpm file form. Most of the release ISOs are “live images” which do not contain the rpm files. They contain the installed versions of the packages, which is how we can run them just off the USB stick.
I know that we used to generate DVD images that contained the full package set, but I don’t think we do this anymore. We’ll have to check with the infrastructure/release engineering team. Even the “everything” installer requires an internet connection, and only downloads rpm packages on-demand.
So, a ready-made ISO may not be available. What you can do, though, is download the packages you need (along with their dependencies) on a local disk/usb stick and then use that as a repo. This usually only requires a few steps:
on a machine with network access, download the packages and their dependencies you need with dnf download --alldeps to a local folder (people also download the whole package set, but that’s quite huge)
run createrepo_c in the folder to generate the necessary repository metadata
set up a repository file in /etc/yum.repos.d to point to your new repo
So, in this case it works because this one package that you tried to install may not have other dependencies. I.e., it does not require any other packages to be installed with it. If it did, rpm would’ve thrown an error. In cases where packages do need other dependencies, you need to have them all available.
where package 1..n are all the necessary packages. This means that you need to figure out this full list on your own (it’s called “resolving” dependencies). I guess a way is to install a package, if it fails, see what capability it needs, then download the package that provides the capability and try to install them both etc etc.
The way I noted above takes care of the dependency resolution for you because when dnf is downloading the packages, we’ve asked it to resolve the dependencies for us. Once you’ve done that, you can copy the files to your stick, and go:
sudo dnf install ./<package 1>.rpm ...
If you create a repository, you don’t need to even specify the rpm files to dnf, because dnf can fetch the packages from the repository itself. In that case, you can just go:
sudo dnf install <package>
no need to specify the full path to the rpm, the repository metadata tells dnf where to find them
no need to provide the other dependency packages—dnf can also fetch those from your repository.
So multiple ways of going about it. Depends on what package you are installing, and how many dependencies it has and so on.