2

So I have a single machine on which I have installed CentOS Minimal and nothing more. It is completely isolated. This means the following:

  • It can never be connected to another server or laptop
  • The ONLY thing I can connect to it is a USB-disk.

My goal:

  • Run yum install docker on it so it can run containers.

So I googled around on how to download a batch of RPMs and their dependencies, and then install them on an offline system.

So I did this on my macOS laptop:

$ docker run -v $PWD/pkg:/pkg centos:7
# mkdir /tmp/empty
# yum install -y \
  --installroot /tmp/empty \
  --releasever 7 \
  --downloadonly \
  --downloaddir /pkg \
  docker

Now I have lots of RPM files inside a folder. I put that folder on a USB stick and stick it into my isolated CentOS machine. Then I run:

$ yum install /tmp/pkg/*
...
Error: Package: rpm-python-4.11.3-32.el7.x86_64 (installed)
           Requires: rpm = 4.11.3-32.el7
           Removing: rpm-4.11.3-32.el7.x86_64 (installed)
               rpm = 4.11.3-32.el7
           Updated By: rpm-4.11.3-35.el7.x86_64 (/rpm-4.11.3-35.el7.x86_64)
               rpm = 4.11.3-35.el7

I have also tried to make the folder into a repository by running createrepo inside it on my Mac via docker (since I do not have createrepo on the isolated machine and cannot install anything on it). But it gives me the exact same error.

So what are my options here? It looks to me that because of dependency hell I have to actually mirror the whole CentOS repository. If I wanted a package from EPEL I would have to mirror that one as well. That's lots of gigabytes to transfer and store just to install docker on an isolated machine.

Is there any viable solution to this?

Bonus question: What if I run RHEL on the isolated machine instead of CentOS?

5
  • The docker is for what use, as if you have clients connection on it, that are themself connected to the internet you have a potential risk to get infected or hacked by bug that you can't patch
    – yagmoth555
    Feb 15, 2019 at 20:18
  • 2
    No, there are no Internet connected clients and never will be. The only way for data of any kind in to this system is via a single USB disk. Feb 15, 2019 at 20:42
  • 1
    How do you expect to get containers onto the system, then? Feb 16, 2019 at 0:09
  • I think he was just using the container to download the RPMs on a macOS host. Feb 18, 2019 at 2:23
  • Well I was using a CentOS container to download RPMs. But I also have containers I want to run on the isolated machine and I just put them on the same USB disk as the RPM files. ¯\_(ツ)_/¯ Feb 19, 2019 at 9:48

2 Answers 2

2

Your best bet would be to maintain a more complete mirror on that USB disk. You can use reposync to get a remote repository mirrored to your storage. Run it regularly to keep it current. Then, use createrepo to create/update your repo metadata. Finally, on the isolated host, configure a yum repo for the mountpoint of that USB disk.

[usb]
name=Airgaps Are Fun
baseurl=file:///mnt/usbdisk
enabled=1
gpgcheck=1
gpgkey=file:///mnt/usbdisk/gpgkey

Any thing else is going to be a nightmare when depsolving.

3
  • Thank you. reposync worked much better than yum --downloadonly for some reason. Feb 19, 2019 at 9:47
  • 1
    Wouldn't it make more sense to copy the contents of the usb repo to the standalone yum than to keep the usb plugged in all the time? Feb 21, 2019 at 20:10
  • It depends on how often you find yourself installing new packages. I was imagining this would be a more periodic update thing, but yes, you could copy them locally if it would be more convenient. Feb 22, 2019 at 13:44
0

I think you can run rpm -q -R -p <package.rpm> (there may be a yum equivalent) to view the required dependencies of a package. You could pipe that output to a call to download those dependencies. Obviously you'd need to do that on a network enabled machine but you could move the resulting files to the disconnected machine and install them iteratively. Ordering them could be a problem I suppose but you'd have all the required items and if you just ran the install multiple times, you'd eventually get everything.

You mentioned docker and CentOS, so not sure if you've seen this question already: Installing Docker on an isolated (no internet) Centos 7 box?

1
  • Yes, I have seen those and the reason I am asking is because their solution doesn't seem to work. In my experience running rpm -qRp will give me the same result as running yum --downloadonly. Feb 16, 2019 at 0:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .