[WBEL-users] Setting up a local WBEL mirror and update area - howto

Will Senn will_senn@comcast.net
Sat, 20 Mar 2004 21:15:27 -0600


All,

Nobody asked me for this, but considering the amount of work it was, 
perhaps someone will appreciate a recipe. Please feel free to correct 
anything that isn't accurate or suggest improvements.

Thanks,

Will
----------------------------------
Title: WBEL-3 local update mirror HOWTO
Platform: White Box Enterprise Linux 3 - Liberation
Audience: WBEL-3 System Administrators
Purpose: Provide a single update point for client machines within a 
network that is updated from a remote mirror on a daily basis.
Author: Will Senn
Email: wdsenn at yahoo dot com
Date: March 20, 2004  20:05 CDT
Version: 1.0

This document is intended to describe one approach to setting up an 
update server within a network in order to provide a single update 
location for clients within that network to retrieve updates from. The 
update server will retrieve the updates from a WBEL mirror on a daily 
basis. I have chosen to use FTP as the medium for hosting the mirror, 
you can certainly host it via other methods such as HTTP and NFS.


Prerequisites

    White Box Enterprise Linux 3:  These instructions might work for 
other distributions, but I will not vouch for them.
    rhn-applet-2.1.7:  I updated rhn-applet before beginning on the 
advice of the whitebox-users mailing list.
    6 GB disk space:  I used 10 GB


Updating to rhn-applet-2.1.7

    1. download the updated version of the source RPM, available at:
        
http://people.redhat.com/~veillard/testing/FC1/i386/rhn-applet/2.1.7/rhn-applet-2.1.7-1.src.rpm

    2. save the file to  /usr/src/redhat/SRPMS

    3. install the sources
       #rpm -ivh /usr/src/redhat/SRPMS/rhn-applet-2.1.7-1.src.rpm

    4. unzip the source
       #cd /usr/src/redhat/SOURCES
       #tar xvzf rhn-applet-2.1.7.tar.gz

    5. find and change the occurances of redhat-release to whitebox-release
       #cd rhn-applet-2.1.7
       #grep -n -i redhat-release *
          when run will return line numbers and filenames of any files 
containing the string redhat-release
       #vi +292 rhn_applet_model.py
       #vi +156 rhn_applet_rpc.py

    6. backup or delete the downloaded SRPM, we do not need it anymore - 
we are going to create a new, fixed version
       #rm /usr/src/redhat/SRPMS/rhn-applet-2.1.7-1.src.rpm

    7. rebuild the SRPM
       #cd /usr/src/redhat/SPECS
       #rpmbuild --ba applet.spec

    8. create the optimized RPM for rhn-applet
       #cd /usr/src/redhat/SRPMS
       #rpmbuild --rebuild --target i686 rhn-applet-2.1.7-1.src.rpm

    9. remove the existing rhn-applet
       #rpm --erase rhn-applet

    10. install the new rhn-applet
       #cd /usr/src/redhat/RPMS/i686
       #rpm -ivh rhn-applet-2.1.7-1.i686.rpm

    11. exit the running applet
        If you are in X Windows, right-click on the rhn-applet icon 
(usually a Blue check-mark or Red exclamation-point to the right) and 
select Exit from the pop-up menu.

    12. start the new applet
          click the Foot => System Tools => Red Hat Network Alert Icon


Create an area for the updates and base os

    If you have 6+ GB free disk space on a mounted filesystem, you can 
skip down to step XXXX, otherwise, I am going to cover partitioning and 
creating the filesystem from free unallocated space on the hard drive.

    1. create a new partition (I used 10GB, if you want to use less - go 
for it)
       #fdisk /dev/hda

        Command (m for help): p

        Disk /dev/hda: 122.9 GB, 122942324736 bytes
        255 heads, 63 sectors/track, 14946 cylinders
        Units = cylinders of 16065 * 512 = 8225280 bytes
         
           Device Boot    Start       End    Blocks   Id  System
        /dev/hda1   *         1      2040  16386268+   c  Win95 FAT32 (LBA)
        /dev/hda2          2041     14945 103659412+   f  Win95 Ext'd (LBA)
        /dev/hda5          2041     10964  71681998+   7  HPFS/NTFS
        /dev/hda6         10965     10977    104391   83  Linux
        /dev/hda7         10978     12252  10241406   83  Linux
        /dev/hda8         12253     12383   1052226   83  Linux
        /dev/hda9         12384     12514   1052226   82  Linux swap
        /dev/hda10        12515     12579    522081   83  Linux

        Command (m for help): n
        Command action
           l   logical (5 or over)
           p   primary partition (1-4)
        l
        First cylinder (12580-14945, default 12580):
        Using default value 12580
        Last cylinder or +size or +sizeM or +sizeK (13797-14945, default
    14945): +10000M
         
        Command (m for help): p
         
        Disk /dev/hda: 122.9 GB, 122942324736 bytes
        255 heads, 63 sectors/track, 14946 cylinders
        Units = cylinders of 16065 * 512 = 8225280 bytes
         
           Device Boot    Start       End    Blocks   Id  System
        /dev/hda1   *         1      2040  16386268+   c  Win95 FAT32 (LBA)
        /dev/hda2          2041     14945 103659412+   f  Win95 Ext'd (LBA)
        /dev/hda5          2041     10964  71681998+   7  HPFS/NTFS
        /dev/hda6         10965     10977    104391   83  Linux
        /dev/hda7         10978     12252  10241406   83  Linux
        /dev/hda8         12253     12383   1052226   83  Linux
        /dev/hda9         12384     12514   1052226   82  Linux swap
        /dev/hda10        12515     12579    522081   83  Linux
        /dev/hda11        12580     13796   9775521   83  Linux
         

        Command (m for help): wq
        The partition table has been altered!
         
        Calling ioctl() to re-read partition table.
         
        WARNING: Re-reading the partition table failed with error 16:
    Device or resource busy.
        The kernel still uses the old table.
        The new table will be used at the next reboot.
        Syncing disks.


    2. reboot - required in my case because of the 'Device or resource 
busy.' warning above. If you can not reboot, then my suggestion is that 
you don't modify a partition on your main hard disk.

    3. create the mount point and ftp directory
          #mkdir /whitebox
          #mkdir /var/ftp/pub/whitebox

    4. create the filesystem for the partition we created above
          #mke2fs -j -L "/whitebox" /dev/hda11

    5. create entries for the /whitebox mountpoint and the ftp directory 
in fstab
          #vi /etc/fstab
             LABEL=/whitebox   /whitebox   ext3   defaults   1   2
             LABEL=/whitebox   /var/ftp/pub/whitebox   ext3   defaults   
1   0

    6. mount the filesystem to the 2 mount points
         #mount -a
             or alternatively
        #mount /dev/hda11 /whitebox
        #mount /dev/hda11 /var/ftp/pub/whitebox

    7. add vsftp to the runlevel(s) and start it up
       #chkconfig --level 345 vsftpd on
       #service vsftpd start

    8. create a directory to hold the base os
       #mkdir /whitebox/os/i386

    9. for each of the original 3 cd's - mount them, copy their contents 
to the base os directory and unmount them
       #mount /mnt/cdrom
       #cp -var /mnt/cdrom/* /whitebox/os/i386
       #umount /mnt/cdrom

    10. use rsync to sync the base os and retrieve the updates
       #rsync --quite --delete --recursive 
mirror.physics.ncsu.edu::whitebox/3.0/en/os /whitebox/
       #rsync --quite --delete --recursive 
mirror.physics.ncsu.edu::whitebox/3.0/en/updates /whitebox/

    11. create a script for cron to call
       #vi /etc/cron.d/whiteboxupdates
          #!/bin/sh
          rsync --quite --delete --recursive 
mirror.physics.ncsu.edu::whitebox/3.0/en/updates /whitebox/
       #chmod a+x /etc/cron.d/whiteboxupdates

    12. edit the crontab to call the whiteboxupdates script every day at 
4:20am
       #crontab -e
          20   4   * * * /etc/cron.d/whiteboxupdates


Modify the yum.conf and up2date sources files to use the new local mirror

    1. edit the yum.conf file to point at the new mirror
       #vi /etc/yum.conf
          ... snip ...
          [base]
          name=White Box Enterprise Linux $releasever - $basearch - Base
          baseurl=ftp://localhost/pub/whitebox/os/i386

          [updates-released]
          name=White Box Enterprise Linux $releasever - $basearch - 
Released Updates
          baseurl=ftp://localhost/pub/whitebox/updates
          ... snip ...

    2. edit the up2date sources file to point to the add the yum stuff
       #vi /etc/sysconfig/rhn/sources
          ... snip ...
          yum WBEL-3.0 ftp://localhost/pub/whitebox/os/i386/
          yum updates-released ftp://localhost/pub/whitebox/updates/
          ... snip ...

Note: if you are making changes to a client machine, you will want to 
change localhost above to the actual machine with the update mirror.


Try it out

    1. run yum
       #yum update


Celebrate

    If the recipe worked, and it should - say yippee and move on to more 
challenging stuff like securing it all...

Will Senn
wdsenn at yahoo dot com