Keeping Fedora Ship-Shape

I've started to have a sort of love-hate relationship with Fedora. On the one hand, I like the fact that the Fedora Project keeps their distribution constantly up-to-date, making all of the latest and greatest advancements in KDE, GNOME, OpenOffice.org, and so on available to me. On the other hand, Fedora can sometimes be as stable as Anne Heche strung out on peyote.

I’ve started to have a sort of love-hate relationship with Fedora. On the one hand, I like the fact that the Fedora Project keeps their distribution constantly up-to-date, making all of the latest and greatest advancements in KDE, GNOME, OpenOffice.org, and so on available to me. On the other hand, Fedora can sometimes be as stable as Anne Heche strung out on peyote.

I know, I know: that’s what I get for using a “work in progress” as my desktop operating system instead of a commercial Linux distribution. But let’s face it: Fedora is darned popular, a lot of good stuff is being packaged for it first, and some of us like to live on the bleeding edge. We want our cake and want to eat it, too.

While I currently prefer Fedora over any other distribution for general purpose desktop use — although I still think Xandros is the best Linux out there for newbies — Fedora can be unstable and it does have some major shortcomings. For instance, the base install is missing key pieces such as multimedia support for stuff like MP3 and video files.

But, after playing with Fedora for about two months, I finally have it working to the point where I’m productive and it does everything I want it to do. However, to do that, I had to become intimately familiar with Fedora’s built-in software update mechanism. Because Fedora is a constant work-in-progress, updates to the base Fedora system are extremely frequent. You should update your system at least once a week to take advantage of new features and important bug and security fixes.

Yum! Software Updates are Tasty!

Fortunately, software updates and remote package installs with Fedora can be a painless process if you have a fairly decent Internet connection (DSL or cable modem) and you point your Fedora file repository configuration files towards a fast mirror. In Fedora, remote package updates are accomplished with the built-in Yellow Dog Updater Modified tool, better known as yum.

By default, if you’re using the release version of Fedora (Fedora Core 3 entered beta just as this article was being penned), your yum configuration file (located in /etc/yum.conf) is probably set to grab updates from the official Fedora Core feed at Red Hat. But, since everyone and their brother is trying to hit that one all the time, it’s the slowest and most unreliable server, and during peak hours, it’s probably going to time out on you.

If you run Fedora, the first thing you should do is configure yum to use a faster mirror. I like the mirror at kernel.org, because they’ve got high-speed connections coming out the wazoo and it’s one of the first sites to get updated — not to mention that it’s one of the few mirrors that hosts a complete x86_64 mirror of Fedora and I’m a Opteron/Athlon 64 weenie. (If kernel.org is too slow for you, a complete list of mirrors is listed at http://fedora.redhat.com/download/mirrors.html.)

You can change your mirror easily. First, copy the original yum. conf over to yum.old, remove the original repository section from yum.conf, and add Listing One with your favorite text editor.




Listing One: Pointing yum to a new mirror

[base]
name=Kernel.org Fedora Core Mirror $releasever – $basearch – Base
baseurl=http://mirrors.kernel.org/fedora/core/2/$basearch/os

[updates-released]
name=Kernel.org Fedora Core Mirror $releasever – $basearch – Released Updates
baseurl=http://mirrors.kernel.org/fedora/core/updates/2/$basearch

The key to getting an alternate mirror to work properly is knowing the proper address to add to the baseurl line of each repository section in yum.conf. The name line can be nearly anything you want to call it, and the section heading can be called anything provided that you enclose it in brackets. $releasever is a system variable that passes the version number of the distro (in my case, 2) and $basearch is a system variable that reports the system architecture of the machine, such as i386 or x86_64. (If you have problems with this for some reason, just hardcode the version or the architecture).

In Listing One, the first repository, base, contains the “base” files that make up the distro, and the second repository, updates-released, holds the updates that get added after release. You should verify the actual path of the “base” and “updates-released” mirrors you are connecting to by browsing them with Mozilla first and making sure the sites have the right stuff. In the case of “base,” it should have Fedora, SRPMS, headers, and images directories.

Generally, all of the “base” mirror URLs follow this format…

http://www.mirror.org/blah/blah/blah/fedora/core/
versionnumber/architecture/os

… while “updates-released” is usually in this format:

http://www.mirror.org/blah/blah/blah/fedora/core/updates/
versionnumber/architecture

The top level “updates” directory on the mirror will have a lot of RPM files in them, in addition to the SRPM, debug, and headers directories.

In addition to a mirror for Fedora “base” and “updates,” I also added a section for a third-party software repository that I like, called DAG. The new section is shown in Listing Two.




Listing Two: Adding a third-party repository

[dag]
name=DAG RPM Repository for Fedora Core
baseurl=http://apt.sw.be/fedora/2/en/$basearch/dag

There are other good third-party repositories, such as mirrors of fedora.us (look at the HOWTO document at http://www.fedora.us/wiki/FedoraHOWTO) and freshrpms.net. All of the mirrors are maintained by groups of fearlessly dedicated open source programmers that package popular programs in RPM format.

Once you have your yum.conf squared away, open a terminal window and enter the following command:


$ yum update

The yum program connects to the repositories, downloads the headers for each RPM that needs to get updated (in effect, the header is a description file of what each RPM does), checks them against your existing RPM database, and then prompts you to install the necessary files. The time for an update depends on how fast your connection is and how many files are needed. The whole process might be pretty quick, or you might want to take a coffee break. Or maybe order a pizza.

If yum installs an updated Linux kernel, reboot the system to take advantage of it. If yum installs a ton of stuff, I usually reboot anyway just to maintain stability.

I Want My MP3!

After a long-winded introduction, here’s the fun stuff: installing features that are missing from Fedora.

If you want to install a third-party package from a repository, simply run yum install followed by the name of the package.

For example, assuming you have the DAG or a fedora.us mirror configured in yum.conf, the following commands install a set of applications that you’ll appreciate having.


# yum install alsaplayer
# yum install zinf
# yum install xine
# yum install mplayer
# yum install mplayerplug-in
# yum install mpg321
# yum install lame
# yum install grip
# yum install krusader
# yum install mozilla-firefox

alsaplayer and zinf are MP3 players; xine and mplayer play video, while mplayerplug-in is the video player for Mozilla; mpg321 is an MPEG codec; lame is an MP3 encoder; grip is a compact disc ripper and MP3 encoder for GNOME; krusader is a nice Norton Utilities-like file manager for KDE; and mozilla-firefox is the lightweight Firefox browser.

Table One shows some other helpful yum commands.




Table One: A brief list of helpful yum commands




COMMANDDESCRIPTION
yum listList all available packages.
yum check-update or yum list updatesSee if there are updated packages available.
yum update Update all installed packages that have a newer version available.
yum install package [package...]Install specific packages and their dependencies.
yum search wordSearch all known packages entries (descriptions etc) for word.
yum info package Show basic information about a package.

Unfortunately, as of this writing, yum doesn’t yet have a decent GUI for finding third-party packages. My suggestion is that you make good use of the yum search command to look for the package that you want to install, or go that third-party mirror’s home page and browse its index of software.

Other Ways To Update Fedora

If you use Fedora and want a GUI just for bug fixes and security updates, you can use the Red Hat up2date program. up2date is useful because it resides right in your system tray (it looks like a checkmark or a glowing red dot, depending on its status) and notifies you whenever new updates are added to the Fedora mirror.

Unfortunately, it doesn’t utilize yum.conf — it has its own configuration file in /etc/sysconfig/rhn/sources. You’ll want to copy the “baseurl” sections of each of your repositories in your yum. conf and paste them in the sources file as shown in Listing Three:




Listing Three: Changing up2date to use an alternate mirror

Note that arch should be replaced with i386 or x86_64 depending on what version of Fedora Core you are using. As with yum.conf, you’ll want to back up sources to sources.old before editing it. When you edit sources, comment out the existing repositories with # characters placed at the start of each line.

In addition to yum and up2date, you also have the option of using Debian‘s Advanced Package Tools (APT) system as well, which does have good GUIs available for searching for third-party applications. (To read more about APT, see this month’s “Guru Guidance” column on page 56, or the feature “A Very Apropos apt” in the October 2003 issue of Linux Magazine, available online at http://www.linux-mag.com/2003-10/apt_01.html.)

To install APT and its corresponding GUI, run the following commands (provided your yum.conf is configured for DAG or FreshRPMS or Fedora.org):


# yum install apt
# yum install synaptic
# yum install kpackage

synaptic is an APT GUI for GNOME; kpackage is an APT GUI for KDE.

The configuration files for apt are stored in /etc/apt. Depending on which version of apt you install, it may use just the /etc/apt/ sources.list file or there may be a /etc/apt/sources.list.d directory that contains a configuration file for each repository. The version of APT from DAG uses the latter format, and has several repositories including itself and FreshRPMs in sources.list.d/.

To update the APT database, run apt-get update. Once APT is up-to-date, you can then run synaptic or kpackage and pick the packages you want to install.

Once you get the hang of yum and APT, you can install and update with wild abandon. And you won’t have to worry about RPM dependency hell.

Next month we’re going to cover some other critical Fedora tweaks. Stay tuned.



Jason Perlow is a geek and a gastronomer and regular contributor to Linux Magazine. He can be reached at jperlow@linux-mag.com.

Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62