CCL Home Page
Up Directory CCL Updating RedHat with apt
apt for RH9

Using apt + rpm package to perform automatic updates of RH9 Linux

"apt" is a package to update linux automatically. "apt" is a Debian tool, but
it was also adaped to run with RedHat RPM files. 

0) read first: 
   http://bazar.conectiva.com.br/~godoy/apt-howto/index.html
   which is a HOWTO for apt and RedHat RPMs. (local copy is 
   here.
   

1) got binary RPMs of apt for RedHat 9 from the TuxFamily.org site
   (http://apt-rpm.tuxfamily.org/scripts/apt-rpm.html), namely:
   ftp://apt-rpm.tuxfamily.org/apt/redhat/9/en/i386/RPMS.extra/. Local copy is here.
   At the time of this writing they were:

  apt-0.5.5cnc5-fr2.i386.rpm                852 Kb    Wed Apr 16 10:11:00 2003 
  apt-devel-0.5.5cnc5-fr2.i386.rpm          515 Kb    Wed Apr 16 10:13:00 2003 

  and saved them under /root/apt directory

2) I Installed apt on the system:
     cd /root/apt
     rpm -Uhv *.rpm

3) It comes with the config file which tells it where to find updates.
   I looked at /etc/apt/sources.list and considered adding there:
    rpm http://mirror.usu.edu/mirrors/apt redhat/9/en/i386 os updates extra
    rpm-src http://mirror.usu.edu/mirrors/apt redhat/9/en/i386 os updates extra
   as the pointer to the update site. But ended up commenting these lines out
   and keepintg the pointer to the original site given in the file, i.e.,: 
     # Red Hat Linux 9
     rpm http://ayo.freshrpms.net redhat/9/i386 os updates freshrpms
     rpm-src http://ayo.freshrpms.net redhat/9/i386 os updates freshrpms
   since it up-to-date. Whatever you do keep only one site uncommented.
   The original site for updates, which was suggested in the docs
   (http://apt-rpm.tuxfamily.org/scripts/apt-rpm.html): 
     rpm ftp://apt-rpm.tuxfamily.org/apt redhat/9/en/i386 os updates extra
     rpm-src ftp://apt-rpm.tuxfamily.org/apt redhat/9/en/i386 os updates extra
   is unfortunately quite stale.

4) Then I ran the apt-get tool.     
   In this case, I started with the original RH9 distribution and it was 
   Aug. 22, 2003 and the processor was Pentium III. 
      apt-get update  (run twice -- they say it is safer to run it twice...)
      apt-get check
      apt-get upgrade       (it takes a while)

   The "apt-get" will not upgrade kernel. This you need to do yourself
   manually (later in this writeup).

   The small problem is that the "apt" will upgrade all packages as if they 
   were for the i386 architecture. While 99% of packages are compiled for the
   i386 (since they would not benefit in any substantial way from the extended
   instruction set), some packages are specifically compiled for Pentium or
   Athlon for efficiency. Of course, you most likely have Pentium or Athlon,
   and you need to install these few CPU architecture specific RPMs by hand.
   They will work much more efficient and use the extended instruction set of
   the newer processors compared to the ancient 80386 which did not even have
   the floating point operations integrated within CPU (Remember? you had to
   use the "math coprocessor").  To find out what processor you have, do:
     cat /proc/cpuinfo | grep model
   If it says
     model name	: AMD Athlon(tm) Processor
   you have "athlon" CPU. If it tells you something like:
     model name	: Pentium 75 - 200
   you have an i586 CPU. And ft it tells you 
     model name	: Pentium II
   or
     model name	: Pentium III
   or
     model name	: Pentium IV
   you have the i686 cpu. If you get something else, you probably do not
   have the Pentium compatible CPU. In this case, list all of /proc/cpuinfo
    cat /proc/cpuinfo | more  and see what you have.
   Once you find the type of the CPU architecture, you need to get
   specific RPM packages for this architecture and install them manually.
   Note that the automatic update WILL install the latest i386 version
   of each package. The packages for newer architectures need to be 
   installed in such a way that they "overwrite" the current i386 versions.
   
   To get a list of sites which carry updates for Red Hat linux go to:
     http://www.redhat.com/mirrors.html and get a site
   nearby for speed. Also check if it really carries the latest RPMs by
   checking a few site and dates on files. Some site are quite slow in
   keeping their updates fresh. I personally use the
      ftp://linux.nssl.noaa.gov/pub/linux/redhat/linux/updates/
   but your best site should be close to you. In my case, beside the
   kernel, I found the following packages which need to be updated:
     glibc-2.3.2-27.9.i686.rpm        4763 Kb    Wed Apr  9 16:13:00 2003 
     nptl-devel-2.3.2-27.9.i686.rpm    809 Kb    Wed Apr  9 16:14:00 2003 
     openssl-0.9.7a-5.i686.rpm        1095 Kb    Sat Mar 29 01:30:00 2003 
   I uploaded the to /tmp directory
   cd /tmp
   wget ftp://linux.nssl.noaa.gov/pub/linux/redhat/linux/updates/9/en/os/i686/glibc-2.3.2-27.9.i686.rpm
   wget ftp://linux.nssl.noaa.gov/pub/linux/redhat/linux/updates/9/en/os/i686/nptl-devel-2.3.2-27.9.i686.rpm
   wget ftp://linux.nssl.noaa.gov/pub/linux/redhat/linux/updates/9/en/os/i686/openssl-0.9.7a-5.i686.rpm

 and then did:
   cd /tmp
   rpm --force -Uhv glibc-2.3.2-27.9.i686.rpm
   rpm --force -Uhv nptl-devel-2.3.2-27.9.i686.rpm
   rpm --force -Uhv openssl-0.9.7a-5.i686.rpm

 and rebooted the machine just in case. 

5) As mentioned before, the ftp://apt-rpm.tuxfamily.org update repository is
   quite dated, and you should not put it in /etc/apt/sources.list.
   Beside the ones listed by default in /etc/apt/sources.list there
   are also other, quite up-to-date, repositories:
    rpm http://mirror.usu.edu/mirrors/apt redhat/9/en/i386 os updates extra
    rpm-src http://mirror.usu.edu/mirrors/apt redhat/9/en/i386 os updates extra
   or at http://ftp.silug.org/pub/apt/redhat/9/en/, namely:
    rpm http://ftp.silug.org/pub/apt redhat/9/en/i386 os updates extra
    rpm-src http://ftp.silug.org/pub/ap redhat/9/en/i386 os updates extra

6) Updating kernel.
   The apt thing does not update kernel, and for a good reason. This
   requires manual operations and  reconfiguration of the boot loader.
   Read the chapter 30 of the " Red Hat Linux Customization Guide"
   (e.g., at:
    http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/custom-guide/).
    In my case, I did the following:
      a) checked what kernel is actually installed and which pieces are there:
         rpm -qa | grep kernel
         In my case, the kernel related packages were:
            kernel-pcmcia-cs-3.1.31-13
            kernel-source-2.4.20-8
            kernel-utils-2.4-8.29
            kernel-doc-2.4.20-8
            kernel-2.4.20-8
         (note that I even had the kernel-pcmcia package installed, though I do
         not need it, since it is not a laptop computer. It was installed since
         I chose Custom/Everything during installation. Once installed I need
         to upgrade it or delete it -- I decided to upgrade). 
         
      b) Get the latest kernel packages from Red Hat update sites as described
         above. Get only the packages which are already installed, There
         are many specialty kernels (like big memory support or SMP support)
         and if you do not see them installed on your system, do not take
         the upgrades for those. 
         Note that most of the kernel related packages are in the i386
         directory. Only the kernel itself is in the corresponding advanced
         CPU architecture directory (in my case, the i686). 
         Get them to some convenient directory. In my case I had put them 
         to /tmp/kernel directory:
         mkdir /tmp/kernel 
         cd /tmp/kernel
wget ftp://linux.nssl.noaa.gov/pub/linux/redhat/linux/updates/9/en/os/i686/kernel-2.4.20-20.9.i686.rpm 

wget ftp://linux.nssl.noaa.gov/pub/linux/redhat/linux/updates/9/en/os/i386/kernel-source-2.4.20-20.9.i386.rpm 

wget ftp://linux.nssl.noaa.gov/pub/linux/redhat/linux/updates/9/en/os/i386/kernel-doc-2.4.20-20.9.i386.rpm 

         Note that not all kernel components which are installed on your
         system are being upgraded. Some of them are current, and do not
         have any upgrades available.

      c) before you install the new packages you should make the emergency
         boot disk which points to your old kernel (in our case:
         2.4.20-8 as rpm -qa tells us) in case something does not work out:
           /sbin/mkbootdisk 2.4.20-8

      d) Then you need to upgrade the kernel. Note, you WANT to keep old
         kernel arround (just in case -- e.g., driver incompatibilities, etc.).
         You do not want to keep documentation and sources for the old kernel.
         To keep the old package use -i option to rpm. To update (i.e.,
         remove the old package) use -U.
         AGAIN!!! You want to KEEP old kernel (and kernel-pcmcia-cs package,
         and smp or bigmem, if they are installed on your system), but you 
         want to update source, docs, and utilities. With the pcmcia kernel
         you may have problems due to dependencies. In this case use the
         --force option ( rpm -ivh --force kernel-pcmcia-cs-n.n.nn-n.i386.rpm ). 
         So, in my case the upgrade was looking like:
  cd /tmp
  rpm -ihv kernel-2.4.20-20.9.i686.rpm
  rpm -Uhv kernel-source-2.4.20-20.9.i386.rpm kernel-doc-2.4.20-20.9.i386.rpm

         Make sure that the initial Ram disk was created from RPM by listing
         your /boot directory. In my case: 
             ls -l /boot/initrd-2.4.20-20.9.img

      e) Now you need to update the boot loader configureation. For GRUB
         you need to check a file: /boot/grub/grub.conf  which
         It should have beed updated automatically and should look like
         (in my case): 

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/hda2
#          initrd /initrd-version.img
#boot=/dev/hda
default=1
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Linux (2.4.20-20.9)
        root (hd0,0)
        kernel /vmlinuz-2.4.20-20.9 ro root=LABEL=/
        initrd /initrd-2.4.20-20.9.img
title Red Hat Linux (2.4.20-8)
        root (hd0,0)
        kernel /vmlinuz-2.4.20-8 ro root=LABEL=/
        initrd /initrd-2.4.20-8.img


         If you use LILO (I do...) you need to edit/check file /etc/lilo.conf 
         This file was most likely patched for you by the RPM installation
         process and should have your new kernel there as:

prompt
timeout=50
default=linux
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
message=/boot/message
lba32

image=/boot/vmlinuz-2.4.20-20.9
        label=2.4.20-20.9
        initrd=/boot/initrd-2.4.20-20.9.img
        read-only
        append="root=LABEL=/"
image=/boot/vmlinuz-2.4.20-8
        label=linux
        initrd=/boot/initrd-2.4.20-8.img
        read-only
        append="root=LABEL=/"


         Note, however, that your default kernel still points at the old kernel
         (default label is linux). Change it to default=2.4.20-20.9 or
         you can actually rename the new kernel as linux and change the
         lilo.conf as:

prompt
timeout=50
default=linux
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
message=/boot/message
lba32

image=/boot/vmlinuz-2.4.20-20.9
        label=linux
        initrd=/boot/initrd-2.4.20-20.9.img
        read-only
        append="root=LABEL=/"
image=/boot/vmlinuz-2.4.20-8
        label=2.4.20-8
        initrd=/boot/initrd-2.4.20-8.img
        read-only
        append="root=LABEL=/"

         You need to run lilo -v to make these changes written to
         the boot sector on the hard drive:
            /sbin/lilo -v
     
      f) You are also well advised to do ANOTHER boot diskette with the new
         kernel. In our case:
            /sbin/mkbootdisk 2.4.20-20.9
          
         
Now, `REMOVE the diskette, and reboot the machine... (CTRL/ALT/DEL or
/sbin/shutdown -r now) and you should be in business with updated
installation.

Written in Aug, 2003 by Jan K. Labanowski: jkl@ccl.net
All rights released... If it does not work for you, do not blame me...



  
Modified: Tue Sep 16 16:00:30 2003 GMT
Page accessed 1117 times since Mon Mar 14 21:12:03 2005 GMT