PDA

View Full Version : configuring yum - Saving downloaded packages



jmtheron
20th February 2010, 08:37 AM
if i configured the /etc/yum.conf file to:
keepcache=1

this seems to keep downloaded packages. in the dir specified at:
cachedir=/var/cache/yum

My question is, the next time i wish to use these packages and install them, how would i use yum to do this or do i just use rpm instead ? Would it be necessary to connect to the internet to do this?
What about those package dependencies will i have to install them all one at a time?

Kind regards
Jonathan

Dangermouse
20th February 2010, 10:07 AM
If you want to use the cache to install etc. on a machine with no internet, you will need to make a localrepo of the rpms from the cache and transfer it to the machine.
There is plenty in here on creating a localrepo

glennzo
20th February 2010, 10:27 AM
Then what's the point of using keepcache? I assume that yum won't re-download a cached package if it hasn't changed. Couldn't you just use yum localinstall or something like that to reinstall something from the cache?

Dangermouse
20th February 2010, 08:00 PM
Then what's the point of using keepcache? I assume that yum won't re-download a cached package if it hasn't changed. Couldn't you just use yum localinstall or something like that to reinstall something from the cache?
Not sure what you mean there, but i suppose if you use the yum -c option it will run entirely from cahe
but im not sure how it would work if you transfered the cache to another machine, never done that.
But i have shared cache on a lan so only downloaded updates once, so in theory just transferring
the cache to another machine should work with -c option, anyone ever done this?

jmtheron
25th February 2010, 10:55 AM
i dont have internet at home so i have to pay to use the internet to download stuff to save money i dont want to download the same stuff over and over.

i tried to use the "yum localinstall" command but it gives me a **** load of dependencies. how do i setup a local repo.

i dont know how to use the -c option or if im doing somthing wrong check this :

[root@localhost local repros]# yum localinstall -c vlc-core1.0.4-1.fc11.i586.rpm
CRITICAL:yum.cli:Config Error: Parsing file failed: File contains no section headers.
file: file:///home/jony/Desktop/local repros/vlc-core-1.0.4-1.fc11.i586.rpm, line: 1
'\xed\xab\xee\xdb\x03\x00\x00\x00\x00\x01vlc-core-1.0.4-1.fc11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x 00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x 05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x8e\xad\xe8\x01\x00\x00\x00\x00\x 00\x00\x00\x07\x00\x00\x04\x84\x00\x00\x00>\x00\x00\x00\x07\x00\x00\x04t\x00\x00\x00\x10\x00\ x00\x01\x0c\x00\x00\x00\x07\x00\x00\x00\x00\x00\x0 0\x02\x18\x00\x00\x01\r\x00\x00\x00\x06\x00\x00\x0 2\x18\x00\x00\x00\x01\x00\x00\x03\xe8\x00\x00\x00\ x04\x00\x00\x02D\x00\x00\x00\x01\x00\x00\x03\xea\x 00\x00\x00\x07\x00\x00\x02H\x00\x00\x02\x18\x00\x0 0\x03\xec\x00\x00\x00\x07\x00\x00\x04`\x00\x00\x00 \x10\x00\x00\x03\xef\x00\x00\x00\x04\x00\x00\x04p\ x00\x00\x00\x01\x89\x02\x15\x03\x05\x00K(t\xeb\xad \'\x08D\x8f\xcf\xf4\xda\x01\x08V\xaa\x10\x00\x80|\ x0b\x1a\xefe\x13\x8e\xc8\x91\xc1^\xccY\x8cL%o\x9c\ x94\xf94\xa2\xcb\x86\xa8\x1f/\x15;G\x88\xdaJ(s\t\x8a\x89W>\xc1?d\x1e\x85M\xea0\xd5\x02\x1d\xd5\xc05\xe6\r\xf 3\xb2\xf6\x17\x80\x06\x0f8\xea\xa7T\xc6$\x9a\x95\x 8b\x11\xbd\xaf\xdf\x93!fu\x9bn\xdd\xcb\xb0a\x9c\r\ x18\x1c\xb6za\x1aQ\'\x80\x0f*p\x15U@\r:\\)\xbf\x7f \x85\x8aN\xdfNwJ7.%z\xd7`q\\\xaa}\x18\xeb\xa3+\x04 o\'l\xcd~#\x10\xe2\xdc\x0b\xed\xed\xa3\xee\x0c\x97 u\xb1\xce\xe5QY)\xbb\x8e[\x00\x1fV$\x8f\xa5U\x81\xd8\x0f\xad\xcf\x8bl\x90F\ xb8)%\x10\xc4\x07\xdf\xd1\x11M#\xa8\x12\'Z\xab\xbf \xab}`Igx\xa0\x94\xdfi\x83\xb6z\x7f\x9a}\x85*t?1{\ xc2Z\xe2\xf4BAw\xdf\xb1\x87Y\x19d\x9c\x93-\x05yJ\xb7\xf8\x9b\x80\xd0\x01U\x94y\xebn\xc3\x87\ x01\x80t"+\xa59\xe5&\xde\n'
You have mail in /var/spool/mail/root

glennzo
25th February 2010, 12:52 PM
This should be fairly simple to accomplish if the downloaded files are kept on the hard disk, however, it may require occasional maintenance, especially if new files are added to the local cache. Information on this practice is described here, http://yum.baseurl.org/wiki/YumMultipleMachineCaching

If it were me I would probably use the "save" folder as a local repository and point my other computers to that folder for their updates. This can be done fairly easily I believe. I have a local repository on one of my networked Fedora boxes that can be used by any of the other networked boxes. In my case I needed to create a folder and populate it with files. Then I needed to run createrepo /folder. I also needed to create a .repo file on another box that points to this new folder, for example,

[localrepo]
Name=Fedora &releasever - $basearch - Local Repository
baseurl=http://192.168.1.101/foldername/ (should be obvious that this points to the box hosting the repository)
enabled=1
That is enough to get things working. The only other thing you would need to do is update the repository if new files are added. I believe that the command would be

createrepo --update /foldername

Think it over. I could probably run through this with you given a little information about your computer.

jmtheron
25th February 2010, 04:58 PM
hi glennzo
thanks for helping me out
here is the specs of my pc Desktop: Asus a8n-SLI Delux/ AMD 3000+ / 1GB/ 80GB SATAII / NVidia GeForce 6600gt pci-e
how did you display your pc`s specs at the bottom of the screen? Signiture?

I read through the page on "YumMultipleMachineCache" but i afraid it did not make to much sense to me if you could help me that would be gr8!

Kind regards
Jonathan

glennzo
25th February 2010, 05:54 PM
My specs are just part of the signature.

As for your specs, I mean if you want to create a local repository I need to know what folder you plan to use. You should probably create a new folder. I suspect there may be access restrictions on /var/cache/yum and friends. Probably best to leave those alone.

Keep in mind that I'm away from my Fedora box right now. Not a Linux machine in sight :(

The basic idea would be to create a folder and populate it with the .rpm files from the yum cache. Since keepcache is enabled there should be some files there.


su -c 'mkdir /localrepo'Next, find the .rpm files and copy them from there to /localrepo. For example,

su -c 'cp /var/cache/yum/*rpm /localrepo/'

To summarize.

1. Create a folder
2. Find the .rpm files
3. Copy the files to the newly created folder.

Do this and we'll move forward from there.

jmtheron
25th February 2010, 06:07 PM
OK i created a dir "/localrepo" and filled it with the .rpm packages.
What`s next?

markkuk
25th February 2010, 06:33 PM
i dont know how to use the -c option or if im doing somthing wrong check this :

[root@localhost local repros]# yum localinstall -c vlc-core1.0.4-1.fc11.i586.rpm
CRITICAL:yum.cli:Config Error: Parsing file failed: File contains no section headers.

The -c option tells yum to use the file specified on the command line as the configuration file instead of standard /etc/yum.conf. The option to use only cache is -C.

glennzo
25th February 2010, 09:06 PM
OK i created a dir "/localrepo" and filled it with the .rpm packages.
What`s next?

For what it's worth, you could have named the folder anything you like. I used localrepo as an example but that will work just as well as any other name.

You need to run

su -c 'createrepo /localrepo'Before you do that you need to make sure createrepo is installed. Here goes the "away from a Linux box" part.


yum provides */createrepo will return the package that you need to install to get creatrepo. If memory servers me that package is yum-utils. Once createrepo is installed you can run it as described above.

When createrepo is finished it's time to create a .repo file on another box. To do that open a terminal on the other computer and


su -c 'nano /etc/yum.repos.d/localrepo.repo'In the file add the following, using the ip address of the computer hosting the repository in place of what I'm using in the example.


[localrepo]
Name=Fedora $releasever - $basearch - Local Repository
basurl=http://192.168.1.100/localrepo/
enabled=1Save and exit. Test the repository by trying yum repolist from the client computer. It will probably fail because of firewall or sharing issues but ideally we expect the list to include the new local repository. We'll cross that bridge later.

jmtheron
25th February 2010, 09:37 PM
OK i think i did it right but what`s this line about "No Matches found"(ln 8 of code)



[root@localhost ~]# yum provides */createrepro
Loaded plugins: refresh-packagekit
fedora/metalink | 60 kB 00:02
updates/metalink | 35 kB 00:01
updates | 4.4 kB 00:02
updates/primary_db | 5.3 MB 03:46
updates/filelists_db | 8.8 MB 06:11
No Matches found
[root@localhost ~]# yum provides */createrepro
Loaded plugins: refresh-packagekit
No Matches found
[root@localhost ~]# createrepo /localrepo
119/119 - schroedinger-1.0.7-1.fc11.i586.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@localhost ~]#

glennzo
25th February 2010, 10:37 PM
Well, as I said, I'm working from memory while at "work". No matches found means just that. Yum found nothing that provides createrepo. Maybe createrepo is a standalone. Have to check that when I get home. At any rate, it's obviously installed if you were able to use it, and you've successfully created a repository. Now, did you create the .repo file on another Fedora box and have you tested it?

For what it's worth, now that I'm home here's what I get:

[glenn@leonardo ~]$ yum provides */createrepo
Loaded plugins: fastestmirror, presto, refresh-packagekit
rpmfusion-free-updates | 3.3 kB 00:00
rpmfusion-nonfree-updates | 3.3 kB 00:00
updates/metalink | 15 kB 00:00
updates/filelists_db | 6.3 MB 00:05
createrepo-0.9.8-2.fc12.noarch : Creates a common metadata repository
Repo : fedora
Matched from:
Filename : /usr/share/createrepo
Filename : /usr/bin/createrepo
Filename : /usr/lib/python2.6/site-packages/createrepo



createrepo-0.9.8-3.fc12.noarch : Creates a common metadata repository
Repo : updates
Matched from:
Filename : /usr/share/createrepo
Filename : /usr/bin/createrepo
Filename : /usr/lib/python2.6/site-packages/createrepo



createrepo-0.9.8-3.fc12.noarch : Creates a common metadata repository
Repo : installed
Matched from:
Filename : /usr/bin/createrepo

jmtheron
26th February 2010, 08:21 AM
OK i created a localrepo .repo file, I would apresiate it if you can give me some advice on how to configure this file.
first of all can i do this just using one computer?
as you can guess i did test it this time and it doesn't work

/etc/yum.repos.d/local.repo


[localrepo]
Name=Fedora $releasever - $basearch - Local Repository
baseurl=http://127.0.0.1/localrepo
enabled=1

glennzo
26th February 2010, 09:59 AM
I think I've lost sight of what you want to accomplish. Are we talking about using the yum cached files as a local repo for several computers in the household or is your goal to cache the files and create a repository all on the same computer?.

If this is all on one computer then the baseurl line would be baseurl=file:///localrepo/

jmtheron
26th February 2010, 11:20 AM
OK i think it`s working what does this mean
Public key for libdca-0.0.5-4.fc11.i586.rpm is not installed

glennzo
26th February 2010, 01:42 PM
Old link, but it should clear things up a bit, http://www.fedorafaq.org/#gpgsig

What does yum repolist show?

jmtheron
26th February 2010, 05:43 PM
glennzo I think I've lost sight of what you want to accomplish. Are we talking about using the yum cached files as a local repo for several computers in the household or is your goal to cache the files and create a repository all on the same computer?. all on the same pc


Old link, but it should clear things up a bit, http://www.fedorafaq.org/#gpgsig

no that link did not help to much stuff that i`ve never heard of under "NOKEY warning"


[root@localhost ~]# yum repolist
Loaded plugins: refresh-packagekit
localrepo | 1.2 kB 00:00
repo id repo name status
fedora Fedora 11 - i386 enabled: 13,289
localrepo Fedora 11 - i386 - Local Repository enabled: 119
rpmfusion-free RPM Fusion for Fedora 11 - Free enabled: 377
rpmfusion-free-updates RPM Fusion for Fedora 11 - Free - Updates enabled: 988
updates Fedora 11 - i386 - Updates enabled: 7,432
repolist: 22,205

glennzo
26th February 2010, 07:48 PM
Localrepo is available to you as it is listed in that output. Now all you need to do is keep the repository updated with any new rpm's that are downloaded to the cache folder. Once the new files are copied over I believe all you need to do is run createrepo --update. Don't take my word for it though. Look at man createrepo and do a little research. Now you should be able to install from your new repository at will.

jmtheron
26th February 2010, 08:13 PM
Thanks glen! until the next time our paths cross.

glennzo
26th February 2010, 08:38 PM
They crossed again, http://forums.fedoraforum.org/showthread.php?t=241298 ;)