Is it possible to install packages from the USB sticking containing the ISO when my computer has no internet connection?

Without an internet connection, is it possible to install software packages directly from a USB stick containing a Fedora ISO?

If yes, what are the detailed steps that I should take with regards to Fedora 35? I have used Google to search for answers and most of them were for Fedora 8 or 9…

Thanks for your help.

1 Like

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

A repository file will be something like this:

name=Fedora $releasever - $basearch - local

The baseurl bit is what you need to tweak to point to the location of your repository.

1 Like

I think the USB storage filesystem also needs to be compliant with Linux right, ex ext4 ? It may not work well with either NTFS or FAT variants.

No, as long as it the USB device can be read by the system the actual file system shouldn’t matter, I don’t think. Repositories are just folders containing RPM files with some metadata.

1 Like

Hi Ankur

Thanks for your tip.

Let’s say my Fedora system is missing the package called iwl3160-firmware-

I download it using the link and save it to a USB stick.

I plug the USB stick into my machine and type the following commands:

sudo mkdir /media/usb11
sudo mount /dev/sdb1 /media/usb11
cd /media/usb11
sudo rpm --install iwl3160-firmware-

I believe the package iwl3160-firmware- is installed because no error messages are displayed on the screen.

What do you think of my method, Ankur?

1 Like

You should check with rpm -qa \*iwl3160\*.

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.

With rpm, you’d have to use:

sudo rpm -i <package 1>.rpm <package 2.rpm> ...<package n>.rpm

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.

1 Like