TimeLinux1

Thursday, October 28, 2010

Linux HowTo: rpm, yum, dpkg, apt


First the Basics:

-libraries:
             . os software modules that can be used by many different programs.
-packages:
             . software files that are installed on a linux system.
             . usually distributed as tarballs in two forms - rpm or debian.
-package info, mainly dependencies on other s/w is tracked in the form of a database.

-Although it is possible to install both forms of packages on a system (ie both rpm and debian), it is recommended to go with only one.

-rpm is the most popular package form for linux. redhat developed rpm and released it under gpl.

-redhat linux is available for atleast 5 cpu architectures:
              . x86                  - first by intel/then by amd etc
              . x86-64             - first by amd/then by intel etc
              . alpha               - dec/compaq/hp
              . ia-64                - intel itanium
              . sparc               - sun

-yellow dog linux is a distribution of linux developed by fixstars in 1999 for powerpc cpus used then by macos pcs.

-for the most part, the source rpms can be used to build packages on any cpu architecture.

-pkg name convention:
              . pkgname-a.b.c-x.arch.rpm                    
      -where a.b.c - version
                       x - build
                  arch - cpu type (most commonly i386, which represents x86 cpus from 80386 onwards)
-eg: . samba-3.0.25b-5mdv.x86_64.rpm

-useful rpm cmds:
             # rpm -q a i <rpm pkg>                 [ query ]
             # rpm -i v h <rpm pkg>                 [ U for upgrade - generally install is safer than upgrade ]
             # rpm --rebuild <rpm pkg>            [ rebuilds the binaries from the source code]


-source rpm files are actually modified cpio archives.
-so it is possible to extract individual files from the source rpm by reconverting them to cpio archives.
-for this the program called 'rpm2cpio' is used.
-eg:        # rpm2cpio blabla.src.rpm > blabla.cpio
-then      # cpio -i --make-directories < blabla.cpio
-or          # cpio -idmv < blabla.cpio
-this results in extraction of files in the current dir.

Yum cmd -yum originated with yellow dog linux but now incorporated with red hat.
-it automates a lot of tasks in searching, downloading and installing rpms.
-one drawback of yum is that it can only install what is in the repository and that too over the Internet.
-eg:        # yum list | install | upgrade | erase | info .. <pkg name>

-the main rpm config file is /usr/lib/rpm/rpmrc.
-the main yum config file is /etc/yum.conf ; other config files are in /etc/yum.repos.d dir.

-debian does not focus on flashy gui but its derivatives like ubuntu do. debian tries to be as opensource and bug free as possible.

-gnu hurd kernel != gnu linux kernel

-debian pkgs are incompatible with rpm, but the principles of operation are similar.

-dpkg cmd - cmd to manage debian pkgs ( like rpm cmd that manages rpm pkgs ).
-eg:        # dpkg -i r p .. <pkg name> ( i= install, r= remove, p= print info etc )
-dpkg can be useful for managing one or a few packages.

-apt-get cmd is the debian equivalent of yum in rpm world - it automates several steps in managing deb pkgs.
-apg-get looks for config info about pkg locations in /etc/apt/sources.list
-eg:        # apt-get check | install | upgrade | remove <pkg name>

-debian pkgs usually have '.deb' extn (like .rpm for rpm pkgs).

-the main config file for dpkg is '/etc/dpkg/dpkg.cfg'.
-the main config file for apt are '/etc/apt/sources.list' and '/etc/apt/apt.conf'.

-package conversion:
             . sometimes it requires a pkg conversion between rpm to deb or vice versa.
             . utilities like 'alien' help to do that.
-alien requires that both pkg managers be installed (rpm and dpkg).
-eg:       # alien --to-rpm <aprog.deb>
             # alien --to-deb <aprog.rpm>

-common cause of package dependency problems:
             . missing libraries
             . incompatible libraries
             . duplicate / mismatched names

-common answers to package dependency problems:
             . force the install
             . rebuilding pkg from source
             . modifying system config files, etc..

No comments:

Post a Comment