Facebook Twitter Gplus RSS
 
 
Home » Fedora » Creating a Local Fedora 11 Yum Repository
formats

Creating a Local Fedora 11 Yum Repository

Published on June 18th, 2009

yumfedoraWe all know the importance of creating a local YUM repository on your LAN. Not only do you decrease the time it takes to download and install updates, you also decrease bandwidth usage.

This How To will show you a simple yet effective way of setting up your local Fedora YUM server and client.

TIP: Distribute your Fedora YUM configuration via your Puppet Master

Preliminary Note:

I’m using two Fedora 11 installations in this tutorial with server1.example.co.za configured with Apache httpd

* server1.example.co.za (IP 10.0.0.100): Fedora YUM Repo and httpd server
* server2.example.co.za (IP 10.0.0.102): Fedora YUM client

Configure Fedora YUM repo and httpd server as follows:

Create the following Directories:

# mkdir -p /var/www/html/fedora/11/os/i386
# mkdir -p /var/www/html/fedora/11/os/x86_64

Create a bash script that will rsync your local YUM Repo server with your local YUM mirror (Make sure the mirror supports rsync).

Fedora Mirror list – http://mirrors.fedoraproject.org/publiclist

# vi fedora-repo-update.sh

#!/bin/sh

rsync="rsync -avrt --bwlimit=256"

mirror=mirror.facebook.com::fedora-enchilada/linux

verlist="11"
archlist="i386 x86_64"
baselist="os"
local=/var/www/html/fedora/

for ver in $verlist
do
 for arch in $archlist
 do
  for base in $baselist
  do
    remote=$mirror/releases/$ver/Fedora/$arch/$base/
    $rsync $remote $local/$ver/$base/$arch/
  done
 done
done

# chmod 755 fedora-repo-update.sh

Add the bash script to your crontab to update your local repository every night (01H00 in this case)

# crontab -e

#       minute (0-59),
#       |       hour (0-23),
#       |       |       day of the month (1-31),
#       |       |       |       month of the year (1-12),
#       |       |       |       |       day of the week (0-6 with 0=Sunday).
#       |       |       |       |       |       commands
# -----------[ cron jobs  ]------------ #

# Update Local YUM repo update from fedora.mirror.facebook.net
	 0 	  1 	  * 	  * 	  * 	   /path/to/fedora-repo-update.sh

Configure Fedora YUM client servers as follows:

Rename all existing yum repositories from *.repo to *.old

# vi /etc/yum.repos.d/localFedora.repo

[base]
name=Fedora $releasever – $basearch
failovermethod=priority
baseurl=http://server1.example.co.za/fedora/$releasever/$basearch/os/
enabled=1
gpgcheck=0

Test your setup by running a yum update on your client machine.

# yum update

Loading “fastestmirror” plugin
Loading mirror speeds from cached hostfile
* update: server1.example.co.za
* base: server1.example.co.za

 
  • http://www.gotaclick.com Cape Town SEO

    Thanks for the info, nice and simple easy to follow steps. I like the new blog theme too by the way, looking good :)

  • Craig

    Awesome, will give it a try :) thanks

  • http://www.heatwaves.co.za Under Floor Heating

    I recently updated my PC to Fedora 11 – Ditto about the blog, looks awesome!

  • Senate1610

    Thanks, saved a killing on bandwidth..!

© [How2CentOS]
credit