Saturday, March 30, 2013

YUM vs. APT: Which is Best?

by Dietrich Schmitz


Nothing stirs more debate with fellow Linux enthusiasts than their package manager.

It's a passionately contested issue.  Which is better, YUM or APT?

You'll be surprised at the answers and it's really interesting to see what people think of each.

Yellowdog Updater Modified


Yellowdog Updater Modified, or YUM, is a complete rewrite of YUP, Yellowdog Updater.

Yum has evolved to support the Red Hat Package Manager, RPM and is used by Red Hat, Fedora, Fuduntu, CentOS, and other RPM Repo-based Distros.

Here are some of the noteworthy features of Yum:


  • XML Repository format
  • Automatic Metadata syncing
  • A Plug-in Module system to make Yum extensible
  • GUI Front-Ends, including PackageKit and Yum-Extender
Subtle differences between Apt and Yum include that Yum automatically updates a local metadata database stored in sqlite on your machine.  This happens silently in the background at interval, so there isn't any need to perform an update before upgrade such as is the case with Apt-Get.  With APT, a local cache stores metadata text file information but on each use, one must run sudo apt-get update before running sudo apt-get upgrade to receive needed updates.

Also, Yum checks all dependencies before starting the download process.  This may seem inefficient at first, but, on a large package download, it will be a big time saver as apt-get will sometimes fail on a dependancy requiring a restart with 'sudo apt-get install -f' to continue retrieving the missing dependant packages.

Yum-presto, one of many plugins written in Python, extends yum to add new features, in this case the ability to utilize deltarpms which contain only the diffs between one version of an rpm and its newer version.  This can speed downloading and installation significantly.

Yum-plugin-fastestmirror, as the name implies, is a plugin which will determine the best mirror (closest to your location) for obtaining your package(s).

Also, Yum will, when one mirror times out, switch over to another mirror to continue your download.  Apt-get will fail and require a restart of your upgrade.  There are many tutorials that can help with using Yum, here's one on Red Hat.

In a recent G+ Linux Advocates community discussion, +Norbert Varzariu wrote:

You need to install some plugins for yum to make it really kick ass:

aliases, changelog, fastestmirror, keys, langpacks, list-data, presto, protectbase, rpm-warm-cache, security, verify
to name a few. If you use btrfs, the fs-snapshot plugin is another great one.

fs-snapshot will allow a 'roll back' to a restore point before an update was performed.

Also, for users of yum-presto, deltarpms download first and then compile locally.  This is a compute-intensive task and multi-core cpu support was added so users should notice a significant speed increase in that process.

Advanced Packaging Tool


Advanced Packaging Tool, APT is a tool used to support Debian-based Distros, including Ubuntu.  Probably one of the biggest pluses going for APT is not the tool itself, but the vast repository of software applications.  It is often referred to as the 'de facto' package manager standard because the majority of websites offering software will automatically package in Deb format.

Popular as APT may be it has many good things going for it that make justifying its use persuasive.

The term APT doesn't refer to a singular program but a series of apt-* tools used in conjunction with downloading updates and new programs.

Update, Upgrade and Dist-Upgrade

Update is used to synchronize packages from their index source.  Upgrade is used to upgrade packages to their newest version, when made available.  Dist-Upgrade does upgrade and some intelligent upgrading decisions such as when a kernel update needs to be performed.  It will autonomously choose to perform higher priority upgrades first that have higher dependencies before doing others that depend on them.  Dist-Upgrade is often taken when performing a system point upgrade such as when a new Distro release comes out, e.g., Ubuntu 12.04 to 12.10, will perform an in-place upgrade of your system.

Several popular APT front-end GUIs are available, including the Ubuntu Software Center, Synaptics Package Manager, aptitude, KPackage, Adept Package Manager, GDebi and PackageKit.

Conclusion

I'm going to get a lot of flack for saying so, but I feel in having spent sufficient time with Fuduntu, a rolling release, that YUM is the better of the two package managers.  Truthfully, I have spent many years living with rpm, apt, yum and will say as popular as deb package management is, it really has nothing else going for it over YUM.

When I first began using Fuduntu, I thought I would miss Debian apt-get, but I didn't.  Not one bit.

I will also point out that Yum by default, using rpm, is Linux Standard Base compliant.

So, how do you feel about it?  Which package manager do you prefer?  Give us your feedback.

-- Dietrich






Enhanced by Zemanta

33 comments:

  1. If i was forced to choose between yum & apt it prolly be yum ,that said i aint used it for any great legnth of time to make an informed desicion. you know me, pacman is the best package management tool ive ever came across.

    ReplyDelete
  2. Honestly, I didn't see this as a fair comparison because none of the true benefits of apt were mentioned (I'm not as informed about the deeper details to go deeper on this).

    ReplyDelete
  3. If you can provide details that would help. Thanks Roland.

    ReplyDelete
  4. "Also, Yum checks all dependencies before starting the download process."

    But apt-get does this too...

    ReplyDelete
  5. My preference has been apt-get. Had too many bad experiences with yum in the past to the point I have been avoiding rpm distros. Maybe time for a new look at yum.

    ReplyDelete
  6. I started using Linux in 1994. Debian and all of its perversions just feel wrong. So while I've been happy with YUM and it's SuSE Cousin Zypper.

    ReplyDelete
  7. I think apt, aptitude, and yum are very close to one another in terms of features and function. I feel more comfortable with personally than apt and prefer the syntax more. The tool that doesn't get mentioned enough in articles such as this is zypper, I have found zypper to be vastly underrated.

    ReplyDelete
  8. I used zypper when it first appeared in openSUSE. Can't say I liked it but then I wasn't crazy about rpm either--still a lot may have changed--I can honestly say I don't miss APT, which by default means YUM does the job reasonably well.

    ReplyDelete
  9. When I first started dabbling in Linux I was using apt-get + aptitude ...even on fedora, because yum would never install anything on the first go, or even ever! That was back before Fedora dropped the "core" part of their name. I was installing servers and eventually started using centOS for server stuff. After I switched jobs, I played around with Linux for a few more years until finally fedora 12 came out. It was the release that finally had enough features and pull for me to make the switch from windows xp. That's when I tried yum again. Since fedora 12 -> today yum has gotten to the point where it does everything I need better and faster and simply just works. In that 4 years from leaving that job until fedora 12, Linux grew from a buggy, ugly, difficult to use, RTFM, miserable and frustrating OS, to now being so wonderful that I love using it more and more... yum is a part of that reason.

    ReplyDelete
  10. I like how aliases are built in to shorten the syntax like zypper search could also be zypper se and zypper ps shows processes that need to restarted etc. this article compares the syntax of popular commands between zypper and yum, apt, etc. http://news.opensuse.org/2013/03/22/opensuse-for-new-geekos/

    ReplyDelete
  11. best is PACMAN, no doubt

    ReplyDelete
  12. APT keeps a track of installed dependencies, and can remove them when they are not needed (for example, the original package, that pulled them, was uninstalled). The last time I used YUM (several years ago), it didn't.

    ReplyDelete
  13. Two reasons I like RPM and Yum better, though since my last hands-on with dpkg and apt things may have changed.


    rpm -Vv (verify an rpm)
    yum history undo (undo a package transaction)

    ReplyDelete
  14. Ikey Doherty posted this rather impressive image on rolling back upgrades using PiSi from the Pardus project:
    https://plus.google.com/u/0/107691710289083956125/posts/8pvJdpn4yk4

    ReplyDelete
  15. This is absurd. Basically, the claim is "Yum has neater tools for trivial front end cruft, and is therefore a better tool." I expect better from anyone claiming expertise in anything.

    ReplyDelete
  16. my desktop is Ubuntu, but the servers i work on are CentOS. As you say, both do the same job, and Ubuntu update works great. Similarly, yum really rocks, and is my preference. I'd say yum plugins set it apart. Fedora/RHEL/CentOS will always use yum and Debian/Ubuntu will always use apt, so we are "stuck" with both forever.

    ReplyDelete
  17. " sudo apt-get update before running sudo apt-get upgrade"

    Please think outside the "ubuntu" box

    Debian and "most" debian based systems (non-ubuntu) do not come with sudo enabled by default, and for good reason

    Other than that, not a bad read, apt & pacman for me

    ReplyDelete
  18. So, what's the next article on? vi vs. emacs?

    BTW, I did a weekly column (and companion website although no fancy domain) for ST Reports called, "The Linux Advocate." That ran from Nov. 1997 - Aug. 1999. I am in no way worried about this sites use of a similar combination of two words with one being Linux and the other being plural... but I thought I'd mention it.

    ReplyDelete
  19. Imagine how much better your articles would be if you actually researched them.

    The whole point of apt-get is to resolve dependencies before download and make sure the right things are happening. You only need "apt-get -f install" if you've manually installed something via dpkg and are using apt to fix the missing deps.

    Also, apt ships a (configurable) cron job that periodically updates the package database, so fancy frontends can tell you that you have updates available, and so you can run apt-get install/upgrade/whatever without updating first.


    So, it would seem that the "subtle differences between yum and apt" amount to "the author doesn't know much of anything about apt, but has a hate on for Debian, as evidenced by several of his articles and their slant".

    ReplyDelete
  20. Maybe you would consider becoming a Guest Writer?
    If so, reach me at dietrich at linuxadvocates dot com

    ReplyDelete
  21. Not absurd. And please don't put words in my mouth. If you'd like to quote me, do it correctly.

    ReplyDelete
  22. I am waiting for one Distro to come out of the box with ZFSonLinux as the root partition and then we'll see that feature really sing. I don't believe Pardus is a bootable ZFS partition, yes?

    ReplyDelete
  23. At one time that may have been true. That is no longer the case. Thanks.

    ReplyDelete
  24. I keep hearing about PACMAN and how good it is. I have no reason to believe that isn't true. Glad you like it. :)

    ReplyDelete
  25. I was prepared to not like YUM. So, really, the whole argument about the value of APT doesn't hold water for me any more.

    ReplyDelete
  26. Actually, no. It checks during the download, not before.

    ReplyDelete
  27. Ken Starks just posted up this story that ties into your remarks:

    http://linuxlock.blogspot.com/2013/03/resistance-isnt-futile.html

    ReplyDelete
  28. Um, you sure? Because every time I've installed/upgraded any package with apt-get ever, it's always listed the additional required packages prior to downloading the packages themselves.

    I think what you're thinking of is APT downloading its package lists and then using those to determine the dependencies. As for downloading the packages themselves, however, it literally goes like this:

    $ sudo apt-get install $somepackage
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following extra packages will be installed:
    $insert_various_dependencies_here
    Suggested packages:
    $insert_various_suggestions_here
    The following NEW packages will be installed:
    $insert_various_dependencies_here_with_actual_package

    $w upgraded, $x newly installed, $y to remove and $z not upgraded.
    Need to get $size1 MB of archives.
    After this operation, $size2 MB of additional disk space will be used.
    Do you want to continue [Y/n]?


    It's not until you press enter (or type "Yes, you twat" like I do) that any package files will actually be downloaded. As you can see, that's after the dependencies have been resolved. And yes, that's verbatim from apt-get; I'd plaster up the results of installing X.org on an Ubuntu server, but that would be an even longer post.

    ReplyDelete
  29. This may be a dumb question, but is it possible to use YUM in Ubuntu?

    ReplyDelete
  30. Gonzalo Velasco C.April 4, 2013 at 2:16 PM

    After using Yum, I liked it, but miss Synaptic :-(

    ReplyDelete
  31. I abandoned the RPM world when Mandrake (yes, yes, ages ago) wouldn't let me upgrade glibc. Unnamed dependency conflicts, even when I stripped the system down to the very barest essentials. Debian didn't bat an eyebrow when I upgraded libc6 (the Debian name for glibc).

    The Debian world also has a stunningly useful program named checkrestart which looks for processes that are running obsolete versions of libraries. You run it just after an "apt-get upgrade" and it tells you which services need to be restarted.

    ReplyDelete