Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (No Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 26th April 2006, 04:15 PM
liro's Avatar
liro Offline
Registered User
 
Join Date: Oct 2005
Location: Switzerland
Age: 30
Posts: 233
Smile How To setup a yum repository mirror (or cache)

description
this one describes the work to setup a local repository cache (for example in a network, a server which mirrors the fedora updates repo). so all the clients load their updates from this server without downloading them from the internet (which saves internet traffic).

i know theres another way to create your own repo with 'createrepo', but we made here a similar copy (a mirror) of a repository which doesen't allows rsync...

this is the english translation out of the (german) documentation here: http://www.liro.ch/doc/showdoc.php?d...repo_cache.inc

the howto

default repository's in fedora
by default there were three repository's enabled in fedora core linux. these are 'fedora core', 'fedora updates' and 'fedora extras'. all these repos are defined in '/etc/yum.repos.d' in a .repo file:
Code:
liro@fc5 yum.repos.d]$ ll
-rw-r--r-- 1 root root 840 Mar 15 00:20 fedora-core.repo
-rw-r--r-- 1 root root 763 Mar 15 00:20 fedora-extras.repo
-rw-r--r-- 1 root root 790 Mar 15 00:20 fedora-updates.repo
there were more repository definitions in other (and maybe inside these) files, but these three ones were enabled by default. in this howto we want to cache (or mirror) the updaes-released (fedora-updates.repo) repository. of course you can cache every repository you want...

choose a mirror
you can take a look into the .repo file, where you can find the baseurl and the mirrorlist (by default baseurl is commented out to use a mirrorlist):
Code:
[updates]
name=Fedora Core $releasever - $basearch - Updates
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/
mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc$releasever
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
'$releasever' means your fc version (in fc5 -> 5). probalby you'll get a better result with this link (here sorted by repo and country). so choose a mirror close to you (for better download performance)...

synchronizing the choosen mirror
now we wan't to mirror a repository directory without rsync support. for this prupose we need 'lft' (if not installed, 'yum install lftp'). lftp supports a command mode, which we can use to log in to our ftp-server, navigate to our target-directory and synchronize the content.
with the following command we synchronize the switch.ch mirror (http://mirror.switch.ch) with these options:
  • transfer limit of 80kbits/s [set net:limit-rate 81920]
  • first delete the local (outdated) rpms [--delete-first]
  • ignore the 'debug' subdirectory [-X debug/*]
  • target direcotry is '/repo_cache/updates_fc5'
  • log the whole process to logfile 'fc5_repo_update.log'

Code:
lftp -c 'set net:limit-rate 81920;open mirror.switch.ch;anon;mirror --log=/repo_cache/fc5_repo_update.log --delete-first -X debug/* /mirror/fedora/linux/core/updates/5/i386/ /repo_cache/updates_fc5'
note that this is one line, without CR's. on the first attempt, this one takes realy, realy long time...(there could be a couple of GB updates...). but on the following attemtps, its done realy fast, cause only new content is downloaded...

share your repo with nfs
next step you have to do, is to setup a nfs share to your repo-data. in our example this would seem like this in '/etc/exports':
Code:
/repo_cache	*(ro,sync)
connect your clients
now connect your clients to the nfs share, setup above. this can be done even static in /etc/fstab or dynamicly with automounter (autofs service). i would recommend the last option...

update your yum config
now, that you have access to your repo-data you must update your yum config. in my opinion the easiest way is to add a .repo file with the updated urls:
Code:
[cache-updates]
name=Fedora Core $releasever - $basearch - Updates
baseurl=file:///[nfs-mount-directory]/updates_fc$releasever
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
you can also copy the original 'fedora-updates.repo' to 'fedora-updates-cache.repo', but you must update the italic lines above to your needs....

important: the newly created file must even be sorted before the original fedora-updates.repo file (test with ll /etc/yum.repos.d) or you must temporarly (--disablerepo updates-released) or permanently (enabled=0 in repo-file) the fedora-updates (original). otherwise if the original repo sorts before the cache, all the updates well be download from the internet....

the result
if the original updates-released repo is still active and there are some updates on your cache they won't be downloaded from the internet, they were directly installed from your nfs-share...

Code:
[root@fc5 ~]# yum update
Loading "installonlyn" plugin
Setting up Update Process
Setting up repositories
cache-updates                                                        [1/4]
cache-updates             100% |=========================|  951 B    00:00
core                                                                 [2/4]
core                      100% |=========================| 1.1 kB    00:00
updates                                                              [3/4]
updates                   100% |=========================|  951 B    00:00
extras                                                               [4/4]
extras                    100% |=========================| 1.1 kB    00:00
...
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 kernel                  i686       2.6.16-1.2096_FC5  cache-updates      13 M
Updating:
 beagle                  i386       0.2.5-1.fc5.1    cache-updates     1.3 M
 gnome-pilot             i386       2.0.13-7.fc5.6   cache-updates     538 k
 gnome-user-share        i386       0.9-4            cache-updates      37 k
 libbeagle               i386       0.2.5-1.fc5.1    cache-updates      35 k
 procps                  i386       3.2.6-3.3        cache-updates     206 k
 tzdata                  noarch     2006d-1.fc5      cache-updates     488 k
Removing:
 kernel                  i686       2.6.15-1.2054_FC5  installed          34 M

Transaction Summary
=============================================================================
Install      3 Package(s)
Update       7 Package(s)
Remove       1 Package(s)
Total download size: 16 M
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
...
and as you can see the 'downloading ...' part is not seen the packages were installed directly...
__________________
some tips and small doc's of fedora core linux setup [german] http://www.liro.ch

Last edited by liro; 20th May 2006 at 10:30 AM.
Reply With Quote
  #2  
Old 29th May 2006, 09:35 PM
SlowJet Offline
Registered User
 
Join Date: Jan 2005
Posts: 5,002
is there a link or will there be a link to the new repo setup?
The differences for FC5.
And the post FC6T1 repos.

Wil we need 2 format for FC5 and 6?
Is FC5 diffent from FC4?

etc

SJ
__________________
Do the Math
Reply With Quote
  #3  
Old 30th May 2006, 01:12 PM
liro's Avatar
liro Offline
Registered User
 
Join Date: Oct 2005
Location: Switzerland
Age: 30
Posts: 233
there are almost no differences between FC4 and FC5, just use the right mirror (one with FC5 updates for FC5, FC4 updates for FC4)....
then it goes like its described...

what did you mean with 'will we need 2 format for FC5 and FC6' ?

liro
__________________
some tips and small doc's of fedora core linux setup [german] http://www.liro.ch
Reply With Quote
Reply

Tags
cache, mirror, repository, setup, yum

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mirror URL for repository. Onmeac Servers & Networking 1 30th January 2009 04:17 PM
yum mirror in thailand? or repository on wl-500? snarfer Using Fedora 6 16th February 2008 01:22 AM
Choosing repository update mirror for yum dndfan Using Fedora 6 19th November 2005 08:57 PM


Current GMT-time: 13:10 (Saturday, 18-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat