Difference between revisions of "Yum local repository"

From SME Server
Jump to navigationJump to search
(Added)
 
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=== About ===
+
== About ==
 
If you have several SME installations to update you can save time and bandwidth by using a local repository.
 
If you have several SME installations to update you can save time and bandwidth by using a local repository.
  
  
=== Installation ===
+
== Installation ==
From the server-manager create an [[http://wiki.contribs.org/SME_Server:Documentation:Administration_Manual:Chapter14 | ibay]] with the following properties:
+
From the server-manager create an [[SME_Server:Documentation:Administration_Manual:Chapter14 | ibay]] with the following properties:
 
* name: repos
 
* name: repos
 
* group: Admin
 
* group: Admin
Line 25: Line 25:
 
Add the following rsync job to the newly created template fragment. All directories we do not want to sync are disabled with the <tt>--exclude</tt> parameter except for the 'smeupdates' directory which we want to replicate:
 
Add the following rsync job to the newly created template fragment. All directories we do not want to sync are disabled with the <tt>--exclude</tt> 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)
 
   # 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/' ibiblio.org::Linux/distributions/smeserver /home/e-smith/files/ibays/repos/html/ > /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:
 
To activate the new fragment:
Line 31: Line 31:
  
 
{{Tip box|If you would want to see what directories are offered by ibiblio.org you can run the following command:
 
{{Tip box|If you would want to see what directories are offered by ibiblio.org you can run the following command:
   rsync ibiblio.org::Linux/distributions/smeserver/}}
+
   rsync distro.ibiblio.org::smeserver/}}
  
  
=== Client configuration ===
+
== Client configuration ==
 
In the 'client' servers who will download their updates from this local repository we will disable the standard smeupdates repo:
 
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
 
   /sbin/e-smith/db yum_repositories setprop smeupdates status disabled
  
And we will ad our own local repository. '''Replace the''' <tt><yourServersIP or FQDN></tt> '''part with the IP-address or the Fully Qualified Domain Name from the repo-server you created above''':
+
And we will ad our own local repository. Replace the '''<tt><yourServersIP or FQDN></tt>''' part with the IP-address or the Fully Qualified Domain Name from the repo-server you created above and '''<tt><SME RELEASE></tt>''' with the version of SME (eg.: 8, 9, ...):
 
   /sbin/e-smith/db yum_repositories set smeupdates-local repository \
 
   /sbin/e-smith/db yum_repositories set smeupdates-local repository \
 
   Name 'SME Server - updates (local)' \
 
   Name 'SME Server - updates (local)' \
   BaseURL 'http://<yourServersIP or FQDN>/repos/smeserver/releases/7/smeupdates/$basearch' \
+
   BaseURL '<nowiki>http://</nowiki><u><yourServersIP or FQDN></u>/repos/smeserver/releases/<u><SME RELEASE></u>/smeupdates/$basearch' \
 
   EnableGroups yes \
 
   EnableGroups yes \
 
   GPGCheck yes \
 
   GPGCheck yes \
Line 53: Line 53:
 
   yum clean all
 
   yum clean all
  
 
+
== Uninstall ==
=== Uninstall ===
 
 
To completely remove this installation we need to do things on the server and all the previously configured clients.
 
To completely remove this installation we need to do things on the server and all the previously configured clients.
  
==== server ====
+
=== server ===
 
Remove the cronjob template fragment and activate this change:
 
Remove the cronjob template fragment and activate this change:
 
   rm /etc/e-smith/templates/etc/crontab/91_rsync_repos
 
   rm /etc/e-smith/templates/etc/crontab/91_rsync_repos
Line 64: Line 63:
 
The 'repos' ibay and all of it's containing files can be completely removed from the server-manager.
 
The 'repos' ibay and all of it's containing files can be completely removed from the server-manager.
  
==== clients ====
+
=== clients ===
 
Te re-enable the default smeupdates repository and delete our local repository, run:
 
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 setprop smeupdates status enabled
Line 76: Line 75:
  
  
 +
== Notes ==
 +
You might want to exclude this ibay from your backup to save space: [[Backup_with_dar#Adding.2FExcluding_Directories_and_Files_from_the_backup_list | Adding & Excluding Directories and Files from the backup list]]
 +
 +
----
 
[[Category: Howto]]
 
[[Category: Howto]]
 +
[[Category: Administration]]

Latest revision as of 15:58, 12 July 2013

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 and <SME RELEASE> with the version of SME (eg.: 8, 9, ...):

 /sbin/e-smith/db yum_repositories set smeupdates-local repository \
 Name 'SME Server - updates (local)' \
 BaseURL 'http://<yourServersIP or FQDN>/repos/smeserver/releases/<SME RELEASE>/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