debian quick reference - sourceforgeqref.sourceforge.net/debian/quick-reference/quick...squid...

29
Debian Osamu Aoki <osamu\#at\#debian.org> Asho Yeh <asho\#at\#debian.org.tw> 23 CVS, 18 11:54:37 UTC 2007 Debian (http://qref.sourceforge.net/) Debian Debian (http://qref. sourceforge.net/)

Upload: nguyentu

Post on 01-Apr-2019

234 views

Category:

Documents


0 download

TRANSCRIPT

DebianOsamu Aoki Asho Yeh

23

CVS, 18 11:54:37 UTC 2007

Debian (http://qref.sourceforge.net/) Debian Debian (http://qref.sourceforge.net/)

http://qref.sourceforge.net/http://qref.sourceforge.net/http://qref.sourceforge.net/

Copyright (c) 20012005 by Osamu Aoki .

This document may be used under the terms of the GNU General Public License version 2 orhigher. (http://www.gnu.org/copyleft/gpl.html)

Permission is granted to make and distribute verbatim copies of this document provided thecopyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this document under theconditions for verbatim copying, provided that the entire resulting derived work is distributedunder the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this document into another lan-guage, under the above conditions for modified versions, except that this permission noticemay be included in translations approved by the Free Software Foundation instead of in theoriginal English.

http://www.gnu.org/copyleft/gpl.html

i

Contents

1 1

1.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Debian distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 distribution stable, testing unstable 3

2.1 PotatoWoody . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.3.1 dselect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3 Debian 5

3.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.1.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.1.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.2 Debian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.2.1 APT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.2.2 tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.2.3 aptitude . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.2.4 dselect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.2.5 APT Debian . . . . . . . . . . . . . . . . . . . . . . . 8

3.2.6 aptitudeapt-getapt-cache . . . . . . . . . . . . . . . . . . 9

3.3 Debian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.3.1 Debian bugs . . . . . . . . . . . . . . . . . . . . . . . 10

3.3.2 APT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

CONTENTS ii

3.3.3 dpkg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.3.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.3.5 /var . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.3.6 . . . . . . . . . . . . . . . . . . . . . . . 12

3.3.7 dpkg . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.4 Debian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.4.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.4.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.4.3 Unattended installation with APT . . . . . . . . . . . . . . . . . . . . . . . 14

3.4.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.4.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.4.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3.4.7 stable/testing/unstable . . . . . . . . . . . . . . . . . . . 16

3.4.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3.4.9 / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.4.10 stable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.4.11 archive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.4.12 . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.4.13 Automatically install command . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.4.14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.5 Debian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.5.1 dpkg-divert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.5.2 equivs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.5.3 Alternative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.5.4 Runlevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3.5.5 daemon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

A 23

A.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

A.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

A.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

1

Chapter 1

quick reference Keep it short andsimple (KISS)

1.1

Debian bash

bash(1) Unix manual info libc GNU TEXINFO

1.2 Debian distributions

Debian

stable

testing

unstable: Cutting edgeDebian

unstable release-critical(RC)testing

DebianSarge(2005)Woody(stable),Sarge(testing), Sid(unstable) Sarge Sarge, Etch Sid EtchstableunstableEtchSid;testing(stable)

Chapter 1. 2

[email protected] mailing list Debian

distribution stable, testing unstable 3 stable 17 backport

3

Chapter 2

distribution stable,testing unstable

2.1 PotatoWoody

Potato APTapt_preferences(5)

/etc/apt/sources.listWoody APTWoody

# apt-get update# apt-get install libc6 perl libdb2 debconf# apt-get install apt apt-utils dselect dpkg

Woody

# apt-get upgrade# apt-get dist-upgrade

2.2

stable repositories

# cd /etc/apt# cp -f sources.list sources.list.old# :>sources.list# apt-setup noprobe

Chapter 2. distribution stable, testing unstable 4

testing testing unstable unstable

# cd /etc/apt# grep -e "^deb " sources.list >srcs# :>sources.list# cp -f srcs sources.list# sed -e "s/stable/testing/" srcs >>sources.list# sed -e "s/stable/unstable/" srcs >>sources.list# apt-get update# apt-get install apt apt-utils

Debian 6 /etc/apt/sources.list /etc/apt/preferences

2.3

/etc/apt/sources.list /etc/apt/preferences

unstabletesting Debiantesting

Debian 5 APT 11

2.3.1 dselect

-dev dselect (fine-grained package control)

# dselect update # # dselect select #

dselect dselect Depends Suggests Recommends Q dselect

# dselect install

dselect 8

dselect :)

5

Chapter 3

Debian

aptitude APTaptitude

synaptic Gtk toolkit APT aptitudeDebian Package Tags (http://debtags.alioth.debian.org/)

Debian (repository) Debian

APT squid HTTP proxyhttp_proxy http/etc/apt/apt.conf

apt_preferences(5) pinning

chroot

Woody Sarge

3.1

Debiantesting/unstable :-)

3.1.1

dpkg - Debian apt-get - APT aptitude - APT

http://debtags.alioth.debian.org/http://debtags.alioth.debian.org/

Chapter 3. Debian 6

synaptic - APT dselect - tasksel - task

dselect APT dpkg

APT /var/lib/apt/lists/* dpkg /var/lib/dpkg/available aptitude dselect[U]pdate dselect update /var/lib/dpkg/available

apt-get

aptitude

dselect

3.1.2

dpkg-reconfigure - ( debconf )

dpkg-source - dpkg-buildpackage - apt-cache - check package archive in local cache

3.2 Debian

3.2.1 APT

3sources.list 1

3.2.2 tasks

Debian Task

tasks tasksel

dselect update

1testing unstable/etc/apt/sources.list /etc/apt/preferences stabletestingstable

Chapter 3. Debian 7

aptitude tasks tasks

3.2.3 aptitude

aptitude dselect APT apt-get apt-get aptitude(1) /usr/share/doc/aptitude/README

aptitudeaptitude

aptitude()

Keystroke ActionF10 Menu? Help for keystroke (complete listing)u Update package archive information

Mark the package to be upgraded or newly installed- Mark the package to be removed (keep config)_ Mark the package to be purged (remove config)= Place the package on holdU Mark all upgradable packages to be upgradedg Download and install selected packagesq Quit current screen and save changesx Quit current screen and discard changesEnter View information about a packageC View a packages changelogl Change the limit for the displayed packages/ Search for the first match\ Repeat the last search

apt-getaptitude aptitude F10 -> Options ->Dependency handling

aptitude aptitude aptitude/var/log/aptitude aptitude Obsolete and Locally Created Pack-

ages aptitude mutt expressionmutt /usr/share/doc/aptitude/READMESEARCHING, LIMITING, AND EXPRESSIONS

aptitude su

Chapter 3. Debian 8

3.2.4 dselect

Stable(Potato)dselect Sarge aptitude

dselect Required Important Standard

dselect ()

Q

(override dependencies)R (Revert) I did not mean it.D (Damn it) dselect U (sUggested)

D Q

/etc/dpkg/dselect.cfg expert

dselect apt-getinstall

3.2.5 APT Debian

/etc/apt/preferences testing

Package: *Pin: release a=testingPin-Priority: 800

Package: *Pin: release a=stablePin-Priority: 600

testingunstabletesting

apt_preferences(5)unstabletesting

examples subdirectory (http://www.debian.org/doc/manuals/debian-reference/examples/) preferences.testing preferences.unstable

http://www.debian.org/doc/manuals/debian-reference/examples/http://www.debian.org/doc/manuals/debian-reference/examples/

Chapter 3. Debian 9

testing stable unstable stabletestingunstablelibc6

preferences.stablestable

Debian /var/cache/apt/archives/ http://snapshot.debian.net/ dpkg 11

Debian

3.2.6 aptitudeapt-getapt-cache

testing

aptitude update ( apt-get update

aptitude upgrade ( apt-get upgrade aptitude dist-upgrade apt-get dist-upgrade)

testingtesting 2

apt-get dselect-upgrade

testingdselect

aptitude install package/unstable

unstable distribution package testing distribution

aptitude install -t unstable package

unstable Pin-Priority 990 unstable distribution packageunstable distribution

apt-cache policy foo bar ...

foo bar . . .

aptitude show foo bar ... | less ( apt-cache show foo bar ... |less)

foo bar . . .

aptitude install foo=2.2.4-1

foo 2.2.4-12upgradedist-upgrade

apt-get(8) aptitude upgrade aptitude dist-upgrade aptitude e

http://snapshot.debian.net/http://snapshot.debian.net/

Chapter 3. Debian 10

aptitude install foo bar-

foo bar

aptitude remove bar

bar

aptitude purge bar

bar

apt-get -uaptitude apt-get

$ cat >> /etc/apt/apt.conf

Chapter 3. Debian 11

3.3.2 APT

unstabletesting 4

# aptitude dist-upgrade

# aptitude -f upgrade # ... # aptitude -f dist-upgrade # dist-upgrade

script /var/lib/dpkg/info/packagename.{post-,pre-}{install,removal} script

# dpkg --configure -a #

script /etc/.dpkg-new mv

unstabletesting

# aptitude -f install package # override broken dependencies

equivs /usr/share/doc/equivs/README.Debian

3.3.3 dpkg

APT Debiandpkg /var/cache/apt/archives/

# dpkg -i fetchmail_6.2.5-4_i386.deb

--ignore-depends--force-dependsdpkgdpkg(8)

Chapter 3. Debian 12

3.3.4

/var/lib/dpkg/status Debian /var/lib/dpkg/status-old /var/backups/dpkg.status.* /var/lib/dpkg/status

/var/backups/

/var/lib/dpkg/status /usr/share/doc/

# ls /usr/share/doc | \grep -v [A-Z] | \grep -v ^texmf$ | \grep -v ^debian$ | \awk {print $1 " install"} | \dpkg --set-selections

# dselect --expert #

3.3.5 /var

/var mail /var Debian

Debian /var var.tar.gz(http://people.debian.org/~osamu/pub/)

# cd /# mv var var-old # # tar xvzf var.tar.gz # Woody # aptitude # dselect

12 ([FIXME])

3.3.6

Debian/CD Linux Linux/target dpkg chroot

# dpkg --root /target -i packagefile.deb

http: / /people.debian.org /~osamu /pub /

Chapter 3. Debian 13

By the way, if a broken lilo is all that prevents booting, you can boot using a standard Debianrescue disk. At boot prompt, assuming the root partition of your Linux installation is in /dev/hda12 and you want runlevel 3, enter:

boot: rescue root=/dev/hda12 3

Then you are booted into an almost fully functional system with the kernel on floppy disk.(There may be minor glitches due to lack of kernel features or modules.)

3.3.7 dpkg

dpkg .deb links

$ links http://http.us.debian.org/debian/pool/main/d/dpkg/... dpkg_version_arch.deb

$ supassword: *****# ar x dpkg_version_arch.deb# mv data.tar.gz /data.tar.gz# cd /# tar xzfv data.tar.gz

i386 http://packages.debian.org/dpkg

3.4 Debian

Debian :-)

3.4.1

$ dpkg {-S|--search} pattern

Debian

$ wget http://ftp.us.debian.org/debian/dists/sarge/Contents-i386.gz$ zgrep -e pattern Contents-i386.gz

Chapter 3. Debian 14

# aptitude install dlocate$ dlocate filename # dpkg -L dpkg -S ...# aptitude install auto-apt # on-demand package installation tool# auto-apt update # auto-apt db $ auto-apt search pattern

# pattern

3.4.2

archive /etc/apt/sources.list APTarchive(s) testing/unstable apt-cache policy

# apt-get check # $ apt-cache search pattern # $ apt-cache policy package # priority/dists $ apt-cache show -a package # show description of package in all dists$ apt-cache showsrc package # show description of matching source package$ apt-cache showpkg package # # dpkg --audit|-C # search for partially installed packages$ dpkg {-s|--status} package ... # $ dpkg -l package ... # ()$ dpkg -L package ... #

apt-cache showsrcWoody release :)

( mc)

/var/lib/apt/lists/*/var/lib/dpkg/available

/var/lib/dpkg/status/var/backups/dpkg.status*

3.4.3 Unattended installation with APT

For an unattended installation /etc/apt/apt.conf

Chapter 3. Debian 15

Dpkg::Options {"--force-confold";}

aptitude -y install packagename apt-get -q -y installpackagename yes apt.conf(5) dpkg(1)

15

3.4.4

# dpkg-reconfigure --priority=medium package [...]# dpkg-reconfigure --all # # dpkg-reconfigure locales # locales# dpkg-reconfigure --p=low xserver-xfree86 # X server

debconf debconf

scripts 3

apt-setup - /etc/apt/sources.listinstall-mbr - Master Boot Record managertzconfig - gpmconfig - gpm mouse daemoneximconfig - Exim (MTA)texconfig - teTeXapacheconfig - Apache (httpd)cvsconfig - CVSsndconfig - ...update-alternatives - e.g., vim as viupdate-rc.d - System-V init script managementupdate-menus - Debian ...

3.4.5

# aptitude remove package ...# dpkg --remove package ...

3Some *config scripts are disappearing in the newer Sarge releases and the package configuration function-ality are moved to the debconf system.

Chapter 3. Debian 16

# aptitude purge package ...# dpkg --purge package ...

3.4.6

dselect aptitude install package libc6libc6-dev

# echo -e "libc6 hold\nlibc6-dev hold" | dpkg --set-selections

aptitude install package aptitude upgradepackage aptitude dist-upgrade /etc/apt/preferences

Package: libc6Pin: release a=stablePin-Priority: 2000

Package: libc6* glibc

dpkg --get-selections "*"|grep -e "hold$"

3.4.7 stable/testing/unstable

apt-show-versions distribution

$ apt-show-versions | fgrep /testing | wc... testing $ apt-show-versions -u... $ aptitude install apt-show-versions -u -b | fgrep /unstable... unstalbe

3.4.8

APT /var/cache/apt/archives/

# aptitude autoclean # # aptitude clean #

Chapter 3. Debian 17

3.4.9 /

# dpkg --get-selections "*" >myselections # \*# debconf-get-selections > debconfsel.txt

* myselections purge

# dselect update# debconf-set-selections < debconfsel.txt# dpkg --set-selections

Chapter 3. Debian 18

... $ su -c "dpkg -i packagefile.deb"

-dev debsign devscripts auto-apt fakeroot root

Woody pine

# apt-get build-dep pine# apt-get source -b pine

3.4.11 archive

APT dselect Packages

Debian archive deb repository

# aptitude install dpkg-dev# cd /usr/local# install -d pool # # install -d dists/unstable/main/binary-i386# ls -1 pool | sed s/_.*$/ priority section/ | uniq > override# editor override # priority section# dpkg-scanpackages pool override /usr/local/ \

> dists/unstable/main/binary-i386/Packages# cat > dists/unstable/main/Release > /etc/apt/sources.list

deb repository

# aptitude install dpkg-dev# mkdir /usr/local/debian# mv /some/where/package.deb /usr/local/debian

Chapter 3. Debian 19

# dpkg-scanpackages /usr/local/debian /dev/null | \gzip - > /usr/local/debian/Packages.gz

# echo "deb file:/usr/local/debian ./" >> /etc/apt/sources.list

HTTP FTP /etc/apt/sources.list archives

3.4.12

alien Red Hat rpm Stampede slp Slackware tgz Solaris pkg Debian deb Linux distribution alienalien LSB

3.4.13 Automatically install command

auto-apt is an on-demand package installation tool.

$ sudo auto-apt update... update database

$ auto-apt -x -y runEntering auto-apt mode: /bin/bashExit the command to leave auto-apt mode.$ less /usr/share/doc/med-bio/copyright # access non-existing file... Install the package which provide this file.... Also install dependencies

3.4.14

debsums MD5 MD5

# cat >>/etc/apt/apt.conf.d/90debsumsDPkg::Post-Install-Pkgs {"xargs /usr/bin/debsums -sg";};^D

per Joerg Wendland (untested).

Chapter 3. Debian 20

3.5 Debian

3.5.1 dpkg-divert

dpkg Debian scripts conffiles dpkg

# dpkg-divert [--add] filename # "diversion"# dpkg-divert --remove filename # "diversion"

dpkg-divert

3.5.2 equivs

Debian (*.deb) equivs

Package: equivsPriority: extraSection: adminDescription: Circumventing Debian package dependenciesThis is a dummy package which can be used to create Debianpackages, which only contain dependency information.

3.5.3 Alternative

vi vim update-alternatives

# update-alternatives --display vi...# update-alternatives --config viSelection Command

-----------------------------------------------1 /usr/bin/elvis-tiny2 /usr/bin/vim

*+ 3 /usr/bin/nvi

Enter to keep the default[*], or type selection number: 2

Chapter 3. Debian 21

Debian alternatives /etc/alternatives/

X update-alternatives /usr/bin/x-session-manager /usr/bin/x-window-manager

/bin/sh /bin/bash /bin/dash bashscript /bin/bash /bin/dash POSIX 2.4 Linux kernel /bin/dash

3.5.4 Runlevel

Debian runlevel 2 5Debian runlevel 2,3,4,5 Debian runlevels runlevelsGNU/Linux runlevel 2xdm gdm X display runlevel 3

3.5.5 daemon

Debian distribution daemon

Exim DHCP ps aux/etc/init.d/* /etc/inetd.conf /etc/hosts.denypidof pidof(8)

Debian X11 TCP/IP SSH Xforwarding

Chapter 3. Debian 22

23

Appendix A

A.1

Debian (Osamu Aoki) Quick Reference . . . debian-user Debian Installation Manual Debian Release Notes

Debian Documentation Project (http://www.debian.org/doc/ddp) (DDP) The Debian FAQ Josip Rodin Debian The Debian FAQ Debian

QREF Quick Reference. . .

(Osamu Aoki) ()

Esko Arajvi (etch) Thomas Hood () Brian Nelson ( X) David Sewell () Jan Michael C Alonzo Daniel Webb

Guillaume Erbs () Renald Casagraude Jean-Pierre Delange Daniel Desages

Davide Di Lazzaro ()

Paulo Rogerio Ormenese ()

http://www.debian.org/doc/ddp

Chapter A. 24

Andre Luis Lopes Marcio Roberto Teixeira Rildo Taveira de Oliveira Raphael Bittencourt Simoes Costa Gustavo Noronha Silva (coordinator)

Walter Echarri () Jose Carreiro

Jens Seidel () Willi Dyck Stefan Schroeder Agon S. Buchholz

PDDP (http://debian.linux.org.pl) Marcin Andruszkiewicz Mariusz Centka Bartosz Fenski () Radosaw Grzanka Bartosz Xebord Janowski Jacek Lachowicz Rafa Michaluk Leonard Milcin, Jr. Tomasz Z. Napieraa Oskar Ostafin Tomasz Piekos Jacek Politowski Mateusz Prichacz Marcin Rogowski Pawe Rzanski Mariusz Strzelecki Krzysztof Scierski Przemysaw Adam Smiejek Krzysztof Szynter Mateusz Tryka Cezary Uchto Krzysztof Witkowski Bartosz Zapaowski

Hao Lyoo LIU Ming Hua Xiao Sheng Wen (leader: zh-cn) Haifeng Chen Xie Yanbo easthero

(asho) ()

http://debian.linux.org.pl

Chapter A. 25

(wctang)

Shinichi Tsunoda () Osamu Aoki

Esko Arajvi ()

A.2

Debian Linux

A.3

email debian-reference Debian BTS system (http://bugs.debian.org/) reportbug email OsamuAoki (http://people.debian.org/~osamu/)

http://bugs.debian.org/http://people.debian.org/~osamu/

DDebian distributions

N distribution stable, testing unstableq Potato Woodye dselect

Debian MztDnMzuKu

Debian Mz]w APTtasks waptitudedselect APT Debian oaptitudeAapt-getMapt-cache RO

Debian sOd Debian bugs MDUAPT ~k dpkg ^_MAb =1sp /var YtMw@Lk}tpG dpkg OaF

Debian OTMTUnattended installation with APTs]wwwMMMMMstable/testing/unstable VXtRsMO/st]wMJ stable taM archivew~GiMAutomatically install commandwwM

Debian SOBdpkg-divert Oequivs MAlternative ORunlevel daemon A{

@O^X