Dayto Day Usage

To enable you to search for packages both quickly and thoroughly, APT uses a local cache of the available packages. Try running this command:

sudo apt-get update

The apt-get update command instructs APT to contact all the servers it is configured to use and download the latest list of file updates. If your lists are outdated, it takes a minute or two for APT to download the updates. Otherwise, this command executes it in a couple of seconds.

After the latest package information has been downloaded, you are returned to the command line. You can now ask APT to automatically download any software that has been updated, using this command:

sudo apt-get upgrade

If you have a lot of software installed on your machine, there is a greater chance of things being updated. APT scans your software and compares it to the latest package information from the servers and produces a report something like this:

[email protected]:~$ sudo apt-get upgrade Reading package lists... Done Building dependency tree... Done The following packages will be upgraded:

example-content gnome-system-tools libavahi-client3 libavahi-common-data libavahi-common3 libavahi-glib1 ttf-opensymbol ubuntu-artwork ubuntu-minimal ubuntu-standard update-notifier 11 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 27.0MB of archives.

After unpacking 147kB of additional disk space will be used. Do you want to continue [Y/n]?

Each part of that report tells us something important. Starting at the top, the line "the following packages will be upgraded" gives us the exact list of packages for which updates are available. If you're installing new software or removing software, you'll see lists titled "The following packages will be installed" and "The following packages will be removed." A summary at the end shows that there's a total of 11 packages that APT will upgrade, with 0 new packages, 0 to remove, and 0 not upgraded. Because this is an upgrade rather than an installation of new software, all those new packages will only take up 147KB of additional space. Although they come to a 27MB download, they are overwriting existing files.

It's important to understand that a basic apt-get upgrade will never remove software or add new software. As a result, it is safe to use to keep your system fully patched, because it should never break things. However, occasionally you will see the "0 not upgraded" status change, which means some things cannot be upgraded. This happens when some software must be installed or removed to satisfy the dependencies of the updated package, which, as previously mentioned, apt-get upgrade will never do.

In this situation, you need to use apt-get dist-upgrade, so named because it's designed to allow users to upgrade from one version of Debian/Ubuntu to a newer versionan upgrade that inevitably involves changing just about everything on the system, removing obsolete software, and installing the latest features. This is one of the most-loved features of Debian because it allows you to move from version to version without having to download and install new CDs.

Whereas apt-get upgrade and apt-get dist-upgrade are there for upgrading packages, apt-get install is responsible for adding new software. For example, if you want to install the MySQL database server, you would run this:

sudo apt-get install mysql-server

Internally, APT would query "mysql-server" against its list of software, and find that it matches the mysql-server-5.0 package. It would then find which dependencies it needs that you don't already have installed and then give you a report like this one:

[email protected]:~$ sudo apt-get install mysql-server

Reading package lists... Done

Building dependency tree... Done

The following extra packages will be installed:

libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl mysql-client-5.0 mysql-server-5.0 Suggested packages:

dbishell libcompress-zlib-perl Recommended packages: mailx

The following NEW packages will be installed libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl mysql-client-5.0 mysql-server mysql-server-5.0 0 upgraded, 7 newly installed, 0 to remove and 11 not upgraded. Need to get 28.5MB of archives.

After unpacking 65.8MB of additional disk space will be used. Do you want to continue [Y/n]?

This time you can see that APT has picked up and selected all the dependencies required to install MySQL Server 5.0, but it has also listed one recommended package and two suggested packages that it has not selected for installation. The "recommended" package is just that: The person who made the MySQL package (or its dependencies) thinks it would be a smart idea for you to also have the mailx package. If you want to add it, press N to terminate apt-get and rerun it like this:

apt-get install mysql-server mailx

The "suggested" packages are merely a lower form of recommendation. They don't add any crucial features to the software you selected for install, but it's possible that you might need them for certain, smaller things.

Was this article helpful?

0 0

Post a comment