HDA as Local Repo Server

From Amahi Wiki
Revision as of 18:40, 3 November 2010 by Rgmhtt (talk | contribs)
Jump to: navigation, search

Make your HDA a Local Fedora and RPMFusion Free/NonFree Updates Repo

If you have multiple machines to update in your network, this may be ideal for you. It will allow you to use your HDA as a local Fedora/RPMFusion Updates repository (hereafter referred to as repo). This was developed on Fedora 12 platform.

Once the initial setup is complete, all repos will be updated nightly with any changes automatically. Then whenever you do an update to your HDA or Fedora clients, packages will be pulled from your HDA versus a Fedora mirror over the internet. I have built scripts to do all the steps below and will post them here soon.


NOTE: Requires a large amount of free disk space. For example, if you want to maintain 32-bit packages local, it may take up to 30GB of drive space for Fedora, RPMFusion Free and NonFree repos.

Initial Repo Setup

This setup only needs to be done once. This will set up structure for all repos built for your HDA.

  • Create a web app called repo using the Amahi Dashboard (Applications-->Web App)
  • Open a terminal window and become root user:
su -
  • If you want the URL http://repo available immediately, restart hdacl:
service hdactl restart
  • Generate index.html (OPTIONAL) to allow repo packages to be viewed via web browser):
cd /var/hda/web-apps/repo/html
vi index.html

and add the following:

<html>
<A HREF="f12">f12</A>
</html>
  • Make directory to hold all repo files, then create symbolic link to the directory:
mkdir -p /var/hda/files/yum/f12
cd /var/hda/web-apps/repo/html
ln -s /var/hda/files/yum/f12
  • If you locate the files in a different tree, you will need the appropriate permissions. Change to a point in the tree and use:
find . -type d | xargs chmod 755
    • This is especially important if you build the tree by extracting from a .iso file.
  • Disable current Fedora/RPMFusion Update repos for your HDA, then invoke local repo (Skip last 2 lines if RPMFusion repos NOT installed):
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/fedora-updates.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/rpmfusion-free-updates.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/rpmfusion-nonfree-updates.repo


Fedora Updates Repo Configuration

For this example, we will be doing Fedora Updates for 32-bit. It can be adapted for 64-bit by changing all occurrences of i386 to x86_64. You may want to use one of the rsync mirrors listed [here]. If so, replace all occurrences of rsync://mirrors.kernel.org with the new mirror.

  • Make directory to hold all Fedora i386 Updates:
mkdir -p /var/hda/files/yum/f12/i386/updates
  • Download Fedora i386 Updates from repo mirror (may take a while):
rsync -avrt --delete rsync://mirrors.kernel.org/fedora/updates/12/i386/ --exclude=debug /var/hda/files/yum/f12/i386/updates
  • Build local repo structure index:
yum -y install createrepo
createrepo /var/hda/files/yum/f12/i386/updates
  • Generate fedora-updates-i386.repo (point to your HDA local repository):
vi /etc/yum.repos.d/fedora-updates-i386.repo

and add the following:

[fedora-updates-i386-local]
name=Fedora f12 - i386 - Updates
failovermethod=priority
baseurl=http://repo/f12/i386/updates
enabled=1
gpgcheck=0
  • Schedule nightly task to synchronize (downloads new updates) Fedora mirror with HDA repo. This will only download new udpates to your HDA, so it shouldn't take long. Recommend you stagger scheduled time for each repo added by 1 hour.:
crontab -e

and add the following line:

0 1 * * *    rsync -avrt rsync://mirrors.kernel.org/fedora/updates/12/i386/ --exclude=debug
  • Refresh repo list.
yum clean all
  • All Fedora i386 Updates will now be retrieved locally from your HDA.


RPMFusion Updates Repo Configuration

NOTE: Amahi RPM Fusion Free and/or NonFree app MUST BE installed.

For this example, we will be doing RPMFusion Free updates for 32-bit. It can be adapted for NonFree by changing all occurrences of free to nonfree and/or to 64-bit by changing all occurrences of i386 to x86_64.

  • Make directory to hold all RPMFusion Free i386 Updates:
mkdir -p /var/hda/files/yum/f12/i386/rpmfusion/free/updates
  • Download RPMFusion Free Updates from repo mirror (may take a while):
rsync -avrt --delete rsync://download1.rpmfusion.org/rpmfusion/free/fedora/updates/12/i386/ --exclude=debug /var/hda/files/yum/f12/i386/rpmfusion/free/updates
  • Build local repo structure index:
createrepo /var/hda/files/yum/f12/i386/rpmfusion/free/updates
  • Generate fedora-rpmfusion-free-updates-i386 (point to your HDA local repository):
vi /etc/yum.repos.d/fedora-rpmfusion-free-updates-i386.repo

and add the following:

[fedora-rpmfusion-updates-i386-local]
name=Fedora 12 - RPMFusion - free - i386 - Updates
failovermethod=priority
baseurl=http://repo/f12/i386/rpmfusion/free/updates
enabled=1
gpgcheck=0
  • Schedule nightly task to synchronize (downloads new updates) RPMFusion mirror with HDA repo. This will only download new udpates to your HDA, so it shouldn't take long. Recommend you stagger scheduled time for each repo added by 1 hour.:
crontab -e

and add the following line:

0 3 * * *    rsync -avrt rsync://download1.rpmfusion.org/rpmfusion/free/fedora/updates/12/i386/ --exclude=debug /var/hda/files/yum/f12/i386/rpmfusion/free/updates
  • Refresh repo list.
yum clean all
  • All RPMFusion Free i386 Updates will now be retrieved locally from your HDA.


Client Repo Setup

This will need to be completed on each Fedora 12 Client in your network.

  • Disable current Fedora/RPMFusion Update repos for client, then invoke local repos (Skip last 2 lines if RPMFusion repos NOT installed):
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/fedora-updates.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/rpmfusion-free-updates.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/rpmfusion-nonfree-updates.repo
yum clean all