10 installing things, part 2... Apt

The Ultimate Guide for the rest of us


10 installing things, part 2... Apt

Postby LeadFingers » Thu Apr 03, 2008 6:33 am

Apt (Advanced Packaging Tool) a command line tool is a rapid, practical, and efficient way to install packages that will manage dependencies automatically and take care of their configuration files while upgrading. The use of sudo before the command, runs the command as root.
The following is apt at it's most basic, for more apt than you ever cared to know
see the site
where this was copied from


There are 5 basic ways to use Apt
1) Install
Code: Select all
sudo apt-get install name_of_package

Where the following switches can be used for nearly any apt command
-h This help text.
-d Download only - do NOT install or unpack archives
-f Attempt to continue if the integrity check fails
-s No-act. Perform ordering simulation
-y Assume Yes to all queries and do not prompt
-u Show a list of upgraded packages as well

__________**Note**__________
Multiple packages may be selected for installation in one line. Files downloaded from the network are placed in the directory /var/cache/apt/archives for later installation.

2) Reinstall
If you somehow damage an installed package, or simply want the files of a package to be reinstalled with the newest version that is available, you can use the --reinstall option like so:
Code: Select all
sudo apt-get --reinstall install name_of_package


3) Remove
If you no longer want to use a package, you can remove it from your system using APT. To do this just type:
Code: Select all
sudo apt-get remove name_of_package

There is no way to remove a package using APT without also removing those packages that depend on it.

4) Purge Remove
Running apt-get as above will cause the packages to be removed but their configuration files, if any, will remain intact on the system. For a complete removal of the package, run:
Code: Select all
sudo apt-get --purge remove name_of_package

Just as in the case of the install method, you can use a symbol with remove to invert the meaning for a particular package. In the case of removing, if you add a '+' right after the package name, the package will be installed instead of being removed.
Code: Select all
sudo apt-get --purge remove name_of_package1 name_of_package2+

pkg1 and all it's dependencies are removed.
pkg2 and all it's dependencies are installed

5) Upgrade
Package upgrades are a great success of the APT system. They can be achieved with a single command:
Code: Select all
sudo apt-get upgrade

You can use this command to upgrade packages within the same distribution.

To upgrade to a new distribution, run:
Code: Select all
sudo apt-get dist-upgrade


It's useful to run this command with the -u option.
Code: Select all
sudo apt-get -u upgrade

This option causes APT to show the complete list of packages which will be upgraded. Without it, you'll be upgrading blindly. APT will download the latest versions of each package and will install them in the proper order.
It's important to always run apt-get update before you try this

You can use APT to upgrade your system from a new CD. To do this, run:
Code: Select all
sudo apt-cdrom

to add the CD to your /etc/apt/sources.list
and then run:
Code: Select all
sudo apt-get dist-upgrade

__________**Note**__________
It's important to note that APT always looks for the most recent versions of packages. Therefore, if your /etc/apt/sources.list were to list an archive that had a more recent version of a package than the version on the CD, APT would download the package from there.
1st Box: Ultimate Edition 2.0 x64/ 1.8 x64
2nd Box: XP (dusty)
3rd Box: Stable Media box Ultimate Edition 1.8 x64 with XBMC

The Oxen are slow but the Earth is patient ~Chuen~
User avatar
LeadFingers
U.E. God
U.E. God
 
Posts: 1303
Joined: Fri Nov 23, 2007 1:46 am
Location: Salem Oregon
Age: 58
Operating System: Ultimate Edition 3.1 64 BIT

Return to Newbie's Corner

Who is online

Users browsing this forum: No registered users and 2 guests