[LinuxFocus-icon]
Castellano Chinese Deutsch English Français Nederlands

This document is available in: English  Français  Italiano  

[Photo of Sheng Bao]
by Sheng Bao
<shengbao /at/ ieee.org>

About the author:

Sheng Bao is an undergraduate student in China majoring in EE. He loves Linux as he can find perfect toolchains there to support his research and study. Beyond investigating in many interdisciplinary fields, he is an enthusiast advocating Linux's triumph in the academic field.


Content:

 

Package Management Made Easy

Abstract:

Many people consider Linux as a tough OS, for its software package management is not that easy as in Windows. At my early time of using Linux, I also tried to find a file like setup.exe in Windows. Additionally, when I was using RPM, I was very afraid of the "dependency hell", which asks me to install other packages in order to meet the dependencies. Now, thanks to the excellent job of many open source enthusiasts, we can find a better way to manage software packages than Windows CNR (click and run) style. This article will introduce you the tools, YUM and APT-GET, for software package acquirement and other toolchains to work with them. Distribution specified package management will also be mentioned.

_________________ _________________ _________________

 

Software distributing methods in Linux

There are generally two types of programs on Linux, binary executables and scripts. Small scripts do not need to be installed in order to run. Scripts are plain texts, looking for their corresponding interpreters in the PATH environment. Distributing small scripts is very easy, just copy them. So in this article, software refers to complex scripts and binary executables.

Since most Linux software is open-sourced, they are distributed in the form of source code. Generally, source code is contained in a tar.gz or tar.bz2 ball with a configure script. The configure shell script gathers system information, such as libraries and header files needed to compile the program, to generate a Makefile. Then the compiler will compile the source code based on the rules defined in Makefile. Mostly, there is a rule titled install which copies the generated files to the destination.

The source code method is the most difficult way for newbies to install software on Linux. When I was a newbie, I always encountered problems, such as lack of libraries or some path missing. And a newbie mostly doesn't know the meaning of the error output. Of course they lack the knowledge for solving them. For example, the biggest mistake I made was extracting the source code on a FAT32 partition where symbolic links are not supported. Indeed, it is not easy to remove the software if there is no rule to uninstall in the Makefile and if you haven't specified the destination directory while configuring in order to separate your program from the rest of your system. Because of all these difficulties, some people created packages containing binaries for direct installation.

Famous examples of binary package formats are RPM and DEB. They provide an easy way to install, upgrade and uninstall packages. But problems also exist. Take RPM as an example. The dependence problem is a nightmare. Sometimes I found it is too difficult to meet the dependency check - I am in a loop or there are too many packages that need to be installed separately.

So we want something that can handle every related problem in package management, from acquiring and installing to updating and removal. Linux is an OS that is highly network-oriented. You just need to connect your computer onto the Internet. Then you can ask your package managers to handle everything for you. YUM and APT-GET let me feel that package management in Linux will be much easier than Windows. This article will mostly focus on using YUM on Fedora Core rather than on apt-get, because yum on FC is a new thing, compared to apt-get which has been developed a long time ago.

The remainder of this article is organised as follows. I will first explain the term repositories, which will be mentioned frequently in this article. Then I will start a big section talking about using YUM in Red Hat/Fedora Core. I will introduce three methods of importing repositories: Installing a rpm package that contains everything, Editing /etc/yum.conf and importing the GPG key and Creating a new file in the directory /etc/yum.repos.d corresponding to the repository and importing its GPG key. This section will also contain information about other repositories and YUM Plug-ins. An example of using YUM will be provided at the end of this section. After this section, I will introduce how to use APT-GET on Red Hat/Fedora Core. There are many available GUIed YUM tools that can help you manage your packages more easily. Two of them are discussed in GUIed YUM. Following a short glance of APT-GET on Debian and derivatives, there is a demo to Synaptic. Package management tools provided by Fedora Core 5 will be the ones discussed at last.

   

About repositories

This article will introduce you to many methods of using package management tools to obtain software from the Internet and to manage them. A place from which we can obtain packages is called a repository. Your distribution probably provides some repositories. But they may not contain all available software that can work on your distribution. Some volunteers like to "pack" software for your distribution. If you want to use that software, you have to add those volunteers' URLs into your repository list. Also, your distribution might have many repository mirrors. If you want to increase the download speed, you should manually add a nearby mirror into your repository list.

   

Using YUM on Red Hat/Fedora Core

I have only used YUM on Fedora Core 2, 4 and 5. The distributions themselves have provide the YUM software forge.
Generally, there are three methods to add repositories (collections of packages):

  • Installing a rpm package that contains everything
  • Editing /etc/yum.conf and importing the GPG key
  • Creating a new file in the directory /etc/yum.repos.d corresponding to the repository and importing its GPG key
  •    

    Installing a rpm package handling everything

    Here I want to demonstrate how to add two additional famous package forges, freshrpms and linva, via rpm balls. Following commands only apply for Fedora Core 5. If you are using a different distribution, go to ayo.freshrpms.net and rpm.livna.org to find rpm balls corresponding to your distribution. They are located at similar addresses.
    Type

    rpm -ivh http://ayo.freshrpms.net/fedora/linux/5/i386/RPMS.freshrpms/freshrpms-release-1.1-1.fc.noarch.rpm
    rpm -ivh http://rpm.livna.org/fedora/5/i386/livna-release-5-4.noarch.rpm
    
    The above command will add freshrpms and livna into your repository list.

       

    Editing /etc/yum.conf and importing the GPG key

    Some other ways are available to add YUM repositories. One way is to add repository information into /etc/yum.conf. http://svn.rpmforge.net/svn/trunk/rpms/yum/ has some examples. You just need to append the repository information from the examples to your /etc/yum.conf.

       

    Creating a new file in the directory /etc/yum.repos.d corresponding to the repository and importing its GPG key

    Another way is to create the appropriate files in the /etc/yum.repos.d directory. That directory contains the following files on my computer:

    [root@orioleQ yum.repos.d]# ls
    dries.repo                      fedora-legacy.repo           livna.repo
    fedora-core.repo                fedora-updates.repo          livna.repo~
    fedora-development.repo         fedora-updates-testing.repo  livna-testing.repo
    fedora-extras-development.repo  freshrpms.repo
    fedora-extras.repo              livna-devel.repo
    

    Let's take dries.repo as an example. Create a file /etc/yum.repos.d/dries.repo
    and put the following lines in that file:

    [dries]
    name=Extra Fedora rpms dries - $releasever - $basearch
    baseurl=http://ftp.belnet.be/packages/dries.ulyssis.org/fedora/linux/$releasever/$basearch/dries/RPMS/
    enabled=0
    gpgcheck=1
    
    Note that we have the "enabled" bit set to "0" (off) in this file so that the dries repository will not conflict with our RPMForge repositories for automatic updates. Then import the GPG key from the freshrpms repository.
    rpm --import http://freshrpms.net/packages/RPM-GPG-KEY.txt
    
    And by executing
    rpm --import http://apt.sw.be/dries/RPM-GPG-KEY.dries.txt
    
    you will import the GPG key for the dries repository.

       

    Others

    There are many volunteer-maintained repositories in the world. Just search for them and append them into your repository list. Here I list some package forges and you can choose the appropriate source for your system.
    http://dl.atrpms.net/
    http://www.jpackage.org/repos.php
    http://newrpms.sunsite.dk/
    Read the instruction on their webpage to find the method how to add them. Generally, you will find a file which contains the string "RPM-GPG-KEY" in its name. Use

    rpm --import  the.RPM-GPG-KEY.file
    
    to import the GPG key.

       

    Useful YUM Plug-ins

    There are many plug-ins that can improve performance and experience of YUM, such as yum-utils and yum-fastestmirror.
    Type

    yum -y install yum-fastestmirror
    
    and
    yum -y install yum-utils
    
    to install them. They will help you using YUM, e.g. by looking for the fastest mirror.

       

    Using YUM to install packages

    Using YUM to install software is very easy. It will resolve and install all related dependencies. Here is an example shell log:

    [root@orioleQ yum.repos.d]# yum -y install xine
    Loading "installonlyn" plugin
    Loading "kernel-module" plugin
    Loading "fedorakmod" plugin
    Setting up Install Process
    Setting up repositories
    dries                                                                [1/5]
    updates                                                              [2/5]
    core                                                                 [3/5]
    freshrpms                                                            [4/5]
    extras                                                               [5/5]
    Reading repository metadata in from local files
    Parsing package install arguments
    Resolving Dependencies
    --> Populating transaction set with selected packages. Please wait.
    ---> Downloading header for xine to pack into transaction set.
    xine-0.99.4-4.fc5.rf.i386 100% |=========================|  30 kB    00:01
    ---> Package xine.i386 0:0.99.4-4.fc5.rf set to be updated
    --> Running transaction check
    --> Processing Dependency: libaa.so.1 for package: xine
    --> Processing Dependency: libxine.so.1 for package: xine
    --> Processing Dependency: xine-lib >= 1.0.0 for package: xine
    --> Restarting Dependency Resolution with new changes.
    --> Populating transaction set with selected packages. Please wait.
    ---> Downloading header for xine-lib to pack into transaction set.
    xine-lib-1.1.1-2.fc5.rf.i 100% |=========================|  41 kB    00:03
    ---> Package xine-lib.i386 0:1.1.1-2.fc5.rf set to be updated
    ---> Downloading header for aalib to pack into transaction set.
    ftp://fedora.bu.edu/fedora/extras/5/i386/aalib-1.4.0-0.rc5.7.i386.rpm: [Errno
    4] IOError: [Errno ftp error] timed out
    Trying other mirror.
    aalib-1.4.0-0.rc5.7.i386. 100% |=========================| 5.9 kB    00:00
    ---> Package aalib.i386 0:1.4.0-0.rc5.7 set to be updated
    --> Running transaction check
    --> Processing Dependency: libdvdcss for package: xine-lib
    --> Processing Dependency: libfame-0.9.so.1 for package: xine-lib
    --> Restarting Dependency Resolution with new changes.
    --> Populating transaction set with selected packages. Please wait.
    ---> Downloading header for libdvdcss to pack into transaction set.
    libdvdcss-1.2.9-2.fc5.rf. 100% |=========================| 5.0 kB    00:00
    ---> Package libdvdcss.i386 0:1.2.9-2.fc5.rf set to be updated
    ---> Downloading header for libfame to pack into transaction set.
    libfame-0.9.1-10.fc5.i386 100% |=========================| 5.2 kB    00:00
    ---> Package libfame.i386 0:0.9.1-10.fc5 set to be updated
    --> Running transaction check
    
    Dependencies Resolved
    
    =============================================================================
     Package                 Arch       Version          Repository        Size
    =============================================================================
    Installing:
     xine                    i386       0.99.4-4.fc5.rf  dries             2.3 M
    Installing for dependencies:
     aalib                   i386       1.4.0-0.rc5.7    extras             70 k
     libdvdcss               i386       1.2.9-2.fc5.rf   dries              44 k
     libfame                 i386       0.9.1-10.fc5     freshrpms         226 k
     xine-lib                i386       1.1.1-2.fc5.rf   dries             4.2 M
    
    Transaction Summary
    =============================================================================
    Install      5 Package(s)
    Update       0 Package(s)
    Remove       0 Package(s)
    Total download size: 6.8 M
    Downloading Packages:
    (1/5): xine-lib-1.1.1-2.f 100% |=========================| 4.2 MB    02:49
    (2/5): aalib-1.4.0-0.rc5. 100% |=========================|  70 kB    00:01
    (3/5): libdvdcss-1.2.9-2. 100% |=========================|  44 kB    00:01
    (4/5): libfame-0.9.1-10.f 100% |=========================| 226 kB    00:28
    (5/5): xine-0.99.4-4.fc5. 100% |=========================| 2.3 MB    01:43
    Running Transaction Test
    Finished Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing: aalib                        ######################### [1/5]
      Installing: libfame                      ######################### [2/5]
      Installing: libdvdcss                    ######################### [3/5]
      Installing: xine-lib                     ######################### [4/5]
      Installing: xine                         ######################### [5/5]
    
    Installed: xine.i386 0:0.99.4-4.fc5.rf
    Dependency Installed: aalib.i386 0:1.4.0-0.rc5.7 libdvdcss.i386
    0:1.2.9-2.fc5.rf libfame.i386 0:0.9.1-10.fc5 xine-lib.i386 0:1.1.1-2.fc5.rf
    Complete!
    

       

    Using APT-GET on Red Hat/Fedora Core

    As we all know, APT (advanced package tools) is a good package management software firstly used on Debian and Debian-based Linux distributions (Ubuntu etc). On my workstation, I installed both Ubuntu 5.10 and Fedora Core 4, because sometimes I can only install software via apt-get and sometimes I can only install them via rpm. Indeed, many commercial software are distributed in RPM format such as NI LabVIEW, and do not support others officially. So when I am doing job, I use Fedora Core 4. But the convenience of apt-get "seduces" me to use Ubuntu frequently. For quite a long time, I was dreaming to use APT-GET on Fedora Core.

    There are many available places for you to install apt-get onto your RH/FC distributions. You can install the apt-get program via RPM balls first. One available place is http://apt.freshrpms.net/. Go to the directory corresponding to your distribution and CPU architecture. Download all files with prefix "apt-" and install them via rpm command. In my case, I used following lines to install my apt-get program.

    rpm -ivh http://ftp.freshrpms.net/pub/fedora/linux/extras/4/i386/apt-0.5.15cnc7-6.fc4.i386.rpm
    rpm -ivh http://ftp.freshrpms.net/pub/fedora/linux/extras/4/i386/apt-devel-0.5.15cnc7-6.fc4.i386.rpm
    

    Then, you should configure "apt". Using an editor, open the file /etc/apt/sources.list . The configuration in that file is not the same as what we use on Debian. There are many apt sources for Fedora Core on the Internet. I will show you some examples.

    Go to http://svn.rpmforge.net/svn/branches/rpms/matthias/apt/.
    Open the sources.list file corresponding to your CPU architecture. Copy the lines that correspond to your distribution. Uncomment them. And paste them into your /etc/apt/sources.list file. For example, I append this line into my /etc/apt/sources.list

    rpm http://ayo.freshrpms.net fedora/linux/2/i386 core updates freshrpms
    
    Open http://apt.kde-redhat.org/apt/sources.list.
    Copy the lines and append them into your /etc/apt/sources.list. Then run the command "apt-get update" to fetch the list.

    You can also search on the Internet for apt-get sources corresponding to your system and add them into your /etc/apt/sources.list as I described.

       

    GUIed YUM

    Here I want to list two GUIed YUMs, kyum and Yumex.
    To install them just execute

    yum -y install yumex
    yum -y install kyum
    
    Because their usage is very easy - just click and apply - I will only show screenshots of them. Please connect to the Internet when you use these programs.

    Kyum:



    YumEx:

       

    Using apt-get on Debian and derivatives

    I don't want to spend many words on this topic, as it's a very very old one. For some people, that's the reason to use Debian. As we have discussed how to use apt-get on Fedora Core, there is no more need for further elaboration.

    Just remember not to run many apt package management programs together. Or you will get an error saying

    E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily
    unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another
    process using it?
    

    There are many apt-get sources around the world. But their speed differs. Some are faster and some are slower. You just need to add them into your /etc/apt/sources.list. Most sources will provide you the content that you should append into /etc/apt/sources.list.

       

    Synaptic on Debian/Ubuntu

    APT-GET is a good package acquiring tool firstly applied on Debian. But when you want to view packages by category and check their installation status, Synaptic is a good choice. When you want to install a software, just right-click on the square box ahead of the software name and choose "Mark for installation". On installed packages you can choose "mark for reinstall", "mark for removal" and "mark for complete removal". Here come the screenshots.
    Mark for install:

    Handling installed packages:
       

    The Package Manager of Fedora Core 5

    Fedora Core 5 itself provides an easy-to-use GUI tool, Package Manager. You can use it as easily as kyum or YumEx. The only disadvantage is you can only handle software distributed with Fedora Core 5. You can view and select them by categories.


    Each category also has optional packages. Just click on "Optional packages".


    You can search packages you want.
     

    Discussions

    I have also created a webpage listing EE and math software which are used in my research and study. Please feel free to contact me if you have any new idea on this topic.  

    Acknowledgement

    I wish to thank the editor, Viktor Horvath, for his careful revision and comments on my draft.
    And thanks to You Xu, who will be a PhD candidate on Computer Science in WUSTL after this summer vacation (2006). He reviewed my draft and gave me many comments.
    I also want to thank Ying Huang, an excellent Chinese young lady majoring in Software Engineering, Nanjing University. She encourages me and lets me feel confident when I encounter difficulties.  

    Collected URLs

    These links and other links mentioned in this article worked at the time of this writing (June 2006). Maybe some of them don't work now.
  • ayo.freshrpms.net, a place to download apt and yum programs for Fedora Core/Red Hat and Yellow Dog
  • rpm.livna.org, a repository of add-on packages
  • http://svn.rpmforge.net/svn/trunk/rpms/yum/, yum repository provided by rpmforge
  • http://dl.atrpms.net/, a 3rd party rpm repository
  • http://www.jpackage.org/repos.php, JPackage Project package repositories
  • http://newrpms.sunsite.dk/, another repository for FC/RH distributions
  • http://svn.rpmforge.net/svn/branches/rpms/matthias/apt/, apt sources.list provided by rpmforge
  • http://apt.kde-redhat.org/apt/source.list, apt sources.list provided by kde-redhat
  •  

    Talkback form for this article

    Every article has its own talkback page. On this page you can submit a comment or look at comments from other readers:




    Webpages maintained by the LinuxFocus Editor team
    © Sheng Bao
    "some rights reserved" see linuxfocus.org/license/
    http://www.LinuxFocus.org
    Translation information:
    en --> -- : Sheng Bao <shengbao /at/ ieee.org>

    2006-10-18, generated by lfparser version 2.54