407 lines
14 KiB
HTML
407 lines
14 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
|
|
|
<title>APT HOWTO (Obsolete Documentation) - Basic Configuration</title>
|
|
|
|
<link href="index.en.html" rel="start">
|
|
<link href="ch1.en.html" rel="prev">
|
|
<link href="ch-apt-get.en.html" rel="next">
|
|
<link href="index.en.html#contents" rel="contents">
|
|
<link href="index.en.html#copyright" rel="copyright">
|
|
<link href="ch1.en.html" rel="chapter" title="1 Introduction">
|
|
<link href="ch-basico.en.html" rel="chapter" title="2 Basic Configuration">
|
|
<link href="ch-apt-get.en.html" rel="chapter" title="3 Managing packages">
|
|
<link href="ch-helpers.en.html" rel="chapter" title="4 Very useful helpers">
|
|
<link href="ch-search.en.html" rel="chapter" title="5 Getting information about packages.">
|
|
<link href="ch-sourcehandling.en.html" rel="chapter" title="6 Working with source packages">
|
|
<link href="ch-erros.en.html" rel="chapter" title="7 How to deal with errors">
|
|
<link href="ch-distros.en.html" rel="chapter" title="8 What distributions support APT?">
|
|
<link href="ch-agradecimentos.en.html" rel="chapter" title="9 Credits">
|
|
<link href="ch-novas.en.html" rel="chapter" title="10 New versions of this tutorial">
|
|
<link href="ch-basico.en.html#s-sources.list" rel="section" title="2.1 The /etc/apt/sources.list file">
|
|
<link href="ch-basico.en.html#s-dpkg-scanpackages" rel="section" title="2.2 How to use APT locally">
|
|
<link href="ch-basico.en.html#s-netselect" rel="section" title="2.3 Deciding which mirror is the best to include in the sources.list file: netselect, netselect-apt">
|
|
<link href="ch-basico.en.html#s-cdrom" rel="section" title="2.4 Adding a CD-ROM to the sources.list file">
|
|
<link href="ch-apt-get.en.html#s-update" rel="section" title="3.1 Updating the list of available packages">
|
|
<link href="ch-apt-get.en.html#s-install" rel="section" title="3.2 Installing packages">
|
|
<link href="ch-apt-get.en.html#s-remove" rel="section" title="3.3 Removing packages">
|
|
<link href="ch-apt-get.en.html#s-upgrade" rel="section" title="3.4 Upgrading packages">
|
|
<link href="ch-apt-get.en.html#s-dist-upgrade" rel="section" title="3.5 Upgrading to a new release">
|
|
<link href="ch-apt-get.en.html#s-clean" rel="section" title="3.6 Removing unused package files: apt-get clean and autoclean">
|
|
<link href="ch-apt-get.en.html#s-dselect-upgrade" rel="section" title="3.7 Using APT with dselect">
|
|
<link href="ch-apt-get.en.html#s-default-version" rel="section" title="3.8 How to keep a mixed system">
|
|
<link href="ch-apt-get.en.html#s-apt-show-versions" rel="section" title="3.9 How to upgrade packages from specific versions of Debian">
|
|
<link href="ch-apt-get.en.html#s-pin" rel="section" title="3.10 How to keep specific versions of packages installed (complex)">
|
|
<link href="ch-helpers.en.html#s-equivs" rel="section" title="4.1 How to install locally compiled packages: equivs">
|
|
<link href="ch-helpers.en.html#s-localepurge" rel="section" title="4.2 Removing unused locale files: localepurge">
|
|
<link href="ch-helpers.en.html#s-helper-show-versions" rel="section" title="4.3 How to know what packages may be upgraded">
|
|
<link href="ch-search.en.html#s-cache" rel="section" title="5.1 Discovering package names">
|
|
<link href="ch-search.en.html#s-dpkg-search" rel="section" title="5.2 Using dpkg to find package names">
|
|
<link href="ch-search.en.html#s-auto-apt" rel="section" title="5.3 How to install packages "on demand"">
|
|
<link href="ch-search.en.html#s-apt-file" rel="section" title="5.4 How to discover to which package a file belongs">
|
|
<link href="ch-search.en.html#s-apt-listchanges" rel="section" title="5.5 How to keep informed about the changes in the packages.">
|
|
<link href="ch-sourcehandling.en.html#s-source" rel="section" title="6.1 Downloading source packages">
|
|
<link href="ch-sourcehandling.en.html#s-build-dep" rel="section" title="6.2 Packages needed for compiling a source package">
|
|
<link href="ch-erros.en.html#s-erros-comuns" rel="section" title="7.1 Common errors">
|
|
<link href="ch-erros.en.html#s-help" rel="section" title="7.2 Where can I find help?">
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<p><a name="ch-basico"></a></p>
|
|
<hr>
|
|
|
|
<p>
|
|
[ <a href="ch1.en.html">previous</a> ]
|
|
[ <a href="index.en.html#contents">Contents</a> ]
|
|
[ <a href="ch1.en.html">1</a> ]
|
|
[ 2 ]
|
|
[ <a href="ch-apt-get.en.html">3</a> ]
|
|
[ <a href="ch-helpers.en.html">4</a> ]
|
|
[ <a href="ch-search.en.html">5</a> ]
|
|
[ <a href="ch-sourcehandling.en.html">6</a> ]
|
|
[ <a href="ch-erros.en.html">7</a> ]
|
|
[ <a href="ch-distros.en.html">8</a> ]
|
|
[ <a href="ch-agradecimentos.en.html">9</a> ]
|
|
[ <a href="ch-novas.en.html">10</a> ]
|
|
[ <a href="ch-apt-get.en.html">next</a> ]
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<h1>
|
|
APT HOWTO (Obsolete Documentation)
|
|
<br>Chapter 2 - Basic Configuration
|
|
</h1>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-sources.list"></a>2.1 The /etc/apt/sources.list file</h2>
|
|
|
|
<p>
|
|
As part of its operation, APT uses a file that lists the 'sources' from which
|
|
packages can be obtained. This file is <samp>/etc/apt/sources.list</samp>.
|
|
</p>
|
|
|
|
<p>
|
|
The entries in this file normally follow this format:
|
|
</p>
|
|
|
|
<pre>
|
|
deb http://host/debian distribution section1 section2 section3
|
|
deb-src http://host/debian distribution section1 section2 section3
|
|
</pre>
|
|
|
|
<p>
|
|
Of course, the above entries are fictitious and should not be used. The first
|
|
word on each line, <samp>deb</samp> or <samp>deb-src</samp>, indicates the type
|
|
of archive: whether it contains binary packages (<samp>deb</samp>), that is,
|
|
the pre-compiled packages that we normally use, or source packages
|
|
(<samp>deb-src</samp>), which are the original program sources plus the Debian
|
|
control file (<samp>.dsc</samp>) and the <samp>diff.gz</samp> containing the
|
|
changes needed for `debianizing' the program.
|
|
</p>
|
|
|
|
<p>
|
|
We usually find the following in the default Debian sources.list:
|
|
</p>
|
|
|
|
<pre>
|
|
# See sources.list(5) for more information, especially
|
|
# Remember that you can only use http, ftp or file URIs
|
|
# CDROMs are managed through the apt-cdrom tool.
|
|
deb http://http.us.debian.org/debian stable main contrib non-free
|
|
deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free
|
|
deb http://security.debian.org stable/updates main contrib non-free
|
|
|
|
# Uncomment if you want the apt-get source function to work
|
|
#deb-src http://http.us.debian.org/debian stable main contrib non-free
|
|
#deb-src http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free
|
|
</pre>
|
|
|
|
<p>
|
|
These are the lines needed by a basic Debian install. The first
|
|
<samp>deb</samp> line points to the official archive, the second to the non-US
|
|
archive and the third to the archive of Debian security updates.
|
|
</p>
|
|
|
|
<p>
|
|
The two last lines are commented out (with a `#' in front), so apt-get will
|
|
ignore them. These are <samp>deb-src</samp> lines, that is, they point to
|
|
Debian source packages. If you often download program sources for testing or
|
|
recompiling, uncomment them.
|
|
</p>
|
|
|
|
<p>
|
|
The <samp>/etc/apt/sources.list</samp> file can contain several types of lines.
|
|
APT knows how to deal with archives of types <samp>http</samp>,
|
|
<samp>ftp</samp>, <samp>file</samp> (local files, e.g., a directory containing
|
|
a mounted ISO9660 filesystem) and <samp>ssh</samp>, that I know of.
|
|
</p>
|
|
|
|
<p>
|
|
Do not forget to run <samp>apt-get update</samp> after modifying the
|
|
<samp>/etc/apt/sources.list</samp> file. You must do this to let APT obtain
|
|
the package lists from the sources you specified.
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-dpkg-scanpackages"></a>2.2 How to use APT locally</h2>
|
|
|
|
<p>
|
|
Sometimes you have lots of packages .deb that you would like to use APT to
|
|
install so that the dependencies would be automatically solved.
|
|
</p>
|
|
|
|
<p>
|
|
To do that create a directory and put the .debs you want to index in it . For
|
|
example:
|
|
</p>
|
|
|
|
<pre>
|
|
# mkdir /root/debs
|
|
</pre>
|
|
|
|
<p>
|
|
You may modify the definitions set on the package's control file directly for
|
|
your repository using an <samp>override</samp> file. Inside this file you may
|
|
want to define some options to override the ones that come with the package.
|
|
It looks like follows:
|
|
</p>
|
|
|
|
<pre>
|
|
package priority section
|
|
</pre>
|
|
|
|
<p>
|
|
package is the name of the package, priority is low, medium or high and section
|
|
is the section to which it belongs. The file name does not matter, you'll have
|
|
to pass it as an argument for <code>dpkg-scanpackages</code> later. If you do
|
|
not want to write an <samp>override</samp> file, just use
|
|
<code>/dev/null</code>. when calling <code>dpkg-scanpackages</code>.
|
|
</p>
|
|
|
|
<p>
|
|
Still in the /root directory do:
|
|
</p>
|
|
|
|
<pre>
|
|
# dpkg-scanpackages debs <var>file</var> | gzip > debs/Packages.gz
|
|
</pre>
|
|
|
|
<p>
|
|
In the above line, <var>file</var> is the <samp>override</samp> file, the
|
|
command generates a file <code>Packages.gz</code> that contains various
|
|
information about the packages, which are used by APT. To use the packages,
|
|
finally, add:
|
|
</p>
|
|
|
|
<pre>
|
|
deb file:/root debs/
|
|
</pre>
|
|
|
|
<p>
|
|
After that just use the APT commands as usual. You may also generate a sources
|
|
repository. To do that use the same procedure, but remember that you need to
|
|
have the files <samp>.orig.tar.gz</samp>, <samp>.dsc</samp> and
|
|
<samp>.diff.gz</samp> in the directory and you have to use
|
|
<samp>Sources.gz</samp> instead of <samp>Packages.gz</samp>. The program used
|
|
is also different. It is <code>dpkg-scansources</code>. The command line will
|
|
look like this:
|
|
</p>
|
|
|
|
<pre>
|
|
# dpkg-scansources debs | gzip > debs/Sources.gz
|
|
</pre>
|
|
|
|
<p>
|
|
Notice that <code>dpkg-scansources</code> doesn't need an <samp>override</samp>
|
|
file. The sources.list's line is:
|
|
</p>
|
|
|
|
<pre>
|
|
deb-src file:/root debs/
|
|
</pre>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-netselect"></a>2.3 Deciding which mirror is the best to include in the sources.list file: netselect, netselect-apt</h2>
|
|
|
|
<p>
|
|
A very frequent doubt, mainly among the newest users is: "which Debian
|
|
mirror to include in <samp>sources.list</samp>?". There are many ways to
|
|
decide which mirror. The experts probably have a script that measures the ping
|
|
time through the several mirrors. But there's a program that does this for us:
|
|
<strong>netselect</strong>.
|
|
</p>
|
|
|
|
<p>
|
|
To install netselect, as usual:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get install netselect
|
|
</pre>
|
|
|
|
<p>
|
|
Executing it without parameters shows the help. Executing it with a
|
|
space-separated list of hosts (mirrors), it will return a score and one of the
|
|
hosts. This score takes in consideration the estimated ping time and the hops
|
|
(hosts by which a network query will pass by to reach the destination) number
|
|
and is inversely proportional to the estimated download speed (so, the lower,
|
|
the better). The returned host is the one that had the lowest score (the full
|
|
list of scores can be seen adding the -vv option). See this example:
|
|
</p>
|
|
|
|
<pre>
|
|
# netselect ftp.debian.org http.us.debian.org ftp.at.debian.org download.unesp.br ftp.debian.org.br
|
|
365 ftp.debian.org.br
|
|
#
|
|
</pre>
|
|
|
|
<p>
|
|
This means that, from the mirrors included as parameters to netselect,
|
|
<samp>ftp.debian.org.br</samp> was the best, with an score of 365.
|
|
(Attention!! As it was done on my computer and the network topography is
|
|
extremely different depending on the contact point, this value is not
|
|
necessarily the right speed in other computers).
|
|
</p>
|
|
|
|
<p>
|
|
Now, just put the fastest mirror found by netselect in the
|
|
<samp>/etc/apt/sources.list</samp> file (see <a href="#s-sources.list">The
|
|
/etc/apt/sources.list file, Section 2.1</a>) and follow the tips in <a
|
|
href="ch-apt-get.en.html">Managing packages, Chapter 3</a>.
|
|
</p>
|
|
|
|
<p>
|
|
<strong>Note:</strong> the list of mirrors may always be found in the file
|
|
<code><a
|
|
href="http://www.debian.org/mirror/mirrors_full">http://www.debian.org/mirror/mirrors_full</a></code>.
|
|
</p>
|
|
|
|
<p>
|
|
Beginning with the 0.3.ds1 version, the netselect source package includes the
|
|
<strong>netselect-apt</strong> binary package, which makes the process above
|
|
automatic. Just enter the distribution tree as parameter (the default is
|
|
stable) and the <samp>sources.list</samp> file will be generated with the best
|
|
main and non-US mirrors and will be saved under the current directory. The
|
|
following example generates a sources.list of the stable distribution:
|
|
</p>
|
|
|
|
<pre>
|
|
# ls sources.list
|
|
ls: sources.list: File or directory not found
|
|
# netselect-apt stable
|
|
(...)
|
|
# ls -l sources.list
|
|
sources.list
|
|
#
|
|
</pre>
|
|
|
|
<p>
|
|
<strong>Remember:</strong> the <samp>sources.list</samp> file is generated
|
|
under the current directory, and must be moved to the <samp>/etc/apt</samp>
|
|
directory.
|
|
</p>
|
|
|
|
<p>
|
|
Then, follow the tips in <a href="ch-apt-get.en.html">Managing packages,
|
|
Chapter 3</a>.
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-cdrom"></a>2.4 Adding a CD-ROM to the sources.list file</h2>
|
|
|
|
<p>
|
|
If you'd rather use your CD-ROM for installing packages or updating your system
|
|
automatically with APT, you can put it in your <samp>sources.list</samp>. To
|
|
do so, you can use the <code>apt-cdrom</code> program like this:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-cdrom add
|
|
</pre>
|
|
|
|
<p>
|
|
with the Debian CD-ROM in the drive. It will mount the CD-ROM, and if it's a
|
|
valid Debian CD it will look for package information on the disk. If your
|
|
CD-ROM configuration is a little unusual, you can also use the following
|
|
options:
|
|
</p>
|
|
|
|
<pre>
|
|
-h - program help
|
|
-d directory - CD-ROM mount point
|
|
-r - Rename a recognized CD-ROM
|
|
-m - No mounting
|
|
-f - Fast mode, don't check package files
|
|
-a - Thorough scan mode
|
|
</pre>
|
|
|
|
<p>
|
|
For example:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-cdrom -d /home/kov/mycdrom add
|
|
</pre>
|
|
|
|
<p>
|
|
You can also identify a CD-ROM, without adding it to your list:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-cdrom ident
|
|
</pre>
|
|
|
|
<p>
|
|
Note that this program only works if your CD-ROM is properly configured in your
|
|
system's <samp>/etc/fstab</samp>.
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<p>
|
|
[ <a href="ch1.en.html">previous</a> ]
|
|
[ <a href="index.en.html#contents">Contents</a> ]
|
|
[ <a href="ch1.en.html">1</a> ]
|
|
[ 2 ]
|
|
[ <a href="ch-apt-get.en.html">3</a> ]
|
|
[ <a href="ch-helpers.en.html">4</a> ]
|
|
[ <a href="ch-search.en.html">5</a> ]
|
|
[ <a href="ch-sourcehandling.en.html">6</a> ]
|
|
[ <a href="ch-erros.en.html">7</a> ]
|
|
[ <a href="ch-distros.en.html">8</a> ]
|
|
[ <a href="ch-agradecimentos.en.html">9</a> ]
|
|
[ <a href="ch-novas.en.html">10</a> ]
|
|
[ <a href="ch-apt-get.en.html">next</a> ]
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<p>
|
|
APT HOWTO (Obsolete Documentation)
|
|
</p>
|
|
|
|
<address>
|
|
1.8.11 - August 2005<br>
|
|
<br>
|
|
Gustavo Noronha Silva <code><a href="mailto:kov@debian.org">kov@debian.org</a></code><br>
|
|
<br>
|
|
</address>
|
|
<hr>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|