Tuesday, September 2, 2008

Package management in Ubuntu

Package tools and command line tips.

What's the difference between dpkg, apt-get, aptitude, synaptic, and add/remove? Which one should I use?

  1. dpkg: In the beginning, there were packages. And the community divided the stable packages from the testing, and the dev team cried out, 'Lo, these things need a manager, for how else are we to install and remove them?', and the milestone begat 'dpkg'.


    For dpkg was the first, before all others, and is still the heart of package maintenance. dpkg still does the real work, though the usurpers get the credit.

  2. apt-get: But the people were troubled, and they cried out, 'O mighty devs, dpkg is too hard to use. It heeds only our words, and knows not our heart. It is complicated, and we suffer because it is too easy to bork our system. And forth, into the light, came the Advanced Package Manager, and they called it apt. And the most favored among the apt was 'apt-get'


    And apt-get was a glorious step forward, for now the people's package manager heeded their hearts instead of long lists of pakage names when they wanted to update, and it gave them easier choices to understand. And obeisance to apt-get was still obeisance to dpkg, for apt-get was merely an easier-to-use front end for dpkg.

  3. aptitude: But the people, who are just *never* satisfied, lamented 'O mighty devs, this command-line nonsense has gone far enough. We want a graphical front end tool, because these endless lists of packages are breaking our spirit and making us confused in our oblutions. And the devs heaved a mighty sigh. And their voice brought forth 'aptitude'


    And aptitude had the same commands as apt, but in an easier-to use graphical format. It was called ugly, for it was descended of the command-line, and was despised by the pretty x-server-window adherents, yet it was strong and easy to use. Obeisance to aptitude was strong among the servers and headless devices, for they never listened to the words of the followers of the x-windows-server. And aptitude simply converted the commands into apt commands, and apt converted the commands into dpkg commands, and dpkg still did the real work. And when anyone pointed out that this was a bit convoluted, they were cast out.

  4. synaptic: But the majority of the people, the whiny people, cried out once more 'O mighty devs, who have given us packages and dpkg to rule them, and apt-get to prevent us borking our systems, and aptitude so we don't need to think very hard. And that's nice, for now we can download a lot more pornography. But also, we have heeded the words of the x-windows-server, and we want pretty windows that we control with mice and touchpads and drag around the screen. So chop chop, and get us a version of aptitude for these cool x-windows. And thus was born 'synaptic'.


    And synaptic was strong and robust, and popular among the adherents of GUI were very pleased and multiplied like locusts into legions of users. And like aptitude before it, synaptic simply converted the commands into apt commands, and apt converted the commands into dpkg commands, and dpkg still did the real work.

  5. add/remove: And still the people lamented 'O mighty and wonderful devs, who have found a way to automate updates, who have given me a powerful operating system for free, who have duplicated the miracles of Microsoft and Apple, we think that package management is still too hard, particularly for new users. Your newest followers should be able to install and remove applications with just one click, even more easily than they can now. And the devs considered casting those chuckleheads into the lake of fire, but instead raised their hand and brought forth 'Add/Remove'.


    And add/remove worked with a limited number of applications, a one-click installer/uninstaller of windowed apps, with a lot of advanced details hidden. Add/remove was a front-end for synaptic, which was itself a front-end for apt-get, which was itself a front-end for dpkg.
  6. but still, the people wailed for more and easier, but the tired devs closed their ears and hardened their hearts and went off to work instead on torrent-downloaders to speed up pornography.


  • sudo apt-get -f install - Find broken packages and try to fix them.
  • aptitude show packagename - Is a package installed? (check the second line of the response).
  • dpkg --get-selections > file - Write a list of all the installed packages in a file named 'file'.
  • sudo apt-get update - Refresh the package list.
  • sudo apt-get -d upgrade - Download the upgrades (with a y/n prompt)
  • sudo apt-get -dy upgrade - Download the upgrades (answer the prompt 'y')
  • sudo apt-get update && sudo apt-get -dy upgrade && sudo poweroff - Download all upgrades (not install), then shut down, perfect for unattended download, with installation upon startup in the morning.
  • log for all package actions is at /var/log/dpkg.log. It is rotated monthly at the beginning of the month, so for last month look in /var/log/dpkg.log.1

No comments:

Post a Comment