guide.sgml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. <!doctype debiandoc system>
  2. <!-- -*- mode: sgml; mode: fold -*- -->
  3. <book>
  4. <title>APT User's Guide</title>
  5. <author>Jason Gunthorpe <email>jgg@debian.org</email></author>
  6. <version>$Id: guide.sgml,v 1.1 1998/07/02 02:58:12 jgg Exp $</version>
  7. <abstract>
  8. This document provides an overview of how to use the the APT package manager.
  9. </abstract>
  10. <copyright>
  11. Copyright &copy; Jason Gunthorpe, 1998.
  12. <p>
  13. "APT" and this document are free software; you can redistribute them and/or
  14. modify them under the terms of the GNU General Public License as published
  15. by the Free Software Foundation; either version 2 of the License, or (at your
  16. option) any later version.
  17. <p>
  18. For more details, on Debian GNU/Linux systems, see the file
  19. /usr/doc/copyright/GPL for the full license.
  20. </copyright>
  21. <toc sect>
  22. <!-- General {{{ -->
  23. <!-- ===================================================================== -->
  24. <chapt>General
  25. <p>
  26. The APT package currently contains two sections, the APT <prgn>dselect</>
  27. method and the <prgn>apt-get</> command line user interface. Both provide
  28. a way to install and remove packages as well as download new packages from
  29. the Internet.
  30. <sect>Anatomy of the Package System
  31. <p>
  32. The Debian packaging system has a large amount of information associated with
  33. each package to help assure that it integrates cleanly and easily into
  34. the system. The most prominent of features is the dependency system.
  35. <p>
  36. The dependency system allows individual programs to make use of shared
  37. elements in the system such as libraries. It simplifies placing infrequently
  38. used portions of a program in separate packages to reduce the
  39. number of things the average user is required to install. Also, it allows
  40. a choices in for such things as mail transport agents, X servers and
  41. so on.
  42. <p>
  43. The first step to understanding the dependency system is to grasp the concept
  44. of a simple dependency. The meaning of a simple dependency is that a package
  45. requires another package to be installed at the same time to work properly.
  46. <p>
  47. For instance, mail-crypt is an emacs extension that aids in encrypting email
  48. with PGP. Without PGP installed mail-crypt is useless, so mail-crypt has a
  49. simple dependency on PGP. Also, because it is an emacs extension it has a
  50. simple dependency on emacs, without emacs it is completely useless.
  51. <p>
  52. The other important dependency to understand is a conflicting dependency. It
  53. means that a package, when installed with another package, will not work and
  54. may possibly be extremely harmful to the system. As an example consider a
  55. mail transport agent such as sendmail, exim or qmail. It is not possible
  56. to have two mail transport agents installed because both need to listen to
  57. the network to receive mail. Attempting to install two will seriously
  58. damage the system so all mail transport agents have a conflicting dependency
  59. with all other mail transport agents.
  60. <p>
  61. As an added complication there is the possibility for a package to pretend
  62. to be another package. Consider that exim and sendmail for many intents are
  63. identical, they both deliver mail and understand a common interface. Hence,
  64. the package system has a way for them to declare that they are both
  65. mail-transport-agents. So, exim and sendmail both declare that they provide a
  66. mail-transport-agent and other packages that need a mail transport agent
  67. depend on mail-transport-agent. This can add a great deal of confusion when
  68. trying to manually fix packages.
  69. <p>
  70. At any given time a single dependency may be met by packages that are already
  71. installed or it may not be. APT attempts to help resolve dependency issues
  72. by providing a number of automatic algorithms that help in selecting packages
  73. for installation.
  74. </sect>
  75. </chapt>
  76. <!-- }}} -->
  77. <!-- apt-get {{{ -->
  78. <!-- ===================================================================== -->
  79. <chapt>apt-get
  80. <p>
  81. <prgn>apt-get</> provides a simple way to install packages from the command
  82. line. Unlike <prgn>dpkg</>, <prgn>apt-get</> does not understand .deb files,
  83. it works with the packages proper name and can only install .deb archives from
  84. a <em>Source</>.
  85. <p>
  86. The first <footnote>If you are using an http proxy server you must set the
  87. http_proxy environment variable first, see sources.list(5)</footnote> thing that
  88. should be done before using <prgn>apt-get</> is to fetch the package lists
  89. from the <em>Sources</> so that it knows what packages are
  90. available. This is done with <tt>apt-get update</>. For instance,
  91. <p>
  92. <example>
  93. # apt-get update
  94. Get http://ftp.de.debian.org/debian-non-US/ stable/binary-i386/ Packages
  95. Get http://llug.sep.bnl.gov/debian/ frozen/contrib Packages
  96. Updating package file cache...done
  97. Updating package status cache...done
  98. Checking system integrity...ok
  99. </example>
  100. <p>
  101. Once updated there are several useful commands that can be used,
  102. <taglist>
  103. <tag>upgrade<item>
  104. Upgrade will attempt to gently upgrade the whole system. Upgrade will
  105. never install a new package or remove an existing package, nor will it
  106. ever upgrade a package that might cause some other package to break.
  107. This can be used daily to relatively safely upgrade the system. Upgrade
  108. will list all of the packages that it could not upgrade, this usually
  109. means that they depend on new packages or conflict with some other package.
  110. <prgn>Dselect</> or <tt>apt-get install</> can be used to force these
  111. packages to install.
  112. <tag>install<item>
  113. Install is used to install single packages by name. The package is
  114. automatically fetched and installed. This can be useful if you already
  115. know the name of the package to install and do not want to go into a GUI
  116. to select it. Any number of packages may be passed to install, they will
  117. all be fetched. Install automatically attempts to resolve dependency problems
  118. with the listed packages and will print a summary and ask for confirmation
  119. if anything other than it's arguments are changed
  120. <tag>dist-upgrade<item>
  121. Dist-upgrade is a complete upgrader designed to make simple upgrading between
  122. releases of Debian. It uses a sophisticated algorithm to determine the best
  123. set of packages to install, upgrade and remove to get as much of the system
  124. to the newest release. In some situations it may be desired to use dist-upgrade
  125. rather than spend the time manually resolving dependencies in <prgn>dselect</>.
  126. Once dist-upgrade has completed then <prgn>dselect</> can be used to install
  127. any packages that may have been left out.
  128. <p>
  129. It is important to closely look at what dist-upgrade is going to do, its
  130. decisions may sometimes be quite surprising.
  131. </taglist>
  132. <p>
  133. <prgn>apt-get</> has several command line options that are detailed in it's
  134. man page, <manref name="apt-get" section="8">. The most useful option is
  135. <tt>-d</> which does not install the fetched files. If the system has to
  136. download a large number of package it would be undesired to start installing
  137. them in case something goes wrong. When <tt>-d</> is used the downloaded
  138. archives can be installed by simply running the command that caused them to
  139. be downloaded again without <tt>-d</>.
  140. </chapt>
  141. <!-- }}} -->
  142. <!-- DSelect {{{ -->
  143. <!-- ===================================================================== -->
  144. <chapt>DSelect
  145. <p>
  146. The APT <prgn>dselect</> method provides the complete APT system with
  147. the <prgn>dselect</> package selection GUI. <prgn>dselect</> is used to
  148. select the packages to be installed or removed and APT actually installs them.
  149. <p>
  150. To enable the APT method you need to to select [A]ccess in <prgn>dselect</>
  151. and then choose the APT method. You will be prompted for a set of
  152. <em>Sources</> which are places to fetch archives from. These can be remote
  153. Internet sites, local Debian mirrors or CDROMs. Each source can provide
  154. a fragment of the total Debian archive, APT will automatically combine them
  155. to form a complete set of packages. If you have a CDROM then it is a good idea
  156. to specify it first and then specify a mirror so that you have access to
  157. the latest bug fixes. APT will automatically use packages on your CDROM before
  158. downloading from the Internet.
  159. <p>
  160. <example>
  161. Set up a list of distribution source locations
  162. Please give the base URL of the debian distribution.
  163. The access schemes I know about are: http file
  164. For example:
  165. file:/mnt/debian,
  166. ftp://ftp.debian.org/debian,
  167. http://ftp.de.debian.org/debian,
  168. URL [http://llug.sep.bnl.gov/debian]:
  169. </example>
  170. <p>
  171. The <em>Sources</> setup starts by asking for the base of the Debian
  172. archive, defaulting to a HTTP mirror. Next it asks for the distribution to
  173. get.
  174. <p>
  175. <example>
  176. Please give the distribution tag to get or a path to the
  177. package file ending in a /. The distribution
  178. tags are typically something like: stable unstable frozen non-US
  179. Distribution [stable]:
  180. </example>
  181. <p>
  182. The distribution refers to the Debian version in the archive, <em>stable</>
  183. refers to the latest released version and <em>unstable</> refers to the
  184. developmental version. <em>non-US</> is only available on some mirrors and
  185. refers to packages that contain encryption technology or other things that
  186. cannot be exported from the United States. Importing these packages into the
  187. US is legal however.
  188. <footnote>As of this writing the non-US distribution has
  189. not been created, the only way to access it is by specifying
  190. stable/binary-i386/ at this prompt and by specifying a URL ending in
  191. debian-non-US </footnote>
  192. <p>
  193. <example>
  194. Please give the components to get
  195. The components are typically something like: main contrib non-free
  196. Components [main contrib non-free]:
  197. </example>
  198. <p>
  199. The components list refers to the list of sub distributions to fetch. The
  200. distribution is split up based on software copyright, main being DFSG free
  201. packages while contrib and non-free contain things that have various
  202. restrictions placed on their use and distribution.
  203. <p>
  204. Any number of sources can be added, the setup script will continue to
  205. prompt until you have specified all that you want.
  206. <p>
  207. Before starting to use <prgn>dselect</> it is necessary to update the
  208. available list by selecting [U]pdate from the menu. This is a super-set of
  209. <tt>apt-get update</> that makes the fetched information available to
  210. <prgn>dselect</>. [U]pdate must be performed even if <tt>apt-get update</>
  211. has been run before.
  212. <p>
  213. You can then go on and make your selections using [S]elect and then
  214. perform the installation using [I]nstall. When using the APT method
  215. the [C]onfig and [R]emove commands have no meaning, the [I]nstall command
  216. performs both of them together.
  217. </chapt>
  218. <!-- }}} -->
  219. <!-- The Interfaces {{{ -->
  220. <!-- ===================================================================== -->
  221. <chapt>The Interface
  222. <p>
  223. Both that APT <prgn>dselect</> method and <prgn>apt-get</> share the same
  224. interface. It is a simple system that generally tells you what it will do
  225. and then goes and does it.
  226. <footnote>
  227. The <prgn>dselect</> method actually is a set of wrapper scripts
  228. to <prgn>apt-get</>. The method actually provides more functionality than
  229. is present in <prgn>apt-get</> alone.
  230. </footnote>
  231. After printing out a summary of what will happen APT then will print out some
  232. informative status messages so that you can estimate how far along it is and
  233. how much is left to do.
  234. <!-- ===================================================================== -->
  235. <sect>The Pre-Checks
  236. <p>
  237. Before all operations, except update, APT performs a number of checks on the
  238. systems. These are designed to safe guard the operations it is about to
  239. undertake. At any time the full set of checks may be run by performing
  240. <tt>apt-get check</>.
  241. <p>
  242. <example>
  243. # apt-get check
  244. Updating package file cache...done
  245. Updating package status cache...done
  246. Checking system integrity...ok
  247. </example>
  248. <p>
  249. The first check is to ensure that the archive package lists are matched to
  250. the pre-generated data cache, if they are not then the cache is automatically
  251. refreshed. This may fail if <tt>apt-get update</> has not been run to
  252. synchronize with the <em>Sources</>. The next check verifies that the state of
  253. the system matches the cached state and automatically rebuilds the cached
  254. state if they are not synchronized. This check should never fail and it
  255. indicates a serious error if it ever does.
  256. <p>
  257. The final check performs a detailed analysis of the system integrity. It
  258. checks every dependency of every installed or unpacked package and considers
  259. if it is ok. Should this find a problem then a report will be printed out and
  260. <prgn>apt-get</> will refuse to run.
  261. <p>
  262. <example>
  263. # apt-get check
  264. Updating package file cache...done
  265. Updating package status cache...done
  266. Checking system integrity...dependency error
  267. You might want to run apt-get -f install' to correct these.
  268. Sorry, but the following packages are broken - this means they have unmet
  269. dependencies:
  270. libdbd-mysql-perl: Depends:perl
  271. xzx: Depends:xlib6
  272. libdbd-msql-perl: Depends:perl
  273. mailpgp: Depends:pgp-i Depends:pgp-us
  274. xdpkg: Depends:python
  275. squake: Depends:quake-lib Depends:quake-lib-stub
  276. debmake: Depends:fileutils
  277. libreadlineg2: Conflicts:libreadline2
  278. ssh: Depends:gmp2 Depends:xlib6g Depends:zlib1g
  279. </example>
  280. <p>
  281. In this example the system has many problems, including a serious problem
  282. with libreadlineg2. For each package that has unmet dependencies a line
  283. is printed out indicating the package with the problem and the dependencies
  284. that are unmet. For brevity the version inter-relationships are omitted.
  285. <p>
  286. There are two ways a system can get into a broken state like this. The
  287. first is caused by <prgn>dpkg missing</> some subtle relationships between
  288. packages when performing upgrades. <footnote>APT however considers all known
  289. dependencies and attempts to prevent broken packages</footnote>. The second is
  290. if a package installation fails during an operation. In this situation a
  291. package may have been unpacked without its dependents being installed.
  292. <p>
  293. The second situation is much less serious than the first because APT places
  294. certain assurances on the order that packages are installed. In both cases
  295. supplying the <tt>-f</> option to <prgn>atp-get</> will cause APT to deduce a
  296. possible solution to the problem and then continue on. The APT <prgn>dselect</>
  297. method always supplies the <tt>-f</> option to allow for easy continuation
  298. of failed maintainer scripts.
  299. <p>
  300. However, if the <tt>-f</> option is used to correct a seriously broken system
  301. caused by the first case then it is possible that it will either fail
  302. immediately or the installation sequence will fail. In either case it is
  303. necessary to manually use dpkg (possibly with forcing options) to correct
  304. the situation enough to allow APT to proceed.
  305. </sect>
  306. <!-- ===================================================================== -->
  307. <sect>The Status Report
  308. <p>
  309. Before proceeding <prgn>apt-get</> will present a report on what will happen.
  310. Generally the report reflects the type of operation being performed but there
  311. are several common elements. In all cases the lists reflect the final state
  312. of things, taking into account the <tt>-f</> option and any other relevant
  313. activities to the command being executed.
  314. <sect1>The Extra Package list
  315. <p>
  316. <example>
  317. The following extra packages will be installed:
  318. libdbd-mysql-perl xlib6 zlib1 xzx libreadline2 libdbd-msql-perl
  319. mailpgp xdpkg fileutils pinepgp zlib1g xlib6g perl-base
  320. bin86 libgdbm1 libgdbmg1 quake-lib gmp2 bcc xbuffy
  321. squake pgp-i python-base debmake ldso perl libreadlineg2
  322. ssh
  323. </example>
  324. <p>
  325. The Extra Package list shows all of the packages that will be installed
  326. or upgraded in excess of the ones mentioned on the command line. It is
  327. only generated for an <tt>install</> command. The listed packages are
  328. often the result of an Auto Install.
  329. </sect1>
  330. <sect1>The Packages to Remove
  331. <p>
  332. <example>
  333. The following packages will be REMOVED:
  334. xlib6-dev xpat2 tk40-dev xkeycaps xbattle xonix
  335. xdaliclock tk40 tk41 xforms0.86 ghostview xloadimage xcolorsel
  336. xadmin xboard perl-debug tkined xtetris libreadline2-dev perl-suid
  337. nas xpilot xfig
  338. </example>
  339. <p>
  340. The Packages to Remove list shows all of the packages that will be
  341. removed from the system. It can be shown for any of the operations and
  342. should be given a careful inspection to ensure nothing important is to
  343. be taken off. The <tt>-f</> option is especially good at generating packages
  344. to remove so extreme care should be used in that case. The list may contain
  345. packages that are going to be removed because they are only
  346. partially removed, possibly due to an aborted installation.
  347. </sect1>
  348. <sect1>The New Packages list
  349. <p>
  350. <example>
  351. The following NEW packages will installed:
  352. zlib1g xlib6g perl-base libgdbmg1 quake-lib gmp2 pgp-i python-base
  353. </example>
  354. <p>
  355. The New Packages list is simply a reminder of what will happen. The packages
  356. listed are not presently installed in the system but will be when APT is done.
  357. </sect1>
  358. <sect1>The Kept Back list
  359. <p>
  360. <example>
  361. The following packages have been kept back
  362. compface man-db tetex-base msql libpaper svgalib1
  363. gs snmp arena lynx xpat2 groff xscreensaver
  364. </example>
  365. <p>
  366. Whenever the whole system is being upgraded there is the possibility that
  367. new versions of packages cannot be installed because they require new things
  368. or conflict with already installed things. In this case the package will
  369. appear in the Kept Back list. The best way to convince packages listed
  370. there to install is with <tt>apt-get install</> or by using <prgn>dselect</>
  371. to resolve their problems.
  372. </sect1>
  373. <sect1>Held Packages warning
  374. <p>
  375. <example>
  376. The following held packages will be changed:
  377. cvs
  378. </example>
  379. <p>
  380. Sometimes you can ask APT to install a package that is on hold, in such a
  381. case it prints out a warning that the held package is going to be
  382. changed. This should only happen during dist-upgrade or install.
  383. </sect1>
  384. <sect1>Final summary
  385. <p>
  386. Finally, APT will print out a summary of all the changes that will occur.
  387. <p>
  388. <example>
  389. 206 packages upgraded, 8 newly installed, 23 to remove and 51 not upgraded.
  390. 12 packages not fully installed or removed.
  391. Need to get 65.7M/66.7M of archives. After unpacking 26.5M will be used.
  392. </example>
  393. <p>
  394. The first line of the summary simply is a reduced version of all of the
  395. lists and includes the number of upgrades - that is packages already
  396. installed that have new versions available. The second line indicates the
  397. number of poorly configured packages, possibly the result of an aborted
  398. installation. The final line shows the space requirements that the
  399. installation needs. The first pair of numbers refer to the size of
  400. the archive files. The first number indicates the number of bytes that
  401. must be fetched from remote locations and the second indicates the
  402. total size of all the archives required. The next number indicates the
  403. size difference between the presently installed packages and the newly
  404. installed packages. It is roughly equivalent to the space required in
  405. /usr after everything is done. If a large number of packages are being
  406. removed then the value may indicate the amount of space that will be
  407. freed.
  408. </sect>
  409. <!-- ===================================================================== -->
  410. <sect>The Status Display
  411. <p>
  412. During the download of archives and package files APT prints out a series of
  413. status messages,
  414. <p>
  415. <example>
  416. # apt-get update
  417. Get http://ftp.de.debian.org/debian-non-US/ stable/binary-i386/ Packages
  418. Get http://llug.sep.bnl.gov/debian/ frozen/contrib Packages
  419. Get http://llug.sep.bnl.gov/debian/ frozen/main Packages
  420. Get http://ftp.de.debian.org/debian-non-US/ unstable/binary-i386/ Packages
  421. Get http://llug.sep.bnl.gov/debian/ frozen/non-free Packages
  422. 11% [Packages `Waiting for file' 0/32.1k 0%] 2203b/s 1m52s
  423. </example>
  424. <p>
  425. The lines starting with <em>Get</> are printed out when APT begins to fetch
  426. a file while the last line indicates the progress of the download. The first
  427. percent value on the progress line indicates the total percent done of all
  428. files. Unfortunately since the size of the Package files is unknown
  429. <tt>apt-get update</> estimates the percent done which causes some
  430. inaccuracies.
  431. <p>
  432. The next section of the status line is repeated once for each dowload thread
  433. and indicates the operation being performed and some usefull information
  434. about what is happening. Sometimes this section will simply read <em>Forking</>
  435. which means the OS is loading the download module. The first word after the [
  436. is the short form name of the object being downloaded. For archives it will
  437. contain the name of the package that is being fetched.
  438. <p>
  439. Inside of the single quote is an informative string indicating the progress
  440. of the negotiation phase of the download. Typically it progresses from
  441. <em>Connecting</> to <em>Waiting for file</> to <em>Downloading</> or
  442. <em>Resuming</>. The final value is the number of bytes downloaded from the
  443. remote site. Once the download beings this is represented as <tt>102/10.2k</>
  444. indicating that 102 bytes have been fetched and 10.2 kilobytes is expected.
  445. The total size is always shown in 4 figure notation to preserve space. After
  446. the size display is a percent meter for the file itself.
  447. The second last element is the instantenous average speed. This values is
  448. updated every 5 seconds and reflects the rate of data transfer for that
  449. period. Finally is shown the estimated transfer time. This is updated
  450. regularly and reflects the time to complete everything at the shown
  451. transfer rate.
  452. <p>
  453. The status display updates every half second to provide a constant feedback
  454. on the download progress while the Get lines scroll back whenever a new
  455. file is started. Since the status display is constantly updated it is
  456. unsuitable for logging to a file, use the <tt>-q</> option to remove the
  457. status display.
  458. </sect>
  459. <!-- ===================================================================== -->
  460. <sect>Dpkg
  461. <p>
  462. APT uses <prgn>dpkg</> for installing the archives and will switch
  463. over to the <prgn>dpkg</> interface once downloading is completed.
  464. <prgn>dpkg</> will also as a number of questions as it processes the packages
  465. and the packages themselves may also ask several questions. Before each
  466. question there is usually a description of what it is asking and the
  467. questions are too varied to discuss completely here.
  468. </sect>
  469. </chapt>
  470. <!-- }}} -->
  471. </book>