[ fromfile: debian-tips.xml id: aptsystem ]
The apt
system is a tool for managing packages and their dependencies.
The following programs can be used to manage your apt
-based package library.
apt-get
– a convenience program that makes it easy to get and
update your packages.
dpkg
– a lower layer of software - many simple apt
commands are translated into more complex commands and executed
by dpkg.
apt-cache
– a tool to help you search through the local apt
package info database.
aptitude
– apt-get
with a little more
intelligence - it can be used to get and remove packages when apt
fails. It is another convenience layer on top of dpkg.
Following are some handy tips and basic information about the apt
system and
how to use it.
/etc/apt/sources.list | |
---|---|
This file contains a list of sources that |
Fix your main mirrors so that they point to a local mirror instead of a remote
one. There are many ways to do this, but the most user-friendly way is to run apt-setup
.
Optional: Set the sources to "unstable" (debian) or "edgy" (kubuntu) if you want the latest and greatest versions of everything.[131]
apt-get update
downloads the package lists from your package
sources so that you have a local copy of the lists, dependency relationships, and descriptions
in your own dpkg database.
Sometimes you know you want a package, but you can't remember its exact name. apt-cache search search-string
searches through the locally downloaded package list for occurances of a string in the name or
description of each package. If the returned list contains the package you were looking for, you
can easily pull it down from the network and install it.
Once you know the name of a package, you can read its full description with apt-cache show pkgname
.
apt-get install packageName
is one of the most powerful commands you have, and it's only available if you have root access
on a Debian-based system.
apt-get remove packageName
,
as the name suggests, removes the named package in its entirety.
To save you time, I've listed a few packages which I suggest installing on a Debian system for C++ development. Note the use of the pound sign (#) to insert comments.
# alias for following commands: alias agi='apt-get install -y' # Database Stuff agi mysql-server mysql-client libmysqlclient15-dev agi sqlite3 libsqlite3-dev # For development agi build-essential manpages-dev # manual pages for stdlib agi global cscope exuberant-ctags # For C++ development - navigation and doc generation agi libqt4-dev qt4-dev-tools libphonon-dev agi gstreamer0.10-fluendo-mp3 # for playing mp3 files in phonon agi libtag1-dev libtag1-doc # taglib used by libfiletagger agi gdb # gnu debugger # UML Diagramming tool that reads/writes XMI and imports C++ source agi umbrello
apt
Tips apt-get (dist-|dselect-) upgrade |
|
---|---|
As time goes on, new packages are made available in your repository. When you want to
upgrade your system, it is appropriate to do a |
apt-get source packageName
|
|
---|---|
Unless you need a specific version that is not served by your package source, you can grab a
copy of the sourcecode in a convenient tarball for any available package by simply asking
for it from |
I just installed something - where did it go? | |
---|---|
For this command, we drop down a level into |
apt-get build-dep packageName
|
|
---|---|
Sometimes, when compiling large packages (such as Qt), you run into the situation where the
build fails due to missing libraries, (or their -dev packages). When I was still learning my
way around my first Debian-based system, I was building apps and libraries by following a
brute-force iterative process: configure, encounter and examine each error message, try to
figure out what library is missing, install it, and repeat until no more errors. After I
learned about You already know that the To see a list of all dependency relationships between packages, try apt-get build-dep libqt4-dev # grabs what you need to build qt4 from source apt-get build-dep amarok # grabs headers and libs you need to build amarok apt-get source amarok # grabs the source tarball |
aptitude : When Your apt
System Is Broken |
|
---|---|
Sometimes, you try to install something and not only do you get an error, but also It is important to read the error message carefully: You almost always see references to
specific package names that are causing the problems. By removing all of them, using Another way to fix this is by using |
[131] Ubuntu only: Be sure to add a "universe" after main so that you get the full packages offered by Ubuntu.
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |