[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

apt mini-intro



a friend-o-mine just got up with debian 2.2/potato, and i crafted
this little intro to apt-get... your comments are welcome.

i indent using tabs (the One True Way) so feel free to set your
tabstops (vi, use :set ts=4) wherever you feel comfortable --
mine are set at 4:


# written by will trillich <will@dontUthink.com>
# 2000 oct 19, thurs

DEBIAN'S ADVANCED PACKAGE TOOL -- apt

	debian uses a cool packaging system that takes care of
	dependencies for you -- packageA may require packageB, which
	requires packageC, and the Advanced Package Tool (apt) will
	take care of installing packageC and packageB if you request
	packageA. very nice!

	to see what apt-* commands you have available, try this:
	type 'apt' at the command prompt of your shell, and then
	press CONTROL-D... most shells will then display for you all
	the commands (avilable on your $PATH list) that start with
	those letters. a great way to find useful nuggets!


SETUP -- Advanced Package Tool (apt)

	this little gizmo sets up the configuration file for you:

		apt-setup

	it asks you some questions and winds up configuring your
	/etc/apt/sources.list file, which is used by the apt
	utilities to download and upgrade packages on your debian
	system.

	/etc/apt/sources.list is the file that tells your
	AdvancedPackageTool (apt) where to look when you want to
	update current packages or install new ones.

	try

		man sources.list

	to learn about the format of this file.  for a list of
	debian mirrors to use in sources.list, try

		http://www.debian.org/misc/README.mirrors

	or just re-run the apt-setup utility.

	NOTE -- keep in mind that debian is a work-in-progress,
	meaning that as holes are found and bugs are kilt in the
	stable distribution, a whole new world is developing on the
	UNSTABLE distribution. if you need something from 'unstable'
	go ahead and try it; this is fine if you don't mind being on
	the "front lines" so to speak. most of us stick with the
	STABLE distribution, which has no new gizmos being created;
	only patches and fixes are added to the STABLE release. you
	might occasionaly want to delve into UNSTABLE territory, for
	some new functionality that's not available in the stodgy,
	old, >>dependable<< stable area.  it's up to you, but don't
	expect a refund if something breaks -- it's called UNSTABLE
	for a reason!

	you can hop back and forth between the two by changing
	'stable' to 'unstable' or vice-versa, in your sources.list
	file. stick with STABLE, though, if you can.

	if you're running a production server, definitely shy away
	from UNSTABLE unless you like soothing the frazzled nerves
	of management, and their paying customers, and your spouse,
	who keeps asking why you're always looking for a new job.


UPDATING YOUR SYSTEM -- apt-get upgrade

	once sources.list is set up and you're online, first you

		apt-get update

	to refresh the package list to include the latest fixes,
	and then simply

		apt-get upgrade

	to download, configure and then install any packages you've
	got that have been tweaked. you'll probably wanna do this
	periodically to squash bugs and plug security holes.


INSTALLING PACKAGES -- apt-get install

	when you're online, to install new packages you want to use,
	simply use something like

		apt-get install vim traceroute mysql-server mysql-client
		apt-get install logcheck

	to download, configure and install whichever packages you want


FINDING PACKAGES -- apt-cache search

	whether you're online or not--

	how do you find the package that's got the feature you want?
	there are several options, and all require that you know
	some of the accepted terminology of the feature you're
	after:

		apt-get update

	then when your package list is up-to-date,

		apt-cache search tunnel
		apt-cache search 'php.*sql'
		apt-cache search apache.\*perl
		apt-cache search elvis\|vim

	search packages with REGEX -- if your pattern uses any
	keystrokes that mean something to the shell (e.g. [|?*])
	you'll need to quote them so that apt-cache will be able to
	see them, instead of having the shell expand the term to
	a list of file names that mean something else entirely.

	NOTE -- apt-cache only knows about the package descriptions
	you've already downloaded. if there are new ones to be had,
	browse to http://packages.debian.org/PACKAGESUBSTRING to
	see what's available. for example:

		http://packages.debian.org/vnc
	
	will get you a listing of packages that contain the term
	"vnc" somewhere in the title.


DESCRIBING PACKAGES -- apt-cache show

	the simplest way to see the description of a package:

		apt-cache show postgresql
		apt-cache show iproute

	this displays what the package is designed to do, version
	info and so forth.


LISTING PACKAGES -- dpkg -l

	which packages are installed? do any need configuring?

		dpkg -l

	(that's a lower-case EL, not a one.) lists all INSTALLED
	packages.

		dpkg -l \*
	
	lists all packages.

		dpkg -l '*postgres*'

	list status of packages matching GLOB (not regex: a regex
	uses .* to mean 'any character, zero or more times'; in a
	glob, .* means a dot, followed by zero or more characters).
	if your pattern uses metacharacters (* ? | etc.) you'll need
	to quote it so that your command shell doesn't interpret it
	-- you want dpkg to see the pattern, instead.

	combine that with grep for some powerful searches:

		dpkg -l \* | grep ^pi

	finds installed packages marked to be purged.

		dpkg -l \* | grep "^i[^i]"
	
	lists packages marked for installation, that aren't
	installed yet.

		dpkg -l \* | grep '^[^i]i'
	
	shows installed packages that won't stay that way. see 'man
	grep' for more info on grep and 'man dpkg' for more on the
	listing format.


PACKAGE CONTENTS -- dpkg -L

		dpkg -L mysql
		dpkg -L apt

	(with an upper-case EL) shows all the files -- with full
	path names -- that are provided by the package.


FINDING WHICH PACKAGE SUPPLIES... -- dpkg -S

	how to find which package contains a certain file:

		dpkg -S postmaster
		dpkg -S 'doc/*sql' | cut -f1 -d: | sort -u

	search for packages that supply files whose paths contain
	the GLOB. see 'man cut' and 'man sort' for info on how to
	use these tools in your day-to-day mungings.


LEARN MORE

	try
	
		man apt-get
		man sources.list
		man dpkg

		man grep
		man cut
		man sort

	to learn more.


handy-dandy stuff, once you get used to it.


-- 
self-reference, n: see self-reference.

will@serensoft.com   ***   http://www.dontUthink.com/



Reply to: