I’m writing a blog post at the moment, wherein I am comparing the various package managers I have a reasonable amount of experience with, including ZYpp and one aspect with respect to which I am comparing them is their speed to reinstall the vim package (a package I choose at random that I knew would be present on all the distros compared), after the package has already been downloaded (so as to eliminate download time as a possible variable influencing the time taken to install the package). The problem is that, running
zypper in -y --force vim
seems to always re-download the package even when I only just installed (and hence downloaded) the package. I am here to ask is there a way wherein I can get zypper to reinstall the vim package without having to redownload it?
If the package is already in the case, zypper will take it from the cache instead of downloading it again.
Although, if the package has been updated in the meantime, zypper will of course download the new version.
You can manually install all packages in zypper’s cache by running something like:
rpm -Uvh /var/cache/zypp/packages/*/*
zypper also only runs rpm in the end to actually install packages.
OK, well I was doing this on a VirtualBox VM and I checked its cache and it does not seem like the vim package is being stored there after it is downloaded by zypper. I keep reinstalling it and every single time it re-downloads it before it installs it. I thought it was cached by default. The vim package I am referring to is the one in the openSUSE-Tumbleweed-Oss repo. How do I get zypper to store the package in the cache?
You have to set keeppackages=1 in the repo config, either with YaST, “zypper mr -k XXX”, or by editing the corresponding file in /etc/sysconfig/repos.d/.
Otherwise zypper deletes a package from the cache after it successfully installed it.
Hi
Ahh ok, think you meant /etc/zypp though I’m spoiled, have a local mirror, so never worried…
@fusion809 also be aware if running btrfs/snapper that both caching files and running lots of zypper commands will increase snapshots and space used. If not already configured, suggest you adjust the config file or run the snapper cleanup job…