Currently, I am using Fedora 26 for my daily use. I want to transfer all the packages which I have installed with command
sudo dnf install
to another fedora desktop (as it doesn't have access to internet).
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
A simple way is using the "--downloadonly" option :
sudo dnf --downloadonly install <whatever>
this downloads the rpm package(s) and also its/their dependencies as needed for on the desktop that has internet access (let's call it "computer-A"),
then transfer the rpms to other system (computer-B) and
sudo dnf install *.rpm
Note: if computer-B is missing some packages compared to computer-A, you may need to iterate in downloading rpms. In such case, "dnf download" command might be more appropriate to get missing rpms for computer-B (see https://dnf-plugins-core.readthedocs.io/en/latest/download.html).
An alternative is to set "keepcache=1" in /etc/dnf/dnf.conf in computer-A, and simply run 'dnf install ': this will retain installed packages files in computer-A, that you'll find rpm files in /var/cache/dnf/... Note that this doesn't resolve the case where computer-B is missing packages compared to computer-A.
Another alternative is to create a local repository : see https://www.techrepublic.com/blog/linux-and-open-source/create-your-own-yum-repository/ (this is for yum but applies also for dnf).