Page 1 of 1

[SOLVED] How to download rpms listed in /var/log/rpmpkgs?

PostPosted: Feb 5th, '14, 14:05
by magfan
How can I efficiently download all rpm packages which are listed in /var/log/rpmpkgs? I want to put them on a DVD for a re-installation without network connection. Can I add this DVD as update media for urpmi?

Re: How to download rpms listed in /var/log/rpmpkgs?

PostPosted: Feb 5th, '14, 16:59
by wintpe
this is a damm good question, and i would like to see it answered also

i do precisily this on redhat/centos with reposync and createrepo

would like a way to replicate the mageia setup, including the versions of the packages that i want to

install.

how do you do the equiverlent of createrepo in a mageia repo

does not need to be on a DVD, via an http server would be fine, just
like redhat/centos/fedora/scientific do.

regards peter

Re: How to download rpms listed in /var/log/rpmpkgs?

PostPosted: Feb 5th, '14, 17:24
by doktor5000
Should be possible if you have configured the repos which contain all those packages via

Code: Select all
urpmi --no-install $(cat /var/log/rpmpkgs | sed 's/.rpm$//')

Although depending how much packages you have in there you may have to chop the list into pieces, as either shell argument limit or urpmi argument size will kick in :shock:
So maybe as quick&dirty workaround use a loop:
Code: Select all
for pkg in $(cat /var/log/rpmpkgs | sed 's/.rpm$//'); do urpmi --replacepkgs --no-install ${pkg};done

EDIT: Seems it doesn't work on installed packages, so does not provide the same functionality as e.g. yum reinstall --downloadonly/yumdownloader/repotrack :(
EDIT2: Gotcha! Simply add --replacepkgs :)

Default download directory is /var/cache/urpmi/rpms

Then copy that directory somewhere or mount it via network to the other machine, and inside thatfolder simply run
Code: Select all
genhdlist2 .
- that's the equivalent to createrepo.
Doesn't matter where you put this, if onto local filesystem, via network or removable media . urpmi doesn't care about that, same as for Fedora/RHEL, the only thing you need to pay attention that the path to the repo includes the protocol (like baseurl=file://). Otherwise the downloaders don't care, even RPM itself supports all download protocols itself.

Re: How to download rpms listed in /var/log/rpmpkgs?

PostPosted: Feb 7th, '14, 16:23
by magfan
Code: Select all
for pkg in $(cat /var/log/rpmpkgs | sed 's/.rpm$//'); do urpmi --replacepkgs --no-install ${pkg};done

EDIT: Seems it doesn't work on installed packages, so does not provide the same functionality as e.g. yum reinstall --downloadonly/yumdownloader/repotrack :(
EDIT2: Gotcha! Simply add --replacepkgs :)

Default download directory is /var/cache/urpmi/rpms


This works perfectly well if you do it on the same system for which you want to download the packages. But it does not work properly if you want to download packages for an other system with different software installed. The reason is simple: with the option --replacepkgs only those packages will be downloaded which are installed on the system where you run urpmi. If you need to download packages which are not installed on this maschine different options have to be specified. In my case I succeeded with "--download-all --force" for the missing packages. OK, I had to run the loop twice to get all required packages, but finally I got them all. Thanks a lot doktor5000!

Code: Select all
Running on host1:
1. for pkg in $(cat rpmpkgs.host2 | sed 's/.rpm$//'); do urpmi --replacepkgs --no-install ${pkg};done
2. for pkg in $(cat rpmpkgs.host2 | sed 's/.rpm$//'); do urpmi --download-all --force --no-install ${pkg};done



Then copy that directory somewhere or mount it via network to the other machine, and inside thatfolder simply run
Code: Select all
genhdlist2 .
- that's the equivalent to createrepo.
Doesn't matter where you put this, if onto local filesystem, via network or removable media . urpmi doesn't care about that, same as for Fedora/RHEL, the only thing you need to pay attention that the path to the repo includes the protocol (like baseurl=file://). Otherwise the downloaders don't care, even RPM itself supports all download protocols itself.


I copied the packages to a local folder on host2. So, I did not need this. Running
Code: Select all
urpmi.addmedia Host2_rpms /path/to/local/folder
on host2 was just enough.

Re: [SOLVED] How to download rpms listed in /var/log/rpmpkgs

PostPosted: Feb 7th, '14, 18:39
by doktor5000
Could be that urpmi.addmedia works around the missing metadata after probing for them via --probe-rpms but not sure.

Re: [SOLVED] How to download rpms listed in /var/log/rpmpkgs

PostPosted: Feb 8th, '14, 03:52
by yankee495
Just go to a mirror and download all of the packages. You can also make it keep packages after it installs them.

I found this a long time ago and kept it along with the author info.

When a .rpm file is being downloaded, it's stored in
/var/cache/urpmi/partial. Once it's been completely downloaded, it's moved
to /var/cache/urpmi/rpms. Once all of the needed dependencies have been
downloaded the group of rpm packages will be installed, and then the .rpm
files will be deleted.

You can prevent them from being deleted by using the --noclean option, when
running urpmi from the command line, or by adding settings to
/etc/urpmi/urpmi.cfg

I've done the latter. Here's what I currently have in the global options
part of urpmi.cfg
{
downloader: wget
keep: 1
post-clean: 0
pre-clean: 0
resume: 1
retry: 30
verify-rpm: 1
wget-options: --timeout=300 --continue --progress=bar:force --inet4-only
}

See man urpmi.cfg and man wget, for explanations of these, and other options
that can be specified there.

Regards, Dave Hodgins

Re: [SOLVED] How to download rpms listed in /var/log/rpmpkgs

PostPosted: Feb 8th, '14, 10:45
by doktor5000
FWIW, hope all of you know about https://wiki.mageia.org/en/Urpmi-proxy ?