by Sheng Bao, in June 2006 (article #391)
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.
Table of Contents
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.
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.
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.
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:
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:
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.
Useful YUM Plug-ins
There are many plug-ins that can improve performance and experience of YUM, such as yum-utils and yum-fastestmirror.
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:
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.
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/.
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.
Here I want to list two GUIed YUMs, kyum and 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
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.
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.
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.
I wish to thank the editor, Viktor Horvath, for his careful revision and comments on my draft.
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.
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.
<shengbao /at/ ieee.org>