Differences between revisions 43 and 44
Revision 43 as of 2013-05-12 10:43:54
Size: 6132
Comment: minor fix
Revision 44 as of 2013-05-18 19:33:11
Size: 6133
Comment: minor fix
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
~-[[DebianWiki/EditorGuide#traduction|Traduction(s)]]: English - [[fr/AptCLI|Français]] - [[it/AptCLI|Italiano]] - [[AptCLIDutch|Nederlands]] - [[ko/AptCLI|한국어(Korean)]]-~ ~-[[DebianWiki/EditorGuide#traduction|Translation(s)]]: English - [[fr/AptCLI|Français]] - [[it/AptCLI|Italiano]] - [[AptCLIDutch|Nederlands]] - [[ko/AptCLI|한국어(Korean)]]-~

Translation(s): English - Français - Italiano - Nederlands - 한국어(Korean)


This page describes how to use various CLI (command line interface) Apt tools.

(Note: A CLI or root console (in GNOME) can most likely be found at "Applications -> System Tools-> Root Terminal", and "Applications -> System Tools-> Terminal" for a normal user console.)

http://www.vanadac.com/~dajhorn/projects/lmsw/10 Spam/01 apt-get install perlstuff.png

Configuring Apt Sources

Apt downloads packages and installs them onto your computer. To do that it connects to software repositories, or sources, which contain all the packages you'd want. You can configure Apt to use a source (or multiple sources) to get these packages from. There are many sources - web (HTTP) servers, FTP servers, CD-ROM disks, network servers (etc). Generally users download packages from the internet, since most users don't download all 14 CD's (for the current Sarge release).

Editing Sources Directly

You can edit the file which determines your sources directly:

Open a root console

# nano /etc/apt/sources.list

or

# gedit /etc/apt/sources.list

Edit!

You should read the manual for this configuration file first - type "man sources.list" at a console window. You could also read the sources.list page.

Using apt-setup

You can use the apt-setup tool which generates automatic source lines and adds them to the /etc/apt/sources.list (the file which configures your apt sources). Note: apt-setup doesn't wipe your existing configuration - it simply appends more sources. apt-setup is a debconf wizard.

Note: apt-setup was part of base-config which is no longer available in DebianEtch or DebianUnstable, please refer to DebianInstaller/RemoveBaseConfig and to http://lists.debian.org/debian-boot/2005/12/msg00259.html for details.

Open a root console

# apt-setup

Follow the Wizard!

Using apt-spy

apt-spy will generate a sources.list file (the configuration file for apt package sources) for you! It measures the latency and bandwidth to servers, and picks the best one.

To get started, you'll need to install it, and then read how to use it:

Open a root console

aptitude install apt-spy

When using apt-spy you need to at least include -d and the Debian distribution you want to check. Example first time usage:

# apt-spy -d stable

This command will check all the Debian stable repositories to see which ones are the fastest. If you want to only check the repositories where you live at you would include -a and the location which includes North America, South America, Asia, Europe, and Australia and New Zealand.

Apt-spy options

  • -d distribution - Debian distribution (ie, stable). Required unless updating.
  • -a area - Area to benchmark. (eg, Europe).
  • -c config - Configuration file to use.
  • -e number - Number of servers to benchmark before exiting.
  • -f file - File to grab when benchmarking. (relative to Debian base).
  • -i file - Specify input file. For use with the -w option.
  • -m mirror-list - Mirror list to use, or mirror-list to update when updating.
  • -o output-file - Where to put output.
  • -p proxy - Proxy server to use.

Using a graphical program

If you are using Gnome (I don't know for KDE) which is the default in Debian, you can configure your Apt sources with a graphical program. You will found it in:

  • for Etch: Desktop menu -> Administration -> Software Properties

You'll be prompted for Root password

Installing Packages

Open a root console

# aptitude install <package>
  • where <package> is the name of the package (application) you want to install.

Reinstalling

To reinstall a package type in a terminal:

aptitude reinstall <package>

To reinstall with all dependencies, type:

# aptitude reinstall <package> $(apt-cache depends --recurse --installed <package> ||grep '[ ]')

Removing a Package

# aptitude remove <package>

where <package> is the name of the package (application) you want to remove.

To also delete files and directories created by the package after installation, such as configuration or status (Warning: this may include files modified by the user), use:

# aptitude purge <package>

Updating a Package

Open a root console

# aptitude upgrade <package>

where <package> is the name of the package (application) you want to update.

Keeping your system up-to-date

Open a root console

# aptitude update
# aptitude upgrade

This does all the "noninterfering" package upgrades.

# aptitude dist-upgrade

This does package upgrades that require installing or removing some other package. Check the packages to be REMOVED: Any package lib<foo> is fine. If it's removing something you use, and there is nothing obviously replacing it (e.g. emacs20 replaced by emacs21), you may want to make yourself a note so you can reinstall it later (when a compatible package is available), or "pin" that package (see "man apt_preferences") before doing the "dist-upgrade".

Search for packages

Open a console

$ apt-cache search <string>

where <string> is a list of keywords to search for.

You may want to pipe the output (redirect the output) into "less" (a scrollable viewer) since the list may be huge:

$ apt-cache search <string> | less

List installed packages

Open a console

$ dpkg --list

Further Reading


CategoryQuickPackageManagement | CategoryPackageManagement