If you’ve ever needed to install rpms on servers that are cut-off from the internet, but you still want those rpms to managed by dnf (the replacement for yum in Rocky8) this quick tutorial is for you.
What you’ll need:
A Rocky 8 Linux host connected to the internet
A Rocky 8 Linux host not connected to the internet
A way to copy files between them. On my example I have a linux host that can connect to #1 and #2.
On Your Internet Connected Linux Host
Download the package of interest and create a repo from the downloaded content, then tar that up. In this case let’s use docker community edition as an example:
On Your Linux Host That Can Connect To Both
Download the archive and copy up to the linux host not connected to the internet
On Your Non-Internet Connected Linux Host
Extract the archive to tmp directory:
Create a new repo file with the following contents:
Clear and then re-create the dnf cache:
Check to see if your packages show up as options when all repos except your local offline ones are blocked:
Assuming they do show up, go ahead and install them like this:
Now not only do you have your rpms installed, but their origin can be determined as coming from a local repo when you query dnf: