Mastering APT

Chances are, if you use Debian, Ubuntu, or Freespire, you've heard of it: APT. But what is it?

APT stands for Advanced Packaging Tool, and was developed for the Debian Linux distribution. Basically, it allows you to install anything supported on your system with one line in the terminal.

Most people prefer to use a GUI for this type of thing. Many APT-based distributions also have a GUI for installing and removing applications. This usually is Synaptic. Many other GUI's are also derived from Synaptic: The Update Manager and Add/Remove applications both use it as a backend.

APT, unlike a vanilla RPM distribution, uses things called repositories to find packages you can install. Many of them are turned on by default in a distribution. You can add more yourself, as well as disable any that you don't like.

Most of the time, you can manage your software by using Synaptic, Adept, or another GUI. But what if you boot your system in failsafe mode, and there isn't one?

That is where apt-get, the brains behind everything else, comes in handy.

(Note: This tutorial will not take into account any sudo's or su's that you will need to use in commands. To run these commands as-is, you will be need to be in recovery mode, logged in as root, or you may prefix every command with sudo.)

First of all, let's start with a basic command: updating the repository list. Every time an update is released or you make a change to your repository, you will need to run this command:

apt-get update

The tool will look at your sources, and download them from the servers to check for updates. To upgrade your system, however, requires a different command:
apt-get upgrade

Make sure you do not get the two confused: update refreshes the list of software, upgrade downloads and installs all upgrades available.

Now, let's say you want to install XChat. Commonly, packages can be found as their name in the repository, so the following could be used:

apt-get install xchat

A quick sidenote: If for some reason you want to reinstall a package, just run the install command again as usual.

The install command for the most part is straightforward. But, what if you did not know the exact name? That is where the tool apt-cache comes in.

apt-cache search xchat

will search for all programs with the name or description of XChat, at which point you could then install.

If you decide you do not like XChat, you can remove it as easily as you installed it:

apt-get remove xchat

You now have the skills to survive in the wild world of the terminal to install any program you want. Install responsibly. ;)

Avatar for jacob Jacob Peddicord - http://jacob.peddicord.net/

Jacob is a web developer, student, and programmer from Ohio. He is a staff member at the Ubuntu Forums and is most likely a fanboy of the distribution. He loves to write in code and words, play video games, and rant about topics most would have abandoned long ago. Jacob uses GNOME and is never seen running stable software, much to the demise of his laptop.

Home » Articles »

Discussion: Mastering APT

  1. # Posted on 30 April 2007 at 10:10 AM

    [...] week, my fellow FOSSwire blogger Jacob introduced you to APT, the powerful package management system that is underneath [...]



  2. MP (guest)

    # Posted on 11 November 2007 at 02:25 AM

    apt-get clean is usefull in freeing up space used by old packages previously downloaded.



Home » Articles » Mastering APT