Ask Your Question
0

How to use Yum cache from a system on another?

asked 2014-04-18 23:45:49 -0500

I want to use Yum cache from System A on System B (a newly installed Fedora 20) so that I won't have to download all packages again. What would be the best way to go about it?

I can just copy the '/var/cache/yum' directory from system A to system B. And do 'yum -C upgrade'.

Or should I use something like 'createrepo'.

edit retag flag offensive close merge delete

Comments

I wasn't sure if copying yum folder would create more trouble than solve so I resorted to setting up a local repository which was pretty easy.

yum install createrepo
createrepo /repository1

Then add the following repo in /etc/yum.repos.d

[customrepo]
name=Custom Repository
baseurl=file:///repository1/
enabled=1
gpgcheck=0

I didn't even have to think about the structure of the pre-existing package folder. It just worked out of box.

Source

sudhirkhanger gravatar imagesudhirkhanger ( 2014-04-19 22:54:46 -0500 )edit

@Ahmad Samir I used createrepo instead to avoid any conflict.

sudhirkhanger gravatar imagesudhirkhanger ( 2014-04-19 22:55:32 -0500 )edit

If I understand correctly every time you add new rpm packages to that custom repo you'll have to update the metadata (createrepo --update), whereas if you just copy (or rsync) /var/cache/yum between the two installations yum will check for packages there before downloading them from online mirrors; the directory structure is exactly the same if it's the same Fedora release.

Ahmad Samir gravatar imageAhmad Samir ( 2014-04-20 00:02:09 -0500 )edit

@Ahmad Samir My use case was that i wanted to reinstall Fedora without downloading all the stuff again. I thought about copying yum cache folder but decided against it because of the file conflicts and I didn't want to take cruft from one system to another. Creating local repo and using what I need sounded a better solution.

Although when you have a local repo and /etc/yum.confkeepcache=1 it still doesn't copy local repo's packages to /var/cache/yum/$basearch/$releasever It creates a folder with the repo name and is empty.

http://yum.baseurl.org/wiki/YumMultipleMachineCaching

PS:- Please mark this thread solved/answered. I don't have enough karma.

sudhirkhanger gravatar imagesudhirkhanger ( 2014-04-20 21:49:47 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-04-19 02:03:07 -0500

Ahmad Samir gravatar image

Just copying /var/cache/yum should be enough. (You probably already know this, but you should set keepcache=1 in /etc/yum.conf in both installations, or at least in system A).

For what it's worth, if you're planning on doing this on a regular basis you'd better use rsync (with the -a option) instead of just copying, should take less time as it'll only copy new files.

If I understand correctly yum checks for already downloaded packages in /var/cache/yum with and without the -C option, so you don't necessarily need to use -C.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-04-18 23:45:49 -0500

Seen: 2,240 times

Last updated: Apr 19 '14