How to Install Software on Standalone (No Internet) machine

I need to add specific packages (ksh) to a windows machine running wsl2. How do I install the software with dependencies (such as ksh)?

Thanks,
Joseph

Hi there!

I think the easiest way is to download the package directly from a mirror or the CDN and then look which dependencies are missing. (you can also use pkgs.org to find the packages you need an directly download it there)

I mean like:

  • Download ksh package
  • Put it somewhere the wsl can access (which is normally the full disk /c/)
  • Run dnf install <path-to-rpm-file>
  • Then it will tell you that dependencies are missing (if you are annoyed about the repo not accessible messages disable the repos with dnf config-manager --disable <repo> or directly setting the enabled to 0 in the repo files)
  • Download these dependencies and put them also accessible
  • Run dnf install <path-to-ksh> <path-to-package-2> <path-to-package-n>

and then just retry until no dependency missing messages are there anymore and it lets you install :slight_smile:

Cheers, Lukas

1 Like

Lukas,

Thanks for the response. dnf is still trying to reach the package server and of course getting an error because the machine is not connected to the internet. Any ideas on forcing dnf to look in the local directory?

Joseph

As said you can just disable all the repos it can’t reach, it won’t even be annoyed if you don’t have any repos enabled anymore.
But if you need to, you can also point the baseurl to a filepath, like it’s done for the gpg keys (file://), that would make you clone a whole mirror though.
So disabling all repos and directly giving it the packages it wants is the easier method.

Hello @joeslide

i have no knowledge with wsl but if it possible to run rpm command there then you can

rpm -i <path-to-the-rpm-file>

the command will require sudo permission so if it was on linux you will run it as

sudo rpm -i <path-to-the-rpm-file>

hope that help and have a nice day :slight_smile:

You are correct. I have not set up our repo collection server for our systems (we run an air gapped network), but if it is like RHEL8, you have to download the entire repository AND the repodata. In 7 you could use createrepo to generate even a fractional repo, but no longer. It is a royal PITA if you miss anything, as the repo will not work.

I believe that he is having issues with the dependencies not being installed. I have used rpm to install individual files, however I am not familiar enough to know if there is a switch to determine dependencies. Even if there was, some of the dependencies have dependencies, so it can get pretty involved real quick.

I really appreciate the help. Setting “enabled =0” in all the repos did the trick.

What’s involved in syncing the repos?

Thanks again for your help!

1 Like

I do use crude ‘rsync’ from nearest official mirror with no observable pain:

for R in BaseOS AppStream CRB extras
do
  ${RSYNC} ${SOURCE}/${R}/x86_64/os/ ${DEST}/${R}/x86_64/os/
done

Apparently the dnf would have functionality to do some “smart” mirroring, but what I use has worked since CentOS 5 (or was it 4?) …


I do build some packages myself and those are in separate “local” repo, for which ‘createrepo_c’ generates metadata ok – no “modules” in that repo though.

Well as jlehtone already says you can go the very bare route of just syncing with rsync (or dnf) and then either serving it locally as directory to the wsl, or more sophisticated on another server, either via NFS, SMB, (insert other file protocols) or just plain HTTP via a webserver.

If you want fully managed repos I recommend to use either Pulp directly or layered into Foreman or even clients, when fully managing clients.

rpm -i will report missing dependency even without internet but will not be recursive so he can install all of them with same command with space between each package

and rpm --query --requires <package-file> will return the required packages

and have a nice day everyone :slight_smile:

\begin{pedantic}

rpm --query --requires -p path_to_ksh-*.rpm
rpm --query --requires ksh   # when ksh is installed

# and on system that has access to repos:
dnf repoquery --requires ksh
dnf repoquery --requires --resolve ksh | grep -v ".i686$"
1 Like

thanks @jlehtone for the extra info and have a nice day :slight_smile:

sorry to be late in getting back to you. Basically, since our is air-gapped, I have a cron job do a reposync at the first of the month, then copy the repodata directory for each repo, as well as the Packages directory, making sure only to get the files that are new since the last download. In copying them over, I simply choose to overwrite in case I copied something from the previous month, Simple, but effective. Just a hassle if you miss anything in the new files, as the repo will just not work because it is not in line with the repodata databases.