Difference between revisions of "Debian Package Management"

From FreekiWiki
Jump to navigation Jump to search
(stub for package management class)
 
(- {{stub}})
 
(12 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{stub}}
+
This class should outline the basics of debian package management- searching,
 +
installing, updating and removing software.
  
this class should outline the basics of debian package management- searching, installing, updating and removing
+
===background===
software.
+
====prerequisites====
 +
* basic familiarity with [[Basic_Linux_Command_Line_for_Builders|commandline]] and [[Command Line 2]]
 +
* basic familiarity with [[Where_Is_Everything|linux]]
  
specifics should include things such as apt, aptitude, dpkg and synaptic.
+
<!--- ====suggested background====
 +
 
 +
===terms=== --->
 +
 
 +
===tips for working environment===
 +
* keep a web browser pointed to this page
 +
* open several terminal windows
 +
* don't forget to use the "man" command, or -h and --help
 +
* commandline reminders
 +
** remember to use tab completion.
 +
** hit tab twice, fast.
 +
** hit tab again!
 +
** remember to use the up arrow to re-do a previous command
 +
** keep hitting tab!
 +
 
 +
===topics covered===
 +
====apt====
 +
[http://packages.debian.org/apt apt]
 +
 
 +
=====available packages=====
 +
 
 +
where to get software from, /etc/apt/sources.list:
 +
 
 +
deb http://debian.oregonstate.edu/debian sarge main
 +
deb-src http://debian.oregonstate.edu/debian sarge main
 +
 
 +
lines that begin with "deb-src" are for source packages. unless you're building
 +
packages from source, you can usually comment these out. lines that begin with
 +
"deb" contain sources of debian packages.
 +
 
 +
update the list of available packages(do this after changing sources.list):
 +
 
 +
apt-get update
 +
 
 +
look in /var/lib/apt/lists, to see all the packaging files:
 +
 
 +
ls /var/lib/apt/lists/
 +
 
 +
take a look at what those files contain:
 +
 
 +
less /var/lib/apt/lists/*Packages
 +
 
 +
=====upgrading packages=====
 +
 
 +
upgrade packages:
 +
 
 +
apt-get upgrade
 +
 
 +
do a more thorough upgrade:
 +
 
 +
apt-get dist-upgrade
 +
 
 +
=====searching=====
 +
 
 +
* search for software:
 +
 
 +
apt-cache search browser
 +
apt-cache search firefox
 +
 
 +
* display information about a package:
 +
 
 +
apt-cache show mozilla-firefox
 +
 
 +
* show available versions of a package:
 +
 
 +
apt-cache policy mozilla-firefox
 +
 
 +
=====installing and removing packages=====
 +
 
 +
* install a package:
 +
 
 +
apt-get install mozilla-firefox
 +
 
 +
* remove a package:
 +
 
 +
apt-get remove mozilla-firefox
 +
 
 +
=====maintenance=====
 +
 
 +
/var/cache/apt/archives can build up a lot of cruft...
 +
 
 +
* only clear out package files no longer available:
 +
 
 +
apt-get autoclean
 +
 
 +
* clear out all downloaded package files:
 +
 
 +
apt-get clean
 +
 
 +
=====useful commandline arguments=====
 +
 
 +
* download only:
 +
 
 +
apt-get -d install mozilla-firefox
 +
 
 +
* display upgraded packages:
 +
 
 +
apt-get -u dist-upgrade
 +
 
 +
* automatically proceed (i.e. answer yes; be careful with this!), display upgraded packages, and download them:
 +
 
 +
apt-get -yud dist-upgrade
 +
 
 +
* remove all traces of the package on the system (a "normal" remove leaves behind configuration files)
 +
 
 +
apt-get --purge remove mozilla-firefox
 +
 
 +
=====pinning=====
 +
 
 +
pinning: /etc/apt/preferences
 +
 
 +
====aptitude====
 +
[http://packages.debian.org/aptitude aptitude]
 +
 
 +
similar to apt, but more sophisticated.
 +
 
 +
if called without arguments, it brings up a text-based menu system. you should
 +
be able to do nearly everything you can do with apt-get in this menu.
 +
 
 +
=====same old commands=====
 +
 
 +
the following commands are very similar to their corresponding apt-get or
 +
apt-cache commands:
 +
 
 +
update, upgrade, dist-upgrade, remove, install, show, search, autoclean, clean
 +
 
 +
=====more features=====
 +
 
 +
* purge (like apt-get --purge remove)
 +
 
 +
aptitude purge mozilla-firefox
 +
 
 +
* changelog
 +
 
 +
aptitude changelog mozilla-firefox
 +
 
 +
* download
 +
* hold
 +
* markauto
 +
* unmarkauto
 +
 
 +
====dpkg====
 +
underneath it all, lies [http://packages.debian.org/dpkg dpkg]
 +
 
 +
list status of installed packages:
 +
 
 +
dpkg -l
 +
 
 +
another way to list the status of packages:
 +
 
 +
dpkg --get-selections
 +
 
 +
list the files in a package:
 +
 
 +
dpkg -L mozilla-firefox
 +
 
 +
find out which package owns a certain file:
 +
 
 +
dpkg -S /bin/bash
 +
 
 +
install a package without using apt or aptitude(this does no dependency
 +
resolution- so avoid if at all possible):
 +
 
 +
dpkg -i hackme-script-foo_0.0.1_i386.deb
 +
 
 +
====synaptic====
 +
[http://packages.debian.org/synaptic synaptic]
 +
 
 +
it's graphical. point and click your way to carpal tunnel.
 +
 
 +
====other useful tools====
 +
 
 +
* http://packages.debian.org (http://packages.debian.org/PACKAGENAME)
 +
* [http://packages.debian.org/deborphan deborphan]
 +
* [http://packages.debian.org/apt-listchanges apt-listchanges]
 +
* [http://packages.debian.org/apt-listbugs apt-listbugs]
 +
* [http://packages.debian.org/cron-apt cron-apt]
  
 
[[Category:Classes]]
 
[[Category:Classes]]

Latest revision as of 13:14, 30 September 2007

This class should outline the basics of debian package management- searching, installing, updating and removing software.

background

prerequisites


tips for working environment

  • keep a web browser pointed to this page
  • open several terminal windows
  • don't forget to use the "man" command, or -h and --help
  • commandline reminders
    • remember to use tab completion.
    • hit tab twice, fast.
    • hit tab again!
    • remember to use the up arrow to re-do a previous command
    • keep hitting tab!

topics covered

apt

apt

available packages

where to get software from, /etc/apt/sources.list:

deb http://debian.oregonstate.edu/debian sarge main
deb-src http://debian.oregonstate.edu/debian sarge main

lines that begin with "deb-src" are for source packages. unless you're building packages from source, you can usually comment these out. lines that begin with "deb" contain sources of debian packages.

update the list of available packages(do this after changing sources.list):

apt-get update

look in /var/lib/apt/lists, to see all the packaging files:

ls /var/lib/apt/lists/

take a look at what those files contain:

less /var/lib/apt/lists/*Packages
upgrading packages

upgrade packages:

apt-get upgrade

do a more thorough upgrade:

apt-get dist-upgrade
searching
  • search for software:
apt-cache search browser
apt-cache search firefox
  • display information about a package:
apt-cache show mozilla-firefox
  • show available versions of a package:
apt-cache policy mozilla-firefox
installing and removing packages
  • install a package:
apt-get install mozilla-firefox
  • remove a package:
apt-get remove mozilla-firefox
maintenance

/var/cache/apt/archives can build up a lot of cruft...

  • only clear out package files no longer available:
apt-get autoclean
  • clear out all downloaded package files:
apt-get clean
useful commandline arguments
  • download only:
apt-get -d install mozilla-firefox
  • display upgraded packages:
apt-get -u dist-upgrade
  • automatically proceed (i.e. answer yes; be careful with this!), display upgraded packages, and download them:
apt-get -yud dist-upgrade
  • remove all traces of the package on the system (a "normal" remove leaves behind configuration files)
apt-get --purge remove mozilla-firefox
pinning

pinning: /etc/apt/preferences

aptitude

aptitude

similar to apt, but more sophisticated.

if called without arguments, it brings up a text-based menu system. you should be able to do nearly everything you can do with apt-get in this menu.

same old commands

the following commands are very similar to their corresponding apt-get or apt-cache commands:

update, upgrade, dist-upgrade, remove, install, show, search, autoclean, clean

more features
  • purge (like apt-get --purge remove)
aptitude purge mozilla-firefox
  • changelog
aptitude changelog mozilla-firefox
  • download
  • hold
  • markauto
  • unmarkauto

dpkg

underneath it all, lies dpkg

list status of installed packages:

dpkg -l

another way to list the status of packages:

dpkg --get-selections

list the files in a package:

dpkg -L mozilla-firefox

find out which package owns a certain file:

dpkg -S /bin/bash

install a package without using apt or aptitude(this does no dependency resolution- so avoid if at all possible):

dpkg -i hackme-script-foo_0.0.1_i386.deb

synaptic

synaptic

it's graphical. point and click your way to carpal tunnel.

other useful tools