|
knet's haven » Writing » Articles » Using APT On An RPM-Based Linux Distribution |
|||||||||||||||||||||||||
|
Using APT On An RPM-Based Linux Distribution
Abstract Package management can be considered the heart of a distribution and is a major factor to consider when deciding which distribution to install. The following document describes a more flexible setup, allowing the user to use the APT package management system on an RPM-based distribution. The two systems will happily co-exist. At a whim, the user may choose to use either of the two package management systems. What Is APT?APT (Advanced Package Tools) is Debian's package management system. It consists of: I will discuss these tools, their uses, and provide examples later. What Is RPM?RPM (RedHat Package Management) is RedHat's package management system. It is also used on Mandrake and many other distributions. What Is APT-RPM?APT-RPM is a port of Debian's APT to an RPM-based distribution. In order to use APT-RPM, you need access to an APT-enabled repository. A list of such repositories is provided later in this document. Installing APT-RPMI have RedHat 7.3 systems. Therefore, the following instructions will be written with RedHat 7.3 installation in mind. If you do not have RedHat 7.3 check the availability of packages for other distributions or different versions of the same distribution at: In order to use APT I installed the APT-RPM package, available as an RPM from: If you wish to build the package yourself from source RPM you will need to download the SRPM from: To install the RPM I simply did the following: [root@hal root]# rpm -Uvh /share/RPM/apt-0.3.19cnc55-4sp_rh7x.i386.rpm Preparing... ########################################### [100%] 1:apt ########################################### [100%] [root@hal root]# If you wish to build the SRPM for installation, the simplest method is: [root@hal root]# rpm --rebuild /share/SRPM/apt-0.3.19cnc55-4sp_rh7x.src.rpm . . . . . [root@hal root]# rpm -Uvh /usr/src/redhat/RPMS/i386/apt-0.3.19cnc55-4sp_rh7x.i386.rpm Preparing... ########################################### [100%] 1:apt ########################################### [100%] [root@hal root]# Configuring APTOnce you have installed APT you will need to tell it where to find APT-RPM repositories. This information is contained within /etc/apt/sources.list. For my RedHat 7.3 systems I have the following in /etc/apt/sources.list: # Package repository URLs # # This list is restricted to Red Hat distributions. # # signed repositories can have a [sigtag] # if you remove it, no digital signature check will be made! rpm http://apt.au.freshrpms.net/ redhat/7.3/en/i386 os updates freshrpms rpm-src http://apt.au.freshrpms.net/ redhat/7.3/en/i386 os updates freshrpms rpm http://apt.freshrpms.net/ redhat/7.3/en/i386 os updates freshrpms rpm-src http://apt.freshrpms.net/ redhat/7.3/en/i386 os updates freshrpms rpm ftp://apt-rpm.tuxfamily.org/apt redhat/7.3/en/i386 updates extra rpm-src ftp://apt-rpm.tuxfamily.org/apt redhat/7.3/en/i386 updates extra The lines beginning with rpm tell APT where to find RPM files. The lines beginning with rpm-src tell APT where to find SRPM files. You may well require different "sources". Check for other sources at: Using APTFor more detailed documentation of APT see the Debian APT HOWTO apt-getUpdatingOnce you have APT installed you will need to perform an update. This is used to synchronise with the package overview files located at the sources. You should perform an update before retrieving a package (well, at least every now and again). To do this type apt-get update as root. You should see something like the following: [root@joshua /root]# apt-get update Hit http://apt.au.freshrpms.net redhat/7.3/en/i386/base/pkglist.os Hit http://apt.freshrpms.net redhat/7.3/en/i386/base/pkglist.os Hit http://apt.au.freshrpms.net redhat/7.3/en/i386 release.os Hit http://apt.freshrpms.net redhat/7.3/en/i386 release.os Hit http://utelsystems.dyndns.org redhat/base/pkglist.testingrh73 Hit http://apt.freshrpms.net redhat/7.3/en/i386/base/pkglist.updates Hit http://apt.au.freshrpms.net redhat/7.3/en/i386/base/pkglist.updates Hit http://apt.freshrpms.net redhat/7.3/en/i386 release.updates Hit http://apt.au.freshrpms.net redhat/7.3/en/i386 release.updates Hit http://apt.freshrpms.net redhat/7.3/en/i386/base/pkglist.freshrpms Ign http://utelsystems.dyndns.org redhat release.testingrh73 Hit http://apt.au.freshrpms.net redhat/7.3/en/i386/base/pkglist.freshrpms Hit http://apt.freshrpms.net redhat/7.3/en/i386 release.freshrpms Hit http://utelsystems.dyndns.org redhat/base/srclist.testingrh73 Hit http://apt.au.freshrpms.net redhat/7.3/en/i386 release.freshrpms Hit http://apt.freshrpms.net redhat/7.3/en/i386/base/srclist.os Hit http://apt.freshrpms.net redhat/7.3/en/i386 release.os Hit http://apt.au.freshrpms.net redhat/7.3/en/i386/base/srclist.os Hit http://apt.au.freshrpms.net redhat/7.3/en/i386 release.os Hit http://apt.freshrpms.net redhat/7.3/en/i386/base/srclist.updates Hit http://apt.freshrpms.net redhat/7.3/en/i386 release.updates Ign http://utelsystems.dyndns.org redhat release.testingrh73 Hit http://apt.au.freshrpms.net redhat/7.3/en/i386/base/srclist.updates Hit http://apt.au.freshrpms.net redhat/7.3/en/i386 release.updates Hit http://apt.freshrpms.net redhat/7.3/en/i386/base/srclist.freshrpms Hit http://apt.freshrpms.net redhat/7.3/en/i386 release.freshrpms Hit http://apt.au.freshrpms.net redhat/7.3/en/i386/base/srclist.freshrpms Hit http://apt.au.freshrpms.net redhat/7.3/en/i386 release.freshrpms Hit ftp://apt-rpm.tuxfamily.org redhat/7.3/en/i386/base/pkglist.updates Hit ftp://apt-rpm.tuxfamily.org redhat/7.3/en/i386 release.updates Hit ftp://apt-rpm.tuxfamily.org redhat/7.3/en/i386/base/pkglist.extra Hit ftp://apt-rpm.tuxfamily.org redhat/7.3/en/i386 release.extra Hit ftp://apt-rpm.tuxfamily.org redhat/7.3/en/i386/base/srclist.updates Hit ftp://apt-rpm.tuxfamily.org redhat/7.3/en/i386 release.updates Hit ftp://apt-rpm.tuxfamily.org redhat/7.3/en/i386/base/srclist.extra Hit ftp://apt-rpm.tuxfamily.org redhat/7.3/en/i386 release.extra Hit ftp://ftp.uninett.no redhat/7.3/en/i386/redhat/base/pkglist.os Hit ftp://ftp.uninett.no redhat/7.3/en/i386/redhat release.os Hit ftp://ftp.uninett.no redhat/7.3/en/i386/redhat/base/pkglist.updates-os Get:1 ftp://ftp.uninett.no redhat/7.3/en/i386/redhat release.updates-os [99B] Hit ftp://ftp.uninett.no redhat/7.3/en/i386/redhat/base/pkglist.freshrpms Get:2 ftp://ftp.uninett.no redhat/7.3/en/i386/redhat release.freshrpms [116B] Hit ftp://ftp.uninett.no redhat/7.3/en/i386/redhat/base/srclist.os Hit ftp://ftp.uninett.no redhat/7.3/en/i386/redhat release.os Hit ftp://ftp.uninett.no redhat/7.3/en/i386/redhat/base/srclist.updates-os Hit ftp://ftp.uninett.no redhat/7.3/en/i386/redhat release.updates-os Hit ftp://ftp.uninett.no redhat/7.3/en/i386/redhat/base/srclist.freshrpms Hit ftp://ftp.uninett.no redhat/7.3/en/i386/redhat release.freshrpms Fetched 215B in 30s (7B/s) Processing File Dependencies... Done Reading Package Lists... Done Building Dependency Tree... Done W: ftp://apt-rpm.tuxfamily.org/apt/ will not be authenticated. W: ftp://apt-rpm.tuxfamily.org/apt/ will not be authenticated. W: http://apt.au.freshrpms.net/ will not be authenticated. W: http://apt.au.freshrpms.net/ will not be authenticated. W: http://apt.freshrpms.net/ will not be authenticated. W: http://apt.freshrpms.net/ will not be authenticated. W: ftp://ftp.uninett.no/pub/linux/apt/ will not be authenticated. W: ftp://ftp.uninett.no/pub/linux/apt/ will not be authenticated. W: http://utelsystems.dyndns.org/apt/ will not be authenticated. W: http://utelsystems.dyndns.org/apt/ will not be authenticated. [root@joshua /root]# InstallingHere I attempt to install lirc using apt-get: [root@joshua /root]# apt-get install lirc Processing File Dependencies... Done Reading Package Lists... Done Building Dependency Tree... Done The following NEW packages will be installed: lirc 0 packages upgraded, 1 newly installed, 0 to remove(replace) and 356 not upgraded. Need to get 341kB of archives. After unpacking 972kB will be used. Err http://apt.au.freshrpms.net redhat/7.3/en/i386/freshrpms lirc 0.6.5-fr1 404 Not Found Get:1 http://apt.freshrpms.net redhat/7.3/en/i386/freshrpms lirc 0.6.5-fr1 [341kB] Fetched 341kB in 3m6s (1832B/s) Executing RPM (-U)... Preparing... ########################################### [100%] 1:lirc ########################################### [100%] [root@joshua /root]# UpgradingNothing here yet... RemovingHere I attempt to remove lirc using apt-get: [root@joshua /root]# apt-get remove lirc Processing File Dependencies... Done Reading Package Lists... Done Building Dependency Tree... Done The following packages will be REMOVED: lirc 0 packages upgraded, 0 newly installed, 1 to remove(replace) and 356 not upgraded. Need to get 0B of archives. After unpacking 972kB will be freed. Do you want to continue? [Y/n] y Executing RPM (-e)... [root@joshua /root]# Source CodeHere I attempt to retrieve the SRPM for xchat using apt-get: [root@joshua /root]# apt-get source xchat Processing File Dependencies... Done Reading Package Lists... Done Building Dependency Tree... Done Need to get 756kB of source archives. Get:1 ftp://apt-rpm.tuxfamily.org redhat/7.3/en/i386/updates xchat 1:1.8.9-1.73.0 (srpm) [756kB] Fetched 756kB in 5m15s (2399B/s) [root@joshua /root]# The source package is downloaded to the current working directory. In my case, this was /root. I can now install the SRPM to /usr/src/redhat/SOURCES: [root@joshua /root]# rpm -ivh xchat-1.8.9-1.73.0.src.rpm 1:xchat ########################################### [100%] [root@joshua /root]# If I had wanted to build the source I could have used apt-get source --compile xchat. The source package would be built as an RPM package. On my system the result is: . . . . . Wrote: /usr/src/redhat/RPMS/i386/xchat-1.8.9-1.73.0.i386.rpm . . . . . Then, if I wished to upgrade my existing xchat installation using the newly built RPM I'd: [root@joshua /root]# rpm -Uvh /usr/src/redhat/RPMS/i386/xchat-1.8.9-1.73.0.i386.rpm Preparing... ########################################### [100%] 1:xchat ########################################### [100%] [root@joshua /root]# CleaningYou can use apt-get clean to clear the repository (/var/cache/apt/archives/ and /var/cache/apt/archives/partial/) of all packages. You may want to do this if you are strapped for disk space. If so, I recommend you backup the packages first - you may need them again in the future. If you use apt-get autoclean the repository will only be cleared of packages that can no longer be downloaded. This may well be a safer first step if you are strapped for disk space as packages that can no longer be downloaded have likely been superseded. apt-cdromThis is used to add CDROM repositories to APT's list of available sources. If you have a CDROM containing an APT-RPM repositories, insert it into your CD drive and type apt-cdrom add as root. apt-cacheGenerally, this is an internal program. It is used to perform operations on APT's package cache. apt-configThis is an internal program used to access the configuration file /etc/apt/apt.conf in a way that makes it easy for scripts and programs to inspect the APT configuration. |