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

Here you'll find a place for solutions and hints.

Please use one of the support subforums below for questions or if you have any issues and need support.

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

Postby magfan » Feb 5th, '14, 14:05

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?
Last edited by magfan on Feb 7th, '14, 16:24, edited 1 time in total.
magfan
 
Posts: 334
Joined: Apr 3rd, '12, 12:33

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

Postby wintpe » Feb 5th, '14, 16:59

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
Redhat 6 Certified Engineer (RHCE)
Sometimes my posts will sound short, or snappy, however its realy not my intention to offend, so accept my apologies in advance.
wintpe
 
Posts: 1204
Joined: May 22nd, '11, 17:08
Location: Rayleigh,, Essex , UK

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

Postby doktor5000 » Feb 5th, '14, 17:24

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.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18040
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

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

Postby magfan » Feb 7th, '14, 16:23

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.
magfan
 
Posts: 334
Joined: Apr 3rd, '12, 12:33

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

Postby doktor5000 » Feb 7th, '14, 18:39

Could be that urpmi.addmedia works around the missing metadata after probing for them via --probe-rpms but not sure.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18040
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

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

Postby yankee495 » Feb 8th, '14, 03:52

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
There are 10 types of people, those who understand binary & those who don't.
Main Desktop
http://www.overclock.net/lists/display/view/id/3960066
yankee495
 
Posts: 433
Joined: May 25th, '12, 13:10
Location: Carthage, Mo. USA

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

Postby doktor5000 » Feb 8th, '14, 10:45

FWIW, hope all of you know about https://wiki.mageia.org/en/Urpmi-proxy ?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18040
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany


Return to The magician suggests...

Who is online

Users browsing this forum: No registered users and 1 guest