tools:apt 

Basic Info 

Usage 

apt-get update
apt-cache search mplayer
apt-get install mplayer
apt-get install mplayer-skins

Source 

Public apt repositories 

http://freshrpms.net/apt/repositories.html

A few known public apt repositories for entire Red Hat Linux releases (and eventually add-on packages) :

Many more custom packages available through apt can be found on the general links page.

redhat-8.0 Related Urls 

http://ftp.freshrpms.net/pub/updates/redhat-8.0-i386/

http://ayo.freshrpms.net/redhat/8.0/i386/RPMS.updates/ http://ayo.freshrpms.net/redhat/8.0/i386/RPMS.freshrpms/

http://ayo.freshrpms.net/redhat/8.0/i386/updates/RPMS/ http://ayo.freshrpms.net/redhat/8.0/i386/freshrpms/RPMS/

Comments 

Apt uses two places to store its retrieved info. If you want to backup, backup them both. The first is the rpm source/version list, which is at var/state/apt/lists. The second is downloaded rpms. It is at /var/cache/apt/.

Help 

Support 

Public mailing-list: freshrpms-list http://lists.freshrpms.net/mailman/listinfo/freshrpms-list

Quick Help 

apt 0.3.19cnc55 for i386 compiled on Mar 22 2002  20:35:23
 Usage: apt-get [options] command
       apt-get [options] install pkg1 [pkg2 ...]

apt-get is a simple command line interface for downloading and
installing packages. The most frequently used commands are update
and install.

Commands:
   update - Retrieve new lists of packages
   upgrade - Perform an upgrade
   install - Install new packages
   remove - Remove packages
   source - Download source archives
   dist-upgrade - Distribution upgrade, see apt-get(8)
   clean - Erase downloaded archive files
   autoclean - Erase old downloaded archive files
   check - Verify that there are no broken dependencies

Options:
  -h  This help text.
  -q  Loggable output - no progress indicator
  -qq No output except for errors
  -S  Show summary for upgrade operation and quit
  -d  Download only - do NOT install or unpack archives
  -s  No-act. Perform ordering simulation
  -y  Assume Yes to all queries and do not prompt
  -f  Attempt to continue if the integrity check fails
  -m  Attempt to continue if archives are unlocatable
  -u  Show a list of upgraded packages as well
  -b  Build the source package after fetching it
  -K  Verify signatures in individual packages and quit
  -c=? Read this configuration file
  -o=? Set an arbitary configuration option, eg -o dir::cache=/tmp

Advanced usage 

--download-only
       Download only; package files are only retrieved, not unpacked or
       installed.  Configuration Item: APT::Get::Download-Only.
--show-upgraded
       Show  upgraded  packages;  Print out a list of all packages that
       are  to  be  upgraded.   Configuration   Item:   APT::Get::Show-
       Upgraded.
--print-uris
       Instead of fetching the files to install their URIs are printed.
       Each URI will have the path, the destination file name, the size
       and the expected md5 hash. Note that the file name to  write  to
       will  not  always  match  the file name on the remote site! This
       also works with the source and update commands. When  used  with
       the  update command the MD5 and size are not included, and it is
       up to the user to decompress any compressed  files.   Configura-
       tion Item: APT::Get::Print-URIs.
--reinstall
       Re-Install packages that are already installed and at the newest
       version.  Configuration Item: APT::Get::ReInstall.

Version 0.3.19cnc55-fr7 

Installation 

Steps 

Must install the new rpm first.

rpm -Uh *
i.e.:  rpm-4.0.4-7x.i386.rpm rpm-python-4.0.4-7x.i386.rpm
       popt-1.6.4-7x.i386.rpm apt-0.3.19cnc55-fr7.i386.rpm

Usage 

Use apt-get to install packages that you don't have.

init 

apt-get update

upgrade 

% apt-get upgrade
[...]
39 packages upgraded, 0 newly installed, 0 removed and 1 not upgraded.
Need to get 23.2MB of archives. After unpacking 636kB will be used.
Do you want to continue? [Y/n]

install new 

% apt-get install gnome
Reading Package Lists... Done
Collecting File Provides... Done
Building Dependency Tree... Done
Package gnome has no available version, but exists in the database.
This typically means that the package was mentioned in a dependency and
never uploaded, has been obsoleted or is not available with the contents
of sources.list
However the following packages replace it:
  libcapplet0 gnome-utils gnome-media gnome-games control-center
E: Package gnome has no installation candidate
% apt-get install gnome-utils control-center
Reading Package Lists... Done
Collecting File Provides... Done
Building Dependency Tree... Done
The following extra packages will be installed:
  fortune-mod gnome-panel libwnck xscreensaver
The following NEW packages will be installed:
  control-center fortune-mod gnome-panel gnome-utils libwnck xscreensaver
0 packages upgraded, 6 newly installed, 0 removed and 40 not upgraded.
Need to get 8992kB of archives. After unpacking 21.5MB will be used.
Do you want to continue? [Y/n] y
Get:1 http://apt.freshrpms.net redhat/8.0/en/i386/os fortune-mod 1.0-24 [1031kB]

Fedora optional 

# Fedora Extras non-US packages (optional)
rpm http://rpm.livna.org fedora/1/i386 stable
rpm-src http://rpm.livna.org fedora/1/i386 stable
# Macromedia Flash plug-in (optional)
rpm http://sluglug.ucsc.edu/macromedia/apt fedora/1 macromedia

Grey Sector Repository 

http://ftp.icm.edu.pl/pub/linux/mplayer-rpms/apt.html

What software can I find in this repository? We have MPlayer and some other software.

How do I access this repository? Download this file and place it in /etc/apt/sources.list.d/.

http://luna.cs.ccsu.edu/dominik/apt/

Question 

How to re-download/re-install the updated rpms?

1<<, >>
% apt-get install --download-only krb5-libs openssl-devel openssl
Reading Package Lists... Done
Building Dependency Tree... Done
krb5-libs is already the newest version.
openssl-devel is already the newest version.
openssl is already the newest version.
0 packages upgraded, 0 newly installed, 0 removed and 0 not upgraded.
2<<, >>
% apt-get install --reinstall --download-only krb5-libs openssl-devel openssl
Reading Package Lists... Done
Building Dependency Tree... Done
Reinstallation of krb5-libs is not possible, it cannot be downloaded.
Reinstallation of openssl-devel is not possible, it cannot be downloaded.
Reinstallation of openssl is not possible, it cannot be downloaded.
0 packages upgraded, 0 newly installed, 0 removed and 0 not upgraded.
3<<, >>

Same result as above with the following commands:

apt-get install --simulate --reinstall --download-only krb5-libs
apt-get install --no-act --reinstall --download-only krb5-libs
apt-get install --reinstall krb5-libs

help 

--download-only
       Download only; package files are only retrieved, not unpacked or
       installed.  Configuration Item: APT::Get::Download-Only.
--show-upgraded
       Show  upgraded  packages;  Print out a list of all packages that
       are  to  be  upgraded.   Configuration   Item:   APT::Get::Show-
       Upgraded.
--print-uris
       Instead of fetching the files to install their URIs are printed.
       Each URI will have the path, the destination file name, the size
       and the expected md5 hash. Note that the file name to  write  to
       will  not  always  match  the file name on the remote site! This
       also works with the source and update commands. When  used  with
       the  update command the MD5 and size are not included, and it is
       up to the user to decompress any compressed  files.   Configura-
       tion Item: APT::Get::Print-URIs.
--reinstall
       Re-Install packages that are already installed and at the newest
       version.  Configuration Item: APT::Get::ReInstall.

Usage in ver 72 

cd /dos/drv_a1/Downloads/th72up
apt-get -o dir::cache=./i386 update
apt-get -o dir::cache=./i386 install
apt-get -o dir::cache=/dos/drv_a1/Downloads/th72up/i386 upgrade

— upgrade needs abs path

Test Run 

cd /dos/drv_a1/Downloads/th72up/i386

# apt-get -o dir::cache=/dos/drv_a1/Downloads/th72up/i386 install
Processing File Dependencies... Done
Reading Package Lists... Done
Building Dependency Tree... Done
0 packages upgraded, 0 newly installed, 0 to remove(replace) and 104 not upgraded.

cd /dos/drv_a1/Downloads/th72up

wgd-s ftp://ftp.crc.ca/pub/systems/linux/redhat/ftp.redhat.com/linux/updates/7.2/en/os/i386/[]

cd /dos/drv_a1/Downloads/th72up/i386
mkdir -p archives/partial

mv -i * archives/  # move every pre-downloaded files into archive

# apt-get -o dir::cache=/dos/drv_a1/Downloads/th72up/i386 upgrade
Processing File Dependencies... Done
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages have been kept back
  ghostscript gphoto mod_perl mozilla mozilla-mail mozilla-psm perl printconf
  printconf-gui up2date up2date-gnome
The following packages will be upgraded
  LPRng Mesa XFree86 XFree86-100dpi-fonts XFree86-75dpi-fonts
  XFree86-ISO8859-15-100dpi-fonts XFree86-ISO8859-15-75dpi-fonts XFree86-tools
  XFree86-twm XFree86-xdm XFree86-xfs Xconfigurator apache arts at authconfig bind
  bind-utils cyrus-sasl cyrus-sasl-md5 cyrus-sasl-plain docbook-utils
  docbook-utils-pdf dump e2fsprogs fetchmail foomatic glibc glibc-common groff
  groff-perl imlib initscripts iptables iptables-ipv6 jadetex libpcap libxml2
  libxslt logwatch mod_ssl modutils mpg321 mutt nfs-utils nscd nss_ldap openldap
  openldap-clients openssh openssh-askpass openssh-clients openssh-server pam php  php-imap php-ldap php-pgsql pine ppp python-xmlrpc raidtools
  redhat-config-network rhn_register rhn_register-gnome rmt rsync sane-backends
  sharutils squid stunnel sudo tetex tetex-afm tetex-dvilj tetex-dvips tetex-fonts
  tetex-latex tetex-xdvi tmpwatch ttfonts-ja tux ucd-snmp usermode util-linux
  vim-common vim-minimal vnc vnc-server webalizer wu-ftpd xsane zlib
93 packages upgraded, 0 newly installed, 0 to remove(replace) and 11 not upgraded.
Need to get 25.3MB/117MB of archives. After unpacking 16.6MB will be used.
Do you want to continue? [Y/n] y
Get:1 http://apt.freshrpms.net redhat/7.2/en/i386/updates glibc-common 2.2.4-27 [10.5MB]
Get:2 http://apt.freshrpms.net redhat/7.2/en/i386/updates glibc 2.2.4-27 [5197kB]
Get:3 http://apt.freshrpms.net[] redhat/7.2/en/i386/updates docbook ...

Trying History 

Dependency 

$ apt-get install gaim
Reading Package Lists... Done
Collecting File Provides... Done
Building Dependency Tree... Done
You might want to run `apt-get -f install' to correct these:
Sorry, but the following packages have unmet dependencies:
  gaim: PreDepends: gnome-core (>= 1.2)
  libltdl: Obsoletes: libtool-libs but 1.4.2-12 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

$ apt-get install xine
Reading Package Lists... Done
Collecting File Provides... Done
Building Dependency Tree... Done
You might want to run `apt-get -f install' to correct these:
Sorry, but the following packages have unmet dependencies:
  libltdl: Obsoletes: libtool-libs but 1.4.2-12 is to be installed
  xine: Depends: xine-libs (= 0.9.13) but it is not going to be installed
        Depends: libaa.so.1
        Depends: libxine.so.0
        Depends: libxineutils.so.0
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

tool:apt-cache 

Basic Info 

Usage 

apt-cache search 

Search the package list for a regex pattern

$ apt-cache search pango
pango - System for layout and rendering of internationalized text.
pango-devel - System for layout and rendering of internationalized text.
pygtk2 - Python bindings for the GTK+ widget set.
apt-cache show 

Show a readable record for the package

$ apt-cache show pan
Package: pan
Section: Applications/Internet
Installed Size: 2794
Maintainer: Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Version: 1:0.14.0-2
Pre-Depends: rpmlib(CompressedFileNames) (<= 3.0.4-1), rpmlib(PayloadFilesHavePrefix) (<= 4.0-1)
Depends: glib2, gtk2, libatk-1.0.so.0, libc.so.6, libc.so.6(GLIBC_2.0), libc.so.6(GLIBC_2.1), libc.so.6(GLIBC_2.1.2), libc.so.6(GLIBC_2.2), libc.so.6(GLIBC_2.3), libdl.so.2, libgdk-x11-2.0.so.0, libgdk_pixbuf-2.0.so.0, libglib-2.0.so.0, libgmodule-2.0.so.0, libgobject-2.0.so.0, libgthread-2.0.so.0, libgtk-x11-2.0.so.0, libm.so.6, libpango-1.0.so.0, libpangox-1.0.so.0, libpangoxft-1.0.so.0, libpthread.so.0, libpthread.so.0(GLIBC_2.0), libpthread.so.0(GLIBC_2.1), libxml2.so.2, libz.so.1
Provides: pan (= 1:0.13.0-2)
[...]
apt-cache whatdepends 

Show raw dependency information on a package

$ apt-cache whatdepends pango
pango-1.1.1-1
  pango-devel-1.1.1-1
    Depends: pango = 1.1.1
  libgnomeui-2.0.3-3
    Depends: pango >= 1.0.99
    Depends: <libpango-1.0.so.0>
      pango-1.1.1-1
    Depends: <libpangoft2-1.0.so.0>
      pango-1.1.1-1
    Depends: <libpangox-1.0.so.0>
      pango-1.1.1-1
    Depends: <libpangoxft-1.0.so.0>
      pango-1.1.1-1
  gtk2-2.0.6-8
    PreDepends: pango >= 1.0.99.020703-1
    Depends: <libpango-1.0.so.0>
      pango-1.1.1-1
    Depends: <libpangox-1.0.so.0>
      pango-1.1.1-1
    Depends: <libpangoxft-1.0.so.0>
      pango-1.1.1-1
  pan-1:0.14.0-2
    Depends: <libpangoxft-1.0.so.0>
[...]
apt-cache policy 

Q: How can I tell which packge comes from which repository? A: Use apt-cache policy.

$ apt-cache policy xmms
xmms:
  Installed: 1:1.2.10-2.0.1.kde
  Candidate: 1:1.2.10-2.0.1.kde
  Version Table:
 *** 1:1.2.10-2.0.1.kde 0
        996 http://kde-redhat.atrpms.net 1/stable pkglist
        996 ftp://apt.kde-redhat.org 1/stable pkglist
        100 RPM Database
     1:1.2.10-1.p 0
        996 http://ayo.freshrpms.net fedora/linux/1/i386/updates pkglist
        996 http://ftp.ussg.iu.edu fedora/1/i386/updates pkglist
     1:1.2.8-3.p 0
        996 http://ayo.freshrpms.net fedora/linux/1/i386/core pkglist
        996 http://ftp.ussg.iu.edu fedora/1/i386/os pkglist

Info 

apt-cache is a low-level tool used to manipulate APT's binary cache files, and query information from them

Help 

Quick Help 

Usage:

apt-cache [options] command
apt-cache [options] add file1 [file2 ...]
apt-cache [options] showpkg pkg1 [pkg2 ...]
apt-cache [options] showsrc pkg1 [pkg2 ...]

Commands:

add - Add a package file to the source cache
gencaches - Build both the package and source cache
showpkg - Show some general information for a single package
showsrc - Show source records
stats - Show some basic statistics
dump - Show the entire file in a terse form
dumpavail - Print an available file to stdout
unmet - Show unmet dependencies
search - Search the package list for a regex pattern
show - Show a readable record for the package
depends - Show raw dependency information for a package
whatdepends - Show raw dependency information on a package
pkgnames - List the names of all packages
dotty - Generate package graphs for GraphVis
policy - Show policy settings

Detail Help 

See the apt-cache(8) and apt.conf(5) manual pages for more information.

dotty 

dotty takes a list of packages on the command line and gernerates output suitable for use by dotty from the GraphViz < package. The result will be a set of nodes and edges representing the relationships between the packages. By default the given packages will trace out all dependent packages which can produce a very large graph. This can be turned off by setting the APT::Cache::GivenOnly option.

The resulting nodes will have several shapse:

normal packages are boxes, pure provides are triangles, mixed provides are diamonds, hexagons are missing packages. Orange boxes mean recursion was stopped [leaf packages],

blue lines are pre-depends, green lines are conflicts.

Caution, dotty cannot graph larger sets of packages.

Test Run 

apt-cache dotty gedit > /tmp/gedit.dot
dotty /tmp/gedit.dot &
apt-cache -o=APT::Cache::GivenOnly=1 dotty gedit > /tmp/gedit.dot
!dotty
apt-cache -o=APT::Cache::GivenOnly=1 dotty eog gedit gftp gqview hwbrowser magicdev control-center desktop-file-utils gnome-applets gnome-panel gnome-session gnome-spell gnome-terminal gnome-utils metacity nautilus switchdesk-gnome > /tmp/gnome.dot
dotty /tmp/gnome.dot &

Creating a Redhat Apt Repository 

http://www.webmo.net/support/apt_repository.html

Although many publically available apt repositories exist, creating one's own repository can result in better access and more control over the repository.

Overview 

The basic steps to creating a repository are first to create a mirror of the Redhat distribution and then to create an apt repository from the mirror. After the repository is created, it should be made available through a server so that clients can access it. Finally, the repository should be kept up-to-date by regularly refreshing the mirror and regenerating the apt index files. These tasks involve precisely specifying lengthy directory locations, so they are best accomplished by scripts in order to eliminate typographical errors.

Create a Redhat mirror 

There are several means to mirror a directory structure on another server, including lwp-rget, lftp, and rsynch. Some factors to consider when creating a mirror are

A script that uses lftp to create a mirror follows. It would intially be invoked as 'make-redhat-mirror full 9' and subsequently invoked as 'make-redhat-mirror quick 9'. Of course, modify the remote and local mirror locations appropriately, and use the desired redhat release, e.g., '7.3' or '8.0' in place of '9' as desired.

#!/bin/sh

# make-redhat-mirror
# create local subdirectory structure and download a mirror

# absolute directory for local redhat mirror
LOCALMIRRORDIR=/home/mirror/redhat/pub
# remote mirror location
REMOTEMIRROR=http://mirror.phy.bnl.gov[]
# remote mirror directory
REMOTEMIRRORDIR=redhat-pub

if [ $# -ne 2 -o \( "$1" != "full" -a "$1" != "all" -a "$1" != "quick" -a "$1" != "test" -a "$1" != "clean" \) ]; then
        echo "Usage: $0  "
        echo "   is one of:"
        echo "        \"full\": create mirror of os and updates"
        echo "        \"quick\": update mirror of updates"
        echo "        \"test\": output directory locations; does nothing"
        echo "   gives the Redhat version in canonical form"
        echo "        (eg: \"8.0\", \"9\")"
        exit 1
fi

MODE=$1
VERSION=$2

if [ "$MODE" = "test" ]; then
        echo "LOCAL OS DIR:"
        echo "$LOCALMIRRORDIR/redhat/linux/$VERSION/en/os/i386"
        echo "LOCAL UPDATES DIR:"
        echo "$LOCALMIRRORDIR/redhat/linux/updates/$VERSION/en/os"
        echo "REMOTE OS MIRROR SITE:"
        echo "$REMOTEMIRROR/$REMOTEMIRRORDIR/redhat/linux/$VERSION/en/os/i386"
        echo "REMOTE UPDATES MIRROR SITE:"
        echo "$REMOTEMIRROR/$REMOTEMIRRORDIR/redhat/linux/updates/$VERSION/en/os"
        exit 0
fi


# create local directory structure
if [ "$MODE" = "full" ]; then
mkdir -p $LOCALMIRRORDIR/redhat/linux/$VERSION/en/os/i386
mkdir -p $LOCALMIRRORDIR/redhat/linux/updates/$VERSION/en/os
fi

# mirror operating system
if [ "$MODE" = "full" ]; then
cd $LOCALMIRRORDIR/redhat/linux/$VERSION/en/os/i386
lftp -e "open $REMOTEMIRROR/$REMOTEMIRRORDIR/redhat/linux/$VERSION/en/os/i386 && \
mirror --delete --verbose -X *.src.rpm && \
quit"
fi

# mirror updates
cd $LOCALMIRRORDIR/redhat/linux/updates/$VERSION/en/os
lftp -e "open $REMOTEMIRROR/$REMOTEMIRRORDIR/redhat/linux/updates/$VERSION/en/os && \
mirror --delete --verbose -X *.src.rpm && \
quit"

Download and install apt rpm 

In order to create an apt repository, the apt rpm must be installed on the server in order to access the indexing programs (genbasedir, genpkglist, gensrclist). Download the version of apt appropriate for your architecture

apt-0.5.4cnc7 for Redhat 6.2
apt-0.5.5cnc6 for Redhat 7.0
apt-0.5.4cnc9 for Redhat 7.1
apt-0.3.19cnc55 for Redhat 7.2 (this is an outdated version; try downloading download 7.3 instead)
apt-0.5.5cnc5 for Redhat 7.3
apt-0.5.5cnc6 for Redhat 8.0
apt-0.5.5cnc6 for Redhat 9

and install the rpm.

Create apt repository 

The two steps to creating an apt repository are to provide the rpms in an organized directory structure and then to index the rpms.

The problem with providing the operating system and update rpms is that they are organized differently in the redhat distribution. The originally distributed operating system is distributed in a single directory with i386, i686, and noarch rpm's, whereas the updates are distributed in separate directories for different architectures. In contrast, the preferred organization for apt repositories is for both the operating system and the updates to each be organized into a single directory for each distribution. The solution is to use links, so that the operating system directory becomes the "os" apt directory, and the various redhat update rpms are combined into a single "update" apt directory. Finally, an "extras" apt directory can be created for third party rpm's.

After an appropriate apt repository structure is created, the rpm's (or more accurately, linked rpm's) must be indexed to create the apt database. First, a "base" directory is made with in the the apt repository. Then release files are written to this directory. Finally, the genbasedir tool is used to index the rpms and create the apt database.

A script to create the apt repository and index it follows. It would intially be invoked as 'make-apt full 9' and subsequently invoked as 'make-apt quick 9'. Of course, modify the local mirror and apt repository locations appropriately, and use the desired redhat release, e.g., '7.3' or '8.0' in place of '9' as desired.

#! /bin/sh

# make-apt
# Create apt databases from a redhat mirror

# Based on the following scripts and information:
# http://freshrpms.net/apt/server/[]
# ftp://apt-rpm.tuxfamily.org/pub/ftp.tuxfamily.org/apt-rpm/scripts/[]
# http://mirror.phy.bnl.gov/apt-rpm/scripts/makeapt.sh[]

# Absolute directory for top of redhat mirror
MIRRORDIR=/home/mirror/redhat/pub
# Absolute directory for top of apt repository
APTDIR=/var/www/html/apt
# URL of repository
ORIGINURL=myserver.domain.edu


# The idea of full/all/quick is:
#       * the first time you create the apt repository, choose "full".
#       * each night (when updates are downloaded), relaunch with "quick"
#       * if extra packages are put in 'extra' repository, relaunch with "quick"
#       * if the main os packages change (should not), use "all"

if [ $# -ne 2 -o \( "$1" != "full" -a "$1" != "all" -a "$1" != "quick" -a "$1" != "test" -a "$1" != "clean" \) ]; then
        echo "Usage: $0  "
        echo "   is one of:"
        echo "        \"full\": full apt repository creation and index generation"
        echo "        \"all\": no apt repository creation, but full indexing"
        echo "        \"quick\": no apt repository creation, only updates & extra indexing"
        echo "        \"test\": output directory locations; does nothing"
        echo "   gives the Redhat version in canonical form"
        echo "        (eg: \"8.0\", \"9\")"
        exit 1
fi

MODE=$1
VERSION=$2

if [ "$MODE" = "test" ]; then
        echo "APTDIR:"
        echo "$APTDIR/redhat/${VERSION}/en/i386"
        echo "OS MIRRORDIR:"
        echo "$MIRRORDIR/redhat/linux/${VERSION}/en/os/i386/RedHat/RPMS"
        echo "OS RPM:"
        find $MIRRORDIR/redhat/linux/${VERSION}/en/os/i386/RedHat/RPMS -maxdepth 1 -type f ! -name "*.src.rpm" -name "*.rpm" | head -1
        echo "UPDATES MIRRORDIR:"
        echo "$MIRRORDIR/redhat/linux/updates/${VERSION}/en/os/"
        echo "UPDATE RPM:"
        find $MIRRORDIR/redhat/linux/updates/${VERSION}/en/os/ -type f ! -name "*.src.rpm" -name "*.rpm" | head -1
        exit 0
fi

if [ "$MODE" = "clean" ]; then
# Caution: Wipes out all extra rpms's; therefore, commented out and undocumented!!!
#rm -rf $APTDIR/redhat/${VERSION}
exit 0
fi

if [ "$MODE" = "full" ]; then
# Create directory
mkdir -p $APTDIR/redhat/${VERSION}/en/i386/base
# Create the main release file
cat >$APTDIR/redhat/${VERSION}/en/i386/base/release <<EOF
 Origin: $ORIGINURL
 Label: Red Hat $VERSION
 Suite: Red Hat $VERSION
 Architectures: i386
 Components: os updates extra
Description: apt repository of Red Hat $VERSION os + updates + extra RPM's
EOF
fi

 ###########################################################################
 #### REDHAT I386 OS
 ###########################################################################

if [ "$MODE" = "full" ]; then
# Create the release file
cat >$APTDIR/redhat/${VERSION}/en/i386/base/release.os <<EOF
 Archive: stable
 Component: os
 Version: $VERSION
 Origin: $ORIGINURL
 Label: Red Hat $VERSION
 Architecture: i386
EOF
fi

if [ "$MODE" = "full" -o "$MODE" = "all" ]; then
# Remove old symlink to rpm directory
rm -f $APTDIR/redhat/${VERSION}/en/i386/RPMS.os
# Create new symlink to rpm directory
ln -s $MIRRORDIR/redhat/linux/${VERSION}/en/os/i386/RedHat/RPMS $APTDIR/redhat/${VERSION}/en/i386/RPMS.os

# Generate apt index
genbasedir --flat --bloat $APTDIR/redhat/${VERSION}/en/i386 os

# Generate yum index
#echo "yumifying $APTDIR/redhat/${VERSION}/en/i386/RPMS.os"
#rm -rf $APTDIR/redhat/${VERSION}/en/i386/RPMS.os/headers
#yum-arch -lq $APTDIR/redhat/${VERSION}/en/i386/RPMS.os
fi

 ###########################################################################
 #### REDHAT UPDATES
 ###########################################################################

if [ "$MODE" = "full" ]; then
# Create directory
mkdir -p $APTDIR/redhat/${VERSION}/en/i386/RPMS.updates
# Create release file
cat >$APTDIR/redhat/${VERSION}/en/i386/base/release.updates <<EOF
 Archive: stable
 Component: updates
 Version: $VERSION
 Origin: $ORIGINURL
 Label: Red Hat $VERSION
 Architecture: i386
EOF
fi

# Remove old symlinks to rpms
rm -f $APTDIR/redhat/${VERSION}/en/i386/RPMS.updates/*.rpm
# Create new symlinks for all updates (in multiple directories)
cd $APTDIR/redhat/${VERSION}/en/i386/RPMS.updates/
find $MIRRORDIR/redhat/linux/updates/${VERSION}/en/os/ -type f ! -name "*.src.rpm" -name "*.rpm" -exec ln -sf {} \;

# Regenerate apt index
genbasedir --flat --bloat $APTDIR/redhat/${VERSION}/en/i386 updates

# Regenerate yum headers
#echo "yumifying $APTDIR/redhat/${VERSION}/en/i386/RPMS.updates"
#rm -rf $APTDIR/redhat/${VERSION}/en/i386/RPMS.updates/headers
#yum-arch -lq $APTDIR/redhat/${VERSION}/en/i386/RPMS.updates

 ###########################################################################
 #### REDHAT EXTRA PACKAGES
 ###########################################################################

if [ "$MODE" = "full" ]; then

# Create directory
mkdir -p $APTDIR/redhat/${VERSION}/en/i386/RPMS.extra
# Create release file
cat >$APTDIR/redhat/${VERSION}/en/i386/base/release.extra <<EOF
 Archive: stable
 Component: extra
 Version: $VERSION
 Origin: $ORIGINURL
 Label: Red Hat $VERSION
 Architecture: i386
EOF
fi

# Regenerate apt index
genbasedir --flat --bloat $APTDIR/redhat/${VERSION}/en/i386 extra

# Regenerate yum headers
#echo "yumifying $APTDIR/redhat/${VERSION}/en/i386/RPMS.extra"
#rm -rf $APTDIR/redhat/${VERSION}/en/i386/RPMS.extra/headers
#yum-arch -lq $APTDIR/redhat/${VERSION}/en/i386/RPMS.extra

###########################################################################
########### REMAKE HASH
###########################################################################

genbasedir --hashonly $APTDIR/redhat/${VERSION}/en/i386 os updates extra

Serve up apt repository 

Once the repository is constructed, it must be made available by http, ftp, or rsync. If the repository is made in the root document tree of your web server, e.g., /var/www/html/apt, the following entry should be added to /etc/httpd/conf/httpd.conf:

<Directory /var/www/html/apt>
Options +Indexes
</Directory>

in order to allow the directories to be listed. Reload the httpd configuration file with

# /sbin/service httpd reload

The apt repsotiory can now be accessed at http://myserver.domain.edu/apt

Update apt repository 

The apt repository should be regularly updated via a daily or weekly cron job. The two commands that must be executed are 'make-redhat-mirror quick 9' and 'make-apt quick 9', the desired redhat release, e.g., '7.3' or '8.0' in place of '9' as desired. This pair of commands needs to executed for each Redhat version being maintained in the repository.

Add to apt repository 

The os directory contains the original redhat distribution rpms, and the updates directory contains Redhat update rpms. The extras directory is intended for one to place additional rpms.

Instruct clients to use repository 

Clients can use the repository by placing the following entry into their /etc/apt/sources.list file

rpm http://myserver.domain.edu/apt redhat/9/en/i386 os updates extra

The version number "9" should be replaced with "7.3", "8.0", etc. as appropriate.

Clients can then retreive the apt database with

# apt-get update
check their dependeny tree structure with
# apt-get check
install packages with
# apt-get install
and perform a system upgrade with
# apt-get upgrade

Cautious clients may prefer first to simulate an upgrade with

# apt-get -s upgrade

and to downloadthe rpms without installing them

# apt-get --download-only upgrade

The downloaded rpms are cached in /var/cache/apt/archives. To verify whether the correct architectures of the rpms were downloaded, one can check for the presence of i686 installed rpms with

# rpm -qa -qf '%{NAME}-->%{ARCH}\n' | grep 686

and compare these the cached rpms

#ls -alF /var/cache/apt/archives/*686*

References 

http://freshrpms.net/apt/server/ ftp://apt-rpm.tuxfamily.org/pub/ftp.tuxfamily.org/apt-rpm/scripts/apt-rpm.html http://mirror.phy.bnl.gov/apt-rpm/README.html http://apt4rpm.sourceforge.net/ https://moin.conectiva.com.br/AptRpm

http://www.dragonsdawn.net/~gordon/red-hat-apt-repository-howto/
http://www.jukie.net/~bart/apt-rpm/

Copyright 2003, WebMO, LLC, all rights reserved.

documented on: 2004.06.16

Creating apt-enabled RedHat or Fedora install cdroms 

http://ccrma.stanford.edu/planetccrma/software/createredhatcdroms.html

The custom Planet CCRMA RedHat 8.0, 9 or Fedora Core 1 install cdroms are replicas of the original RedHat or Fedora Core iso images with an added apt database of their contents. That enables to use them as local repositories for all the original RedHat or Fedora packages so that you can manage ALL your packages using apt-get or synaptic.

You can download them (the custom Planet CCRMA RedHat 8.0, 9 or Fedora Core 1) from this site or you can just create them yourself if you have the original RedHat 8.0, 9 or Fedora Core 1 cdroms, a working linux machine with enough disk space and a working cdwriter. Just follow the following instructions:

  1. download the apt databases

    For Fedora Core 1:
        * Planet CCRMA Fedora Core 1 disk 1 database
        * Planet CCRMA Fedora Core 1 disk 2 database
        * Planet CCRMA Fedora Core 1 disk 3 database
    For RedHat 9:
        * Planet CCRMA RedHat 9 disk 1 database
        * Planet CCRMA RedHat 9 disk 2 database
        * Planet CCRMA RedHat 9 disk 3 database
    For RedHat 8.0:
        * Planet CCRMA RedHat 8.0 disk 1 database
        * Planet CCRMA RedHat 8.0 disk 2 database
        * Planet CCRMA RedHat 8.0 disk 3 database
  2. make a directory where you will copy the contents of the cdroms, make sure the partition the directory is in has enough space to hold two complete cdroms (or just one if you know what you are doing and you are going to burn the cdrom on-the-fly from the output of mkisofs). The directory is going to be named /whatever.

    cd /whatever
    mkdir image
  3. mount the cdrom

    mount /mnt/cdrom
  4. copy the cdrom to the hard disk, we can copy everything with a back-to-back tar invocation (this assumes the cdrom is mounted in /mnt/cdrom):

    (cd /mnt/; tar cvf - cdrom)|(cd /whatever/image; tar xvpf -)
    When this is done you will have a copy of the cdrom in /whatever/image/cdrom.
  5. add the apt database to the cdrom copy, replace the file name of the tarfile with the one that corresponds to the cdrom you are recreating (the example below is for RedHat 8.0, disc 1):

    cd /whatever/image/cdrom
    tar xvzf path_to_tarfile/psyche-i386-disc1-apt.tar.gz
  6. create an iso image of the new cdrom: first change directory to be in the root directory of the cdrom copy:

    cd /whatever/image/cdrom
    Then create the iso image. If you are building the first cdrom (the example is for RedHat 8.0, disc1):
    mkisofs -v -r -T -J -V 'RedHat 8.0 for Planet CCRMA' -b images/boot.img -c boot.catalog -l -R -o /whatever/image.iso .
    Or in the case of RedHat 9 (disc 1, the name of the boot image file is different):
    mkisofs -v -r -T -J -V 'RedHat 8.0 for Planet CCRMA' -b images/bootdisk.img -c boot.catalog -l -R -o /whatever/image.iso .
    Or for Fedora Core 1 (disc 1, the catalog is in a subdirectory):
    mkisofs -v -r -T -J -V 'Fedora Core 1 for Planet CCRMA' -b images/bootdisk.img -c isolinux/boot.cat -l -R -o /whatever/image.iso .
    For the other two cdroms (they do not need to be bootable cdroms):
    mkisofs -v -r -T -J -V 'RedHat 8.0 for Planet CCRMA' -l -R -o /whatever/image.iso .
  7. use your favorite tool to burn the image into a cdr or cdrw, the image has been created in /whatever/image.iso.