Installing packages without direct Internet Connection (like apt-offline)

Dear fellows,

I’m looking for a way to install packages on an openSUSE (Leap 15.3) system which does not have a direct connection to the Internet. Debian/Ubuntu offers apt-offline for this purpose, is there some similar tool for zypper?
I know how to do it by hand, ie. downloading individual packages on a connected system, inspecting its requirements and then recursively repeating the process for all not yet installed packages, but that can be quite boring.

cheers

Hi
Seems similar to the download-only option for install later. So could be to say a USB device with setting the pkg-cache-dir option.

Could this not download a dependency package needed for the offline system, if it is already installed in the online box, thus breaking the offline installation?

Just curious.

I’m not familiar with apt-offline but probably

zypper install --dry-run  --download-only

is what you are looking for.

man zypper

will give you the details.

All checks which zypper does are run against the configuration of the machine on which zypper is running. If the target machine - which is supposed to receive the downloaded packages - has a different setup …

Regards

susejunky

No really. Poor man workaround could be implemented by copying @System repository from disconnected system to online system, running “zypper --no-refresh in --download-only …” and copying downloaded packages back to disconnected system.

If you can afford mirroring of full repository, I guess this would be much more simple option. Quick estimation of oss repo including only Intel packages:

Number of files: 41,067 (reg: 41,054, dir: 13)
Total file size: 61,941,145,882 bytes

and update repository (again, skipping all non-Intel):

Number of files: 16,500 (reg: 16,457, dir: 43)
Total file size: 55,039,356,007 bytes

Of course update repository will grow over time.

No, it is not. There is no (simple) way to tell zypper to use list of installed packages from another system. List of packages computed by zypper on one system does not in general match another system.

Thank you for all the answers! I definitely didn’t expect that much feedback.

Setting the caches is a good hint for easy extraction of the rpm-files, thanks!

Thanks for the idea, but how can I copy @System - which is the state of the installed packages I assume? - to the other system, which path is relevant for that?

A full repo mirror is not an option.

Path is /var/cache/zypp/solv/@System/. --no-refresh is mandatory to preserve copied content (otherwise it will be recreated from local RPM database). Of course, you will also need to clean any existing downloaded packages (zypper clean) and refresh remote repositories in advance.

not sure , maybe saving .rpm packages could be an alternative?

Yes, that is what the last sentence of my post was supposed to hint at.

Regards

susejunky

In order to save bandwidth i keep a central repo cache for all my openSUSE Tumbleweed installations on my NAS.

Nevertheless one problem remains:

As soon as the configuration (i.e. set of installed packages) between the installations varies then the cache may not be able to satisfy all dependencies for all installations at any time. For my setup this is not a problem because every installation has a working internet connection of its own and will download any package not already in the cache from the repo-server (and add it to the cache). But if an installation has no internet access then it will not be able to download packages which are not (already) available in the cache from the repo-server.

Regards

susejunky

Hi
Consider running a SMT server (whilst SLE centric is available for use with openSUSE)?

Here is what works. Copy /etc/products.d, /etc/zypp and /usr/lib/sysimage/rpm in temporary directory on another system which is connected to Internet. This system better be running the same openSUSE version (another version may work but untested). Run zypper --root=temporary-directory patch (install, update) --download-only. Copy downloaded RPMs to your disconnected system and install.

leap15:~ # tree -L 3 /var/tmp/zypper
/var/tmp/zypper
├── etc
│   ├── products.d
│   │   ├── Leap.prod
│   │   └── baseproduct -> Leap.prod
│   └── zypp
│       ├── apt-packagemap.d
│       ├── credentials.d
│       ├── locks
│       ├── multiversion.d
│       ├── needreboot
│       ├── needreboot.d
│       ├── repos.d
│       ├── services.d
│       ├── systemCheck
│       ├── systemCheck.d
│       ├── vars.d
│       ├── vendors.d
│       ├── zypp.conf
│       └── zypper.conf
├── run
│   └── zypp.pid
└── usr
    └── lib
        └── sysimage


16 directories, 8 files
leap15:~ # zypper --root=/var/tmp/zypper patch --download-only
Retrieving repository 'Main Repository (NON-OSS)' metadata ...............[done]
Building repository 'Main Repository (NON-OSS)' cache ....................[done]
Retrieving repository 'Update Repository (Non-Oss)' metadata .............[done]
Building repository 'Update Repository (Non-Oss)' cache ..................[done]
Retrieving repository 'Main Repository (OSS)' metadata ...................[done]
Building repository 'Main Repository (OSS)' cache ........................[done]
Retrieving repository 'Main Update Repository' metadata ..................[done]
Building repository 'Main Update Repository' cache .......................[done]
Retrieving repository 'Update repository of openSUSE Backports' metadata .[done]
Building repository 'Update repository of openSUSE Backports' cache ......[done]
Retrieving repository 'Update repository with updates from SUSE Linux Ente[done]
Building repository 'Update repository with updates from SUSE Linux Enterp[done]
Loading repository data...
Reading installed packages...
Resolving package dependencies...


The following 4 items are locked and will not be changed by any action:
 Available:
  kernel-firmware pavucontrol ucode-amd ucode-intel


The following package is going to be upgraded:
  cyrus-sasl


The following NEW patch is going to be installed:
  openSUSE-SLE-15.3-2022-383


1 package to upgrade.
Overall download size: 54.3 KiB. Already cached: 0 B. Download only.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package cyrus-sasl-2.1.27-150300.4.3.1.x86_64
                                           (1/1),  54.3 KiB (155.1 KiB unpacked)
Retrieving delta: ./x86_64/cyrus-sasl-2.1.27-2.2_150300.4.3.1.x86_64.drpm, 18.3 KiB
Retrieving: cyrus-sasl-2.1.27-2.2_150300.4.3.1.x86_64.drpm .[done (170.8 KiB/s)]
Applying delta: ./cyrus-sasl-2.1.27-2.2_150300.4.3.1.x86_64.drpm .........[done]
leap15:~ # ll /var/tmp/zypper/var/cache/zypp/packages/repo-sle-update/x86_64/
total 56
-rw-r--r-- 1 root root 55632 Feb 26 17:02 cyrus-sasl-2.1.27-150300.4.3.1.x86_64.rpm
leap15:~ # 

Well, it performs full repo mirror … that is what it is designed for.