Yum local repository

From SME Server
Revision as of 22:19, 7 February 2011 by Slords (talk | contribs) (Update rsync source)
Jump to navigationJump to search

About

If you have several SME installations to update you can save time and bandwidth by using a local repository.


Installation

From the server-manager create an ibay with the following properties:

  • name: repos
  • group: Admin
  • user access: write=admin,read=group
  • public access: Local network (no pass)
  • Execution of dynamic content: disabled


To enable the following of symlinks for this ibay run the following from the console's commandline:

 db accounts setprop repos FollowSymLinks enabled
 signal-event ibay-modify repos

And to give us a nice directory index if we browse to this ibay lets remove the default index file:

 cd /home/e-smith/files/ibays/repos/html
 rm index.html

Now lets create a template fragment for our crontab job to sync the needed repositories to our server:

 vim /etc/e-smith/templates/etc/crontab/91_rsync_repos

Add the following rsync job to the newly created template fragment. All directories we do not want to sync are disabled with the --exclude parameter except for the 'smeupdates' directory which we want to replicate:

 # Rsync SME-Server updates to local repository at 21 minutes after the hour, every two hours. Standard output is deleted (> /dev/null)
 21 */2  * * *  root /usr/bin/rsync -aHhimOSz --partial --timeout 300 --delay-updates --delete-after --delete --max-delete 1000 --exclude 'contribs/' --exclude 'mirrorlist/' --exclude 'obsolete/' --exclude 'testing/' --exclude 'iso/' --exclude 'smeaddons/' --exclude 'smecontribs/' --exclude 'smedev/' --exclude 'smeextras/' --exclude 'smeos/' --exclude 'smetest/' --exclude 'smeupdates-testing/' --exclude 'SRPMS/' distro.ibiblio.org::smeserver /home/e-smith/files/ibays/repos/html/ > /dev/null

To activate the new fragment:

 expand-template /etc/crontab


Information.png Tip:
If you would want to see what directories are offered by ibiblio.org you can run the following command:
 rsync distro.ibiblio.org::smeserver/



Client configuration

In the 'client' servers who will download their updates from this local repository we will disable the standard smeupdates repo:

 /sbin/e-smith/db yum_repositories setprop smeupdates status disabled

And we will ad our own local repository. Replace the <yourServersIP or FQDN> part with the IP-address or the Fully Qualified Domain Name from the repo-server you created above:

 /sbin/e-smith/db yum_repositories set smeupdates-local repository \
 Name 'SME Server - updates (local)' \
 BaseURL 'http://<yourServersIP or FQDN>/repos/smeserver/releases/7/smeupdates/$basearch' \
 EnableGroups yes \
 GPGCheck yes \
 Visible yes \
 status enabled

To enable these changes:

 signal-event yum-modify

Just to be sure, give yum a fresh start:

 yum clean all


Uninstall

To completely remove this installation we need to do things on the server and all the previously configured clients.

server

Remove the cronjob template fragment and activate this change:

 rm /etc/e-smith/templates/etc/crontab/91_rsync_repos
 expand-template /etc/crontab

The 'repos' ibay and all of it's containing files can be completely removed from the server-manager.

clients

Te re-enable the default smeupdates repository and delete our local repository, run:

 /sbin/e-smith/db yum_repositories setprop smeupdates status enabled
 /sbin/e-smith/db yum_repositories delete smeupdates-local

To enable these changes:

 signal-event yum-modify

Again to be sure, give yum a fresh start:

 yum clean all


Notes

You might want to exclude this ibay from your backup to save space: Adding & Excluding Directories and Files from the backup list