Guía de referencia Debian ------------------------- Osamu Aoki Editor: David Sewell Sección A.1, `Autores' CVS, Sun, 13 Oct 2002 22:40:19 -0600 ------------------------------------------------------------------------------- Resumen ------- Esta Guía de referencia Debian (http://qref.sourceforge.net/) abarca diversos aspectos de la administración del sistema mediante ejemplos que utilizan comandos de la shell. Se brindan tutoriales, trucos e información sobre diversos temas: conceptos básicos del sistema Debian, consejos para la instalación del sistema, administración de paquetes Debian, el kernel de Linux en Debian, puesta a punto del sistema, creación de una puerta de enlace (gateway), editores de texto, CVS, programación y GnuPG para usuarios que no son desarrolladores. Si necesita ayuda para un mantenimiento de emergercia del sistema, diríjase inmediatamente a Sección 6.2, `Comandos de supervivencia Debian'. La última versión oficial se encuentra en http://www.debian.org/doc/manuals/debian-reference/ y la última versión en desarrollo en http://qref.sourceforge.net/Debian/. El proyecto se encuentra en http://qref.sourceforge.net/. Los archivos de configuración de ejemplo se pueden obtener aquí examples (examples/). Nota de Copyright ----------------- Copyright (C) 2001-2002 by Osamu Aoki Copyright (Chapter 2) (C) 1996-2001 by Software in the Public Interest Este documento puede ser usado en los términos descritos en la Licencia Pública GNU versión 2 o posterior. (http://www.gnu.org/copyleft/gpl.html) Permission is granted to make and distribute verbatim copies of this document provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this document under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this document into another language, under the above conditions for modified versions, except that this permission notice may be included in translations approved by the Free Software Foundation instead of in the original English. ------------------------------------------------------------------------------- Contenidos ---------- 1. Preface 1.1. Convenciones del documento 1.2. Instalación basica 1.3. Bases de las distribuciones Debian 2. Debian fundamentals 2.1. The Debian archives 2.1.1. Directory structures 2.1.2. Debian distributions 2.1.3. The `stable' distribution 2.1.4. The `testing' distribution 2.1.5. The `unstable' distribution 2.1.6. The `frozen' distribution 2.1.7. Debian distribution codenames 2.1.8. Codenames used in the past 2.1.9. The source for codenames 2.1.10. The `pool' directory 2.1.11. Historical notes about `sid' 2.1.12. Uploaded packages in `incoming' 2.1.13. Retrieve an older package 2.1.14. Architecture sections 2.1.15. The source code 2.2. The Debian package management system 2.2.1. Overview of Debian packages 2.2.2. Debian package format 2.2.3. Naming conventions for Debian package filenames 2.2.4. Preservation of the local configuration 2.2.5. Debian maintenance scripts 2.2.6. Package priorities 2.2.7. Virtual packages 2.2.8. Package dependencies 2.2.9. The meaning of Pre-depends 2.2.10. Package status 2.2.11. Holding back packages from an upgrade 2.2.12. Source packages 2.2.13. Building binary packages from a source package 2.2.14. Creating new Debian packages 2.3. Upgrading a Debian system 2.3.1. Methods for upgrading a Debian system 2.3.2. Package management tools overview 2.3.3. `dpkg' 2.3.4. APT 2.3.5. `dselect' 2.3.6. Upgrade a running system 2.3.7. Downloaded and cached `.deb' archive files 2.3.8. Record-keeping for upgrades 2.4. The Debian boot process 2.4.1. The `init' program 2.4.2. Runlevels 2.4.3. Customizing the boot process 2.5. Supporting diversity 2.6. Internationalization 2.7. Debian and the kernel 2.7.1. Compiling a kernel from non-Debian source 2.7.2. Tools to build custom kernels 2.7.3. Alternative boot loaders 2.7.4. Custom boot floppies 2.7.5. Special provisions for dealing with modules 2.7.6. De-installing an old kernel package 3. Debian System installation hints 3.1. General Linux system installation hints 3.1.1. Hardware compatibility basics 3.1.2. Determining a PC's hardware and chip set 3.1.3. Determining a PC's hardware via Debian 3.1.4. Determining a PC's hardware via other OSs 3.1.5. A Lilo myth 3.1.6. Choice of boot floppies (potato) 3.1.7. Installation 3.1.8. Hosts and IP to use for LAN 3.1.9. User accounts 3.1.10. Hard disk partition and NFS setup 3.1.11. DRAM memory guidelines 3.1.12. Swap space 3.2. Bash configuration 3.3. Mouse configuration 3.4. NFS configuration 3.5. Samba configuration 3.6. Printer configuration 3.7. Other host configuration hints 3.7.1. Install a few more packages and do the basics 3.7.2. Modules 3.7.3. CD-RW basic setup 3.7.4. Large memory and auto power-off 3.7.5. Other configuration files to tweak in `/etc' 4. Tutoriales de Debian 4.1. Fuentes de información 4.2. La consola Linux 4.2.1. Entrando al sistema 4.2.2. Añadir una cuenta de usuario 4.2.3. Cómo apagar el sistema 4.2.4. Edición en línea de comandos 4.2.5. Comandos básicos que se deben tener presente 4.2.6. Sistema X Window 4.2.7. Combinaciones de teclas habituales 4.3. Midnight Commander (MC) 4.3.1. Instalar MC 4.3.2. Iniciar MC 4.3.3. Administrador de archivos 4.3.4. Trucos para la línea de comandos: 4.3.5. Editor 4.3.6. Visor 4.3.7. Inicio automático de programas 4.3.8. Sistema de archivos virtuales FTP 4.4. Para saber más 5. Transición hacía Woody 5.1. Preparación para la transición 5.2. Actualización a Woody 5.3. Configuración de Woody 5.4. `sources.list' Optimizado 6. Gestión de paquetes Debian 6.1. Introducción 6.1.1. Herramientas principales 6.1.2. Herramientas convenientes 6.2. Comandos de supervivencia Debian 6.2.1. Instalar con `tasksel' 6.2.2. Instalar el sistema con APT 6.2.3. Actualizar con APT 6.2.4. Verificar los bugs Debian 6.2.5. Solución de problemas de actualización APT. 6.2.6. Reparación utilizando `dpkg' 6.2.7. Instalar un paquete en un sistema no bootable 6.3. Debian nirvana commands 6.3.1. Information on a file 6.3.2. Information on a package 6.3.3. Reconfigure installed packages 6.3.4. Remove and purge packages 6.3.5. Holding older packages 6.3.6. `dselect' -- global configuration 6.3.7. Reduce cached package files 6.3.8. Record/copy system configuration 6.3.9. Port a package to the "stable" system 6.3.10. Convert or install an alien binary package 6.4. Other Debian peculiarities 6.4.1. dpkg-divert command 6.4.2. `equivs' package 6.4.3. Alternative commands 6.4.4. System-V `init' and runlevels 6.4.5. Disabled daemon services 7. The Linux kernel under Debian 7.1. Kernel recompile 7.1.1. Debian standard method 7.1.2. Classic method 7.2. The modularized 2.4 kernel 7.2.1. PCMCIA 7.2.2. SCSI 7.2.3. Network function 7.2.4. EXT3 filesystem ( > 2.4.17) 7.2.5. Realtek RTL-8139 support in 2.4 8. Trucos para Debian 8.1. Arrancando el sistema 8.1.1. "¡Olvidé la contraseña de superusuario!" (1) 8.1.2. "¡Olvidé la contraseña de superusuario!" (2) 8.1.3. No puedo arrancar el sistema 8.1.4. Otros trucos con el indicador de arranque 8.2. Registro de actividades 8.2.1. Registrando las actividades del intérprete de comandos 8.2.2. Registrando las actividades en X 8.3. Copiar y archivar un subdirectorio entero 8.3.1. Comandos básicos para copiar un subdirectorio entero 8.3.2. `cp' 8.3.3. `tar' 8.3.4. `pax' 8.3.5. `cpio' 8.3.6. `afio' 8.4. Modificar archivos con la sustitución de expresiones regulares 8.5. Recuperar al sistema de un cuelgue 8.5.1. Mate el proceso 8.5.2. ALT-SysRq 8.6. Archivos de configuración 8.7. Algunos pequeños comandos útiles para tener en cuenta 8.7.1. Memoria disponible 8.7.2. Configurar fecha y hora (BIOS) 8.7.3. Como desactivar el protector de pantalla 8.7.4. Desactivar el sonido (bip) 8.7.5. Mensajes de error en la pantalla 8.7.6. Volver la consola a su estado normal 8.7.7. Convertir un archivo de texto en formato DOS a formato Unix 8.7.8. Convertir un archivo grande en archivos más pequeños 8.7.9. Pequeños scripts que incluyen redireccionamientos 8.7.10. Obtener el texto de una página web o del archivo de una lista de correos 8.7.11. El tiempo de un comando 8.7.12. El comando `nice' 8.7.13. Planificar una actividad (`cron', `at') 8.7.14. Intercambiando consolas con `screen' 8.7.15. Probando la red 8.7.16. Eliminar mensajes de la cola local 8.7.17. Eliminar mensajes bloqueados de la cola local 8.7.18. Borrar el contenido de un archivo 8.7.19. Archivos fantasma 8.7.20. chroot 8.7.21. Samba 9. Tuning a Debian system 9.1. System initialization hints 9.1.1. Customizing init script 9.1.2. Customizing system logging 9.1.3. Hardware access optimization 9.2. Access control 9.2.1. Control de acceso through PAM and login 9.2.2. Why GNU `su' does not support the `wheel' group 9.2.3. Meaning of group 9.2.4. `sudo' - safer work environment 9.2.5. Access control to daemon programs 9.2.6. Lightweight Directory Access Protocol 9.3. CD-writer 9.3.1. Introduction 9.3.2. Approach 1: modules + `lilo' 9.3.3. Approach 2: recompile the kernel 9.3.4. Post-configuration steps 9.3.5. CD-image file (bootable) 9.3.6. Write to the CD-writer (R, R/W): 9.3.7. Make an image file of a CD 9.3.8. Debian CD image 9.3.9. Backup the system to CD-R 9.3.10. Copy a music CD to CD-R 9.4. The X program 9.4.1. X server 9.4.2. X client 9.4.3. TCP/IP connection to X 9.4.4. Remote X connection: `xhost' 9.4.5. Remote X connection: `ssh' 9.4.6. `xterm' 9.4.7. Gain root in X 9.4.8. TrueType fonts in X 9.4.9. Web Browser (graphical) 9.4.10. CJK and X 9.5. SSH 9.5.1. Basics 9.5.2. Port forwarding -- for SMTP/POP3 tunneling 9.5.3. Connect with fewer passwords 9.5.4. Foreign SSH client 9.5.5. SSH agent 9.5.6. Troubles 9.6. Mail programs 9.6.1. Mail transport agent (Exim) 9.6.2. Mail utility (Fetchmail) 9.6.3. Mail utility (Procmail) 9.6.4. Mail user agent (Mutt) 9.7. Localization 9.7.1. Locales 9.7.2. Activate locale support capability 9.7.3. Activate a particular `locale' 9.7.4. Beyond `locale' 10. Building a gateway with a Debian system 10.1. Network configuration 10.1.1. Host configuration for the gateway 10.1.2. IP-masquerade 10.1.3. Network configuration checkpoints 10.2. Manage multiple net connections 11. Editores 11.1. Editores 11.2. Emacs y Vim 11.2.1. Comandos útiles en Vim 11.2.2. Comandos útiles en Emacs 11.2.3. Ejecutando el editor 11.2.4. Resumen de los comandos del editor (Emacs, Vim) 11.2.5. Configuración de Vim 11.2.6. Ctags 11.2.7. Convertir un porción de texto seleccionado en código HTML 11.2.8. Dividir la pantalla con `vim' puede editar múltiples archivos en un entorno de múltiples ventanas. Escriba ":help usr_08.txt" para más detalles. 12. CVS 12.1. Instalar el servidor CVS 12.2. Sesiones CVS de ejemplo 12.2.1. CVS anónimo (únicamente para descargar) 12.2.2. Uso del servidor CVS local 12.2.3. Uso del pserver en un CVS remoto 12.2.4. Uso de un CVS remoto mediante `ssh' 12.2.5. Crear un archivo CVS nuevo 12.2.6. Trabajando con CVS 12.2.7. Exportar archivos desde el CVS 12.2.8. Administrar el CVS 12.3. Resolución de problemas 12.3.1. Permisos de los archivos en el repositorio 12.3.2. El bit de ejecución 12.4. Comandos del CVS 13. Programación 13.1. Dónde empezar 13.2. BASH 13.3. AWK 13.4. PERL 13.5. PYTHON 13.6. MAKE 13.7. C 13.7.1. Programa sencillo en C (`gcc') 13.7.2. Depurar (`gdb') 13.7.3. Flex -- un Lex mejorado 13.7.4. Bison -- un Yacc mejorado 13.7.5. Autoconf -- desinstalar 13.8. SGML 13.9. Creación de paquetes Debian 14. GnuPG 14.1. Instalar Gnu PG 14.2. Usar GnuPG 14.3. Administrar GnuPG 14.4. Uso con Mutt 15. Suporte para Debian 15.1. Referencias 15.2. Encontrar el significado de una palabra 15.3. Sistema de seguimiento de fallos de Debian 15.4. Listas de Correo 15.5. IRC 15.6. Motores de Búsqueda 15.7. Páginas en Internet A. Apéndice A.1. Autores A.2. Garantías A.3. Comentarios A.4. Disponibilidad A.5. Formato del documento A.6. El laberinto de Debian ------------------------------------------------------------------------------- 1. Preface ---------- Este documento ha sido empezado como una referencia "rapida", la información incluida debe ser tratada como complemento ó enlace a las referencias autoritarias listadas en Sección 15.1, `Referencias'. 1.1. Convenciones del documento ------------------------------- El documento "Guía de referencia Debian" proporciona información a través de comandos BASH simples. Aqui siguen las convenciones utilizadas: # comando con cuenta root $ comando con cuenta "user" ... descripción de la acción. Para BASH, lea `man bash' y Bash-Prog-Intro-HOWTO (LDP) como información para comenzar. Las siguientes abreviaciones són utilizadas: * LDP: Linux Documentation Project http://www.tldp.org/ * DDP: Debian Documentation Project http://www.debian.org/doc/ Ejemplos de scripts están disponibles aquí en el web. Los ficheros escondidos con precediente . sont convertidos con precediente _ (examples/). 1.2. Instalación basica ----------------------- Sí el sistema ha sido instalado con la opción "simple", asegurarse de seleccionar la opción "New user documentation". Si no, lanzar los siguientes comandos: # dselect update # tasksel ... seleccionar la opción "New user documentation" y otras Adicionalmente a esto, instalar los paquetes siguientes: # apt-get install debian-policy developers-reference maint-guide \ packaging-manual doc-debian doc-linux-text info \ man-db manpages manpages-dev less mc # para versión Potato # apt-get install debian-policy developers-reference maint-guide \ doc-debian doc-linux-text apt-howto info \ man-db manpages manpages-dev less mc # para versión Woody 1.3. Bases de las distribuciones Debian --------------------------------------- Debian existe en 3 "versiones" publicas: * stable: (versión estable) Buena para servidores de producción. Aburrida para utlizar en una workstation (computador de trabajo). Sección 2.1.3, `The `stable' distribution' * testing: (versión de pruebas) Buena para probar en una workstation (WS). Sección 2.1.4, `The `testing' distribution' * unstable: (versión inestable) Nunca debe fiarse de esta versión. Sección 2.1.5, `The `unstable' distribution' Lea a lo menos la lista de correo de desarrollo `debian-devel-announce@lists.debian.org' para información actualiza sobre la evolución de Debian. En marzo 2002, todo esto corresponde a Potato (qualidad de producción), Woody (beta-test, ahora muy estable), y Sid (alpha-test). Cuando los paquetes inestables no tienen bugs de tipo "Release Critical" (RC) desde más o menos la 1era semana, entonces son automaticamente promovidos hacia "testing" (Woody). Vea Sección 2.1, `The Debian archives'. Teoricamente, para conseguir hacer funcionar las ultimas versiones hay dos posibilidades. Sección 6.2.2, `Instalar el sistema con APT' (principalmente para workstations) Sección 6.3.9, `Port a package to the "stable" system' (principalmente para servidores) Después de explicar los fundamentos de las distribuciones Debian en Capítulo 2, `Debian fundamentals', presentaré alguna información para que vivan felices con las ultimas versiones Debian, conocer las ventajas de las versiones Debian "testing" y "unstable". Los que no aguanten más siguan Sección 6.2, `Comandos de supervivencia Debian' inmediatamente. Feliz upgrading (puesta a nivel)! < ------------------------------------------------------------------------------- 2. Debian fundamentals ---------------------- This chapter provides fundamental information on the Debian system for non-developers. For authoritative information, see: * Debian Policy Manual * Debian Packaging Manual (potato) * Debian Developer's Reference * Debian New Maintainers' Guide listed under Sección 15.1, `Referencias'. If you are looking for less detailed "how-to" explanations, jump directly to Capítulo 6, `Gestión de paquetes Debian' or other relevant chapters. This chapter consists of documents taken from the "Debian FAQ", greatly reorganized to allow the ordinary Debian system administrator to get started. 2.1. The Debian archives ------------------------ 2.1.1. Directory structures --------------------------- The software that has been packaged for Debian is available in one of several directory trees on each Debian mirror site (http://www.debian.org/misc/README.mirrors) through FTP or HTTP. The following directories can be found on each Debian mirror site under the `/debian/' directory: `/dists/': This directory contains the "distributions", and this used to be the canonical way to access the currently available packages in Debian releases and pre-releases. Some old packages and `Packages.gz' files are still in here. `/pool/': New physical location for all packages of Debian releases and pre-releases. `/tools/': DOS utilities for creating boot disks, partitioning your disk drive, compressing/decompressing files, and booting Linux. `/doc/': The basic Debian documentation, such as the FAQ, the bug reporting system instructions, etc. `/indices/': The Maintainers file and the override files. `/project/': mostly developer-only materials, such as: `project/experimental/': This directory contains packages and tools which are still being developed, and are still in the alpha testing stage. Users shouldn't be using packages from here, because they can be dangerous and harmful even for the most experienced. `project/orphaned/': Packages that have been orphaned by their old maintainers, and withdrawn from the distribution. 2.1.2. Debian distributions --------------------------- Normally there are three Debian distributions in the `dists' directory. They are named the "stable" distribution, the "testing" distribution, and the "unstable" distribution. Sometimes there is also a "frozen" distribution. Each distribution is defined as a symlink to the actual directory with a codename in the `dists' directory. 2.1.3. The `stable' distribution -------------------------------- Package entries for the `stable' distribution, Debian Woody (3.0r0), are recorded into the `stable' (symlink to `Woody') directory: * `stable/main/': This directory contains the packages which formally constitute the most recent release of the Debian system. These packages all comply with the Debian Free Software Guidelines (http://www.debian.org/social_contract#guidelines) (also available as `/usr/share/doc/debian/social-contract.txt' installed by `debian-doc'), and are all freely usable and distributable. * `stable/non-free/': This directory contains packages distribution of which is restricted in a way that requires that distributors take careful account of the specified copyright requirements. For example, some packages have licenses which prohibit commercial distribution. Others can be redistributed but are in fact shareware and not free software. The licenses of each of these packages must be studied, and possibly negotiated, before the packages are included in any redistribution (e.g., in a CD-ROM). * `stable/contrib/': This directory contains packages which are DFSG-free and _freely distributable_ themselves, but somehow depend on a package that is _not_ freely distributable and thus available only in the non-free section. Now in adition to above locations, new physical packages are located under the `pool' directory (Sección 2.1.10, `The `pool' directory'). The current status of `stable' distribution bugs is reported on the Stable Problems (http://ftp-master.debian.org/testing/stable_probs.html) Web page. 2.1.4. The `testing' distribution --------------------------------- Package entries for the `testing' distribution, Debian Sarge, are recorded into the `testing' (symlink to `Sarge') directory after they have undergone some degree of testing in `unstable'. Now in adition to above locations, new physical packages are located under the `pool' directory (Sección 2.1.10, `The `pool' directory'). There are also `main', `contrib' and `non-free' subdirectories in `testing', which serve the same functions as in `stable'. These packages must be in sync on all architectures where they have been built and mustn't have dependencies that make them uninstallable; they also have to have fewer release-critical bugs than the versions currently in `unstable'. This way, we hope that `testing' is always close to being a release candidate. More details of the testing mechanism are at http://ftp-master.debian.org/testing/. The latest status of the `testing' distribution is reported at these sites: * update excuses (http://ftp-master.debian.org/testing/update_excuses.html) * testing problems (http://ftp-master.debian.org/testing/testing_probs.html) * release-critical bugs (http://bugs.debian.org/release-critical/) * base system bugs (http://base.debian.net/) * bugs in standard and task packages (http://standard.debian.net/) * other bugs and bug squashing party notes (http://bugs.debian.net/) 2.1.5. The `unstable' distribution ---------------------------------- Package entries for the `unstable' distribution, `sid', are recorded into the `unstable' (symlink to `sid') directory after they are uploaded to the Debian archive and stay here until they are moved to `testing'. New physical packages are located under the `pool' directory (Sección 2.1.10, `The `pool' directory'). There are also `main', `contrib' and `non-free' subdirectories in `unstable', which serve the same functions as in `stable'. The `unstable' distribution contains a snapshot of the most current development system. Users are welcome to use and test these packages, but are warned about their state of readiness. The advantage of using the `unstable' distribution is that you are always up-to-date with the latest in the Debian software project---but if it breaks, you get to keep both parts :-) The current status of `unstable' distribution bugs is reported on the Unstable Problems (http://ftp-master.debian.org/testing/unstable_probs.html) Web page. 2.1.6. The `frozen' distribution -------------------------------- When the `testing' distribution is mature enough, it becomes frozen, meaning no new code is accepted anymore, just bugfixes, if necessary. Also, a new testing tree is created in the `dists' directory, assigned a new codename. The frozen distribution passes through a few months of testing, with intermittent updates and deep freezes called "test cycles". (The recent `woody' release process did not create a symbolic link `frozen', so `frozen' was not a distribution but just a development stage of the `testing' distribution.) We keep a record of bugs in the frozen distribution that can delay a package from being released or bugs that can hold back the whole release. Once that bug count lowers to maximum acceptable values, the frozen distribution becomes stable, it is released, and the previous stable distribution becomes obsolete (and moves to the archive). 2.1.7. Debian distribution codenames ------------------------------------ Physical directory names in the `dists' directory, such as `Woody' and `Sarge', are just "codenames". When a Debian distribution is in the development stage, it has no version number, but a codename instead. The purpose of these codenames is to make the mirroring of the Debian distributions easier (if a real directory like `unstable' suddenly changed its name to `stable', a lot of stuff would have to be needlessly downloaded again). Currently, `stable' is a symbolic link to `Woody', and `testing' is a symbolic link to `Sarge'. This means that `Woody' is the current stable distribution and `Sarge' is the current testing distribution. `unstable' is a permanent symbolic link to `sid', as `sid' is always the unstable distribution. 2.1.8. Codenames used in the past --------------------------------- Other codenames that have already been used are: `buzz' for release 1.1, `rex' for release 1.2, `bo' for releases 1.3.x, `hamm' for release 2.0, `slink' for release 2.1, and `potato' for release 2.2. 2.1.9. The source for codenames ------------------------------- So far they have been characters taken from the movie _Toy Story_ by Pixar. * _buzz_ (Buzz Lightyear) was the spaceman, * _rex_ was the tyrannosaurus, * _bo_ (Bo Peep) was the girl who took care of the sheep, * _hamm_ was the piggy bank, * _slink_ (Slinky Dog) was the toy dog, * _sarge_ was a leader of the Green Plastic Army Men, * _potato_ was, of course, Mr. Potato Head, * _woody_ was the cowboy. * _sid_ was a boy next door who destroyed toys. 2.1.10. The `pool' directory ---------------------------- Historically, packages were kept in the subdirectory of `dists' corresponding to the distribution that contained them. This turned out to cause various problems, such as large bandwidth consumption on mirrors when major changes were made. Packages are now kept in a large "pool", structured according to the name of the source package. To make this manageable, the pool is subdivided by section (`main', `contrib' and `non-free') and by the first letter of the source package name. These directories contain several files: the binary packages for each architecture, and the source packages from which the binary packages were generated. You can find out where each package is placed by executing a command like `apt-cache showsrc ' and looking at the "Directory:" line. For example, the `apache' packages are stored in `pool/main/a/apache/'. Since there are so many `lib*' packages, these are treated specially: for instance, `libpaper' packages are stored in `pool/main/libp/libpaper/'. The `dists' directories are still used for the index files used by programs like `apt'. Also, at the time of writing, older distributions have not been converted to use pools so you'll see paths containing distributions such as potato or woody in the Filename header field. Normally, you won't have to worry about any of this, as new `apt' and probably older `dpkg-ftp' (see Sección 2.3.1, `Methods for upgrading a Debian system') will handle it seamlessly. If you want more information, see the Debian Package Pools FAQ (http://people.debian.org/~joeyh/poolfaq). 2.1.11. Historical notes about `sid' ------------------------------------ When the present-day `sid' did not exist, the Debian archive site organization had one major flaw: there was an assumption that when an architecture was created in the current `unstable', it would be released when that distribution became the new `stable'. For many architectures that wasn't the case, with the result that those directories had to be moved at release time. This was impractical because the move would chew up lots of bandwidth. The archive administrators worked around this problem for several years by placing binaries for unreleased architectures in a special directory called `sid'. For those architectures not yet released, the first time they were released there was a link from the current `stable' to `sid', and from then on they were created inside the `unstable' tree as usual. This layout was somewhat confusing to users. With the advent of package pools (see Sección 2.1.10, `The `pool' directory') during the `woody' distribution development, binary packages began to be stored in a canonical location in the pool, regardless of the distribution, so releasing a distribution no longer causes large bandwidth consumption on the mirrors (there is, however, a lot of gradual bandwidth consumption throughout the development process). 2.1.12. Uploaded packages in `incoming' --------------------------------------- Uploaded packages are first located at http://incoming.debian.org/ after being checked to insure that they really come from a Debian developer and DELAYED for NMU. Once a day, they are moved out of `incoming' to `unstable'. In an emergency, you may want to install packages from `incoming' before they reach `unstable'. 2.1.13. Retrieve an older package --------------------------------- While the most recent Debian distributions are kept under the `debian' directory on each Debian mirror site (http://www.debian.org/misc/README.mirrors), archives for older Debian distributions such as `slink' are kept on http://archive.debian.org/ or under the `debian-archive' directory on each Debian mirror site. Older `testing' and `unstable' packages can be located at http://snapshot.debian.net/. 2.1.14. Architecture sections ----------------------------- Within each of the major directory trees (`dists/stable/main', `dists/stable/contrib', `dists/stable/non-free', `dists/unstable/main/', etc.), the binary package entries reside in subdirectories whose names indicate the chip architecture for which they were compiled. * `binary-all/', for packages which are architecture-independent. These include, for example, Perl scripts, or pure documentation. * `binary-/', for packages which execute on a particular binary platform. Please note that the actual binary packages for `testing' and `unstable' no longer reside in these directories, but in the top-level `pool' directory. The index files (`Packages' and `Packages.gz') have been kept, though, for backwards compatibility. For the actual binary architectures supported, see Release Notes for each distribution. They can be located at the Release Notes sites for stable (http://www.debian.org/releases/stable/releasenotes) and testing (http://www.debian.org/releases/testing/releasenotes). 2.1.15. The source code ----------------------- Source code is included for everything in the Debian system. Moreover, the license terms of most programs in the system _require_ that source code be distributed along with the programs, or that an offer to provide the source code accompany the programs. Normally the source code is distributed in the `source' directories, which are parallel to all the architecture-specific binary directories, or more recently in the `pool' directory (see Sección 2.1.10, `The `pool' directory'). To retrieve the source code without having to be familiar with the structure of the Debian archive, try a command like `apt-get source '. Some packages, notably `pine', are only available in source package due to their licensing limitations. (Recently the `pine-tracker' package has been provided to facilitate Pine installation.) The procedures described in Sección 6.3.9, `Port a package to the "stable" system' and Sección 13.9, `Creación de paquetes Debian' provide ways to build a package manually. Source code may or may not be available for packages in the "contrib" and "non-free" directories, which are not formally part of the Debian system. 2.2. The Debian package management system ----------------------------------------- 2.2.1. Overview of Debian packages ---------------------------------- Packages generally contain all of the files necessary to implement a set of related commands or features. There are two types of Debian packages: * _Binary packages_, which contain executables, configuration files, man/info pages, copyright information, and other documentation. These packages are distributed in a Debian-specific archive format (see Sección 2.2.2, `Debian package format'); they are usually distinguished by having a `.deb' file extension. Binary packages can be unpacked using the Debian utility `dpkg'; details are given in its manual page. * _Source packages_, which consist of a `.dsc' file describing the source package (including the names of the following files), a `.orig.tar.gz' file that contains the original unmodified source in gzip-compressed tar format, and usually a `.diff.gz' file that contains the Debian-specific changes to the original source. The utility `dpkg-source' packs and unpacks Debian source archives; details are provided in its manual page. Installation of software by the package system uses "dependencies" which are carefully designed by the package maintainers. These dependencies are documented in the `control' file associated with each package. For example, the package containing the GNU C compiler (`gcc') "depends" on the package `binutils' which includes the linker and assembler. If a user attempts to install `gcc' without having first installed `binutils', the package management system (dpkg) will send an error message that it also needs `binutils', and stop installing `gcc'. (However, this facility can be overridden by the insistent user, see dpkg(8).) For additional details, see Sección 2.2.8, `Package dependencies' below. Debian's packaging tools can be used to: * manipulate and manage packages or parts of packages, * aid the user in the splitting of packages that must be transmitted through a limited-size medium such as floppy disks, * aid developers in the construction of package archives, and * aid users in the installation of packages which reside on a remote Debian archive site. 2.2.2. Debian package format ---------------------------- A Debian "package", or a Debian archive file, contains the executable files, libraries, and documentation associated with a particular program suite or set of related programs. Normally, a Debian archive file has a filename that ends in `.deb'. The internals of this Debian binary package format are described in the deb(5) manual page. Because this internal format is subject to change (between major releases of Debian), always use dpkg-deb(8) for manipulating `.deb' files. Through at least the `woody' distribution, all Debian archive files have been manipulable by the standard Unix commands `ar' and `tar', even when dpkg commands are not available. 2.2.3. Naming conventions for Debian package filenames ------------------------------------------------------ The Debian package filenames conform to the following convention: _-.deb where represents the package name. As a check, one can determine the package name associated with a particular Debian archive file (`.deb' file) in one of these ways: * inspect the "Packages" file in the directory where it was stored at a Debian archive site. This file contains a stanza describing each package; the first field in each stanza is the formal package name. * use the command `dpkg --info .deb' (where and are the version and revision of the package in question, respectively). This displays, among other things, the package name corresponding to the archive file being unpacked. The component is the version number specified by the upstream developer. There are no standards governing version numbers, so they may have formats as different as "19990513" and "1.3.8pre1". The component is the Debian revision number, and is specified by the Debian developer (or an individual user if he chooses to build the package himself). This number corresponds to the revision level of the Debian package; thus, a new revision level usually signifies changes in the Debian Makefile (`debian/rules'), the Debian control file (`debian/control'), the installation or removal scripts (`debian/p*'), or in the configuration files used with the package. 2.2.4. Preservation of the local configuration ---------------------------------------------- Preservation of user-configurable files is enabled through Debian's "conffiles" mechanism. User configuration files (usually placed in `/etc') are specified in the `conffiles' within the Debian package system. The package management system guarantees not to overwrite these files when the package is upgraded. When it is possible to configure the system without modifying files that belong to various Debian packages, it is usually a good idea not to modify them even if they are "conffiles". This ensures faster and smoother upgrade operations. To determine exactly which files are preserved during an upgrade, run: dpkg --status and look under "Conffiles:". Specifics regarding the contents of a Debian `conffiles' file are provided in the Debian Policy Manual, section 11.7 (see Sección 15.1, `Referencias'). 2.2.5. Debian maintenance scripts --------------------------------- Debian maintenance scripts are executable scripts which are automatically run before or after a package is installed. Along with a file named `control', all of these files are part of the "control" section of a Debian archive file. The individual files are: preinst This script executes before its package is unpacked from its Debian archive (`.deb') file. Many "preinst" scripts stop services for packages which are being upgraded until their installation or upgrade is completed (following the successful execution of the "postinst" script). postinst This script typically completes any required configuration of a package once it has been unpacked from its Debian archive (`.deb') file. Often, 'postinst' scripts ask the user for input, and/or warn the user that if he accepts default values, he should remember to go back and reconfigure that package as the situation warrants. Many "postinst" scripts then execute any commands necessary to start or restart a service once a new package has been installed or upgraded. prerm This script typically stops any daemons which are associated with a package. It is executed before the removal of files associated with the package. postrm This script typically modifies links or other files associated with a package, and/or removes files created by it. (Also see Sección 2.2.7, `Virtual packages'.) Currently all of the control files can be found in the directory `/var/lib/dpkg/info'. The files relevant to package `foo' begin with the name "foo" and have file extensions of "preinst", "postinst", etc., as appropriate. The file `foo.list' in that directory lists all of the files that were installed with the package `foo'. (Note that the location of these files is a dpkg internal, and may be subject to change.) 2.2.6. Package priorities ------------------------- Each Debian package is assigned a _priority_ by the distribution maintainers, as an aid to the package management system. The priorities are: * _Required_ packages are necessary for the proper functioning of the system. This includes all tools that are necessary to repair system defects. You must not remove these packages or your system may become totally broken and you may probably not even be able to use dpkg to put things back. Systems with only the Required packages are probably unusable, but they do have enough functionality to allow the sysadmin to boot and install more software. * _Important_ packages should be found on any Unix-like system. Other packages without which the system will not run well or be usable will be here. This does _not_ include Emacs or X11 or TeX or any other large applications. These packages only constitute the bare infrastructure. * _Standard_ packages are standard on any Linux system, including a reasonably small but not too limited character-mode system. This is what will install by default if users do not select anything else. It does not include many large applications, but it does include Emacs (this is more a piece of infrastructure than an application) and a reasonable subset of TeX and LaTeX (if this turns out to be possible without X). * _Optional_ packages include all those that you might reasonably want to install even if you are unfamiliar with them, and if you don't have have specialized requirements. This includes X11, a full TeX distribution, and lots of applications. * _Extra_: packages that either conflict with others with higher priorities, are only likely to be useful if you already know what they are, or have specialized requirements that make them unsuitable for "Optional". 2.2.7. Virtual packages ----------------------- A virtual package is a generic name that applies to any one of a group of packages, all of which provide similar basic functionality. For example, both the `tin' and `trn' programs are news readers, and should therefore satisfy any dependency of a program that required a news reader on a system, in order to work or to be useful. They are therefore both said to provide the "virtual package" called `news-reader'. Similarly, `exim' and `sendmail' both provide the functionality of a mail transport agent. They are therefore said to provide the virtual package "mail transport agent". If either one is installed, then any program depending on the installation of a `mail-transport-agent' will be satisfied by the existence of this virtual package. Debian has a mechanism so that, if more than one package which provides the same virtual package is installed on a system, the system administrator can set one as the preferred package. The relevant command is `update-alternatives', and is described further in Sección 6.4.3, `Alternative commands'. 2.2.8. Package dependencies --------------------------- The Debian package system has a range of package "dependencies" which are designed to indicate (in a single flag) the level at which Program A can operate independently of the existence of Program B on a given system: * Package A _depends_ on Package B if B absolutely must be installed in order to run A. In some cases, A depends not only on B, but on a specific version of B. In this case, the version dependency is usually a lower limit, in the sense that A depends on any version of B more recent than some specified version. * Package A _recommends_ Package B if the package maintainer judges that most users would not want A without also having the functionality provided by B. * Package A _suggests_ Package B if B contains files that are related to (and usually enhance) the functionality of A. * Package A _conflicts_ with Package B when A will not operate if B is installed on the system. Most often, conflicts are cases where A contains files which are an improvement over those in B. "Conflicts" are often combined with "replaces". * Package A _replaces_ Package B when files installed by B are removed and (in some cases) overwritten by files in A. * Package A _provides_ Package B when all of the files and functionality of B are incorporated into A. This mechanism provides a way for users with constrained disk space to get only that part of package A which they really need. More detailed information on the use of each these terms can be found in the Packaging manual and the Policy manual. Note that `dselect' has more fine-grained control over packages specified by _recommends_ and _suggests_ than `apt-get', which simply pulls all the packages specified by _depends_ and leaves all the packages specified by _recommends_ and _suggests_. Both programs in modern form use APT as their back end. 2.2.9. The meaning of Pre-depends --------------------------------- "Pre-depends" is a special dependency. In the case of an ordinary package, `dpkg' will unpack its archive file (i.e., its `.deb' file) independently of whether or not the files on which it depends exist on the system. Simplistically, unpacking means that `dpkg' will extract the files from the archive file that were meant to be installed on your file system, and put them in place. If those packages _depend_ on the existence of some other packages on your system, `dpkg' will refuse to complete the installation (by executing its "configure" action) until the other packages are installed. However, for some packages, `dpkg' will refuse even to unpack them until certain dependencies are resolved. Such packages are said to "pre-depend" on the presence of some other package(s). The Debian project provided this mechanism to support the safe upgrading of systems from `a.out' format to `ELF' format, where the _order_ in which packages were unpacked was critical. There are other large upgrade situations where this method is useful, e.g. for packages with "required" priority and their libc dependency. Once again, more detailed information about this can be found in the Packaging manual. 2.2.10. Package status ---------------------- Package status can be "unknown", "install", "remove", "purge", or "hold". These "want" flags tell what the user wanted to do with a package (as indicated either by the user's actions in the "Select" section of `dselect', or by the user's direct invocations of `dpkg'). Their meanings are: * unknown - the user has never indicated whether he wants the package. * install - the user wants the package installed or upgraded. * remove - the user wants the package removed, but does not want to remove any existing configuration files. * purge - the user wants the package to be removed completely, including its configuration files. * hold - the user wants this package not to be processed, i.e., he wants to keep the current version with the current status whatever that is. 2.2.11. Holding back packages from an upgrade --------------------------------------------- There are two mechanisms of holding back packages from the upgrade, through `dpkg', or, in woody, through APT. With `dpkg', first export the list of package selections: dpkg --get-selections \* > Then edit the resulting file `', changing the line containing the package you wish to hold, e.g. `libc6', from this: libc6 install to this: libc6 hold Save the file, and reload it into `dpkg' database with: dpkg --set-selections < Or, if you know the package name to hold, simply run: echo libc6 hold | dpkg --set-selections This process holds packages at the install process of each package file. The same effect can be obtained through `dselect'. Simply enter the [S]elect screen, find the package you wish to hold in its present state, and press the `=' key (or `H'). The changes will take effect immediately after you exit the [S]elect screen. The APT system in the woody distribution has a new alternative mechanism for holding packages during the archive retrieval process using `Pin-Priority'. See the manual page apt_preferences(5). See http://www.debian.org/doc/manuals/apt-howto/ or `apt-howto' package. 2.2.12. Source packages ----------------------- Source packages are distributed in a directory called `source', and you can either download them manually, or use apt-get source to fetch them (see the apt-get(8) manual page on how to set up APT for doing that). 2.2.13. Building binary packages from a source package ------------------------------------------------------ For a package `', you will need all of `.dsc', `.tar.gz' and `.gz' to compile the source (note: there is no `.diff.gz' for a Debian native package). Once you have them, if you have the `dpkg-dev' package installed, the command $ dpkg-source -x .dsc will extract the package into a directory called `'. If you want just to compile the package, you may cd into the `foo-version' directory and issue the command $ fakeroot debian/rules build to build the program, then $ fakeroot debian/rules binary as root, to build the package, and then # su -c "dpkg -i ../.deb" to install the newly built package. See Sección 6.3.9, `Port a package to the "stable" system'. 2.2.14. Creating new Debian packages ------------------------------------ For a more detailed description, read the New Maintainers' Guide, available in the `maint-guide' package, or at http://www.debian.org/doc/manuals/maint-guide/. 2.3. Upgrading a Debian system ------------------------------ One of Debian's goals is to provide a consistent upgrade path and a secure upgrade process, and we always do our best to make a new release smoothly upgradable from the previous ones. Packages will alert the user when there are important notices during the upgrade process, and will often provide a solution to a possible problem. You should also read the Release Notes, the document that describes the details of specific upgrades, shipped on all Debian CDs, and available on the WWW at http://www.debian.org/releases/stable/releasenotes or http://www.debian.org/releases/testing/releasenotes. A practical guide to upgrades is provided in Capítulo 6, `Gestión de paquetes Debian'. This section describes the fundamental details. 2.3.1. Methods for upgrading a Debian system -------------------------------------------- One could simply execute an anonymous FTP or `wget' call to a Debian archive, peruse the directories until one finds the desired file, fetch it, and finally install it using `dpkg'. Note that `dpkg' will install upgrade files in place, even on a running system. Sometimes, a revised package will require the installation of a newly revised version of another package, in which case the installation will fail until/unless the other package is installed. Many people find this approach much too time-consuming, since Debian evolves so quickly --- typically, a dozen or more new packages are uploaded every week. This number is larger just before a new major release. To deal with this avalanche, many people prefer to use an automated program. Several specialized package management tools are available for this purpose. 2.3.2. Package management tools overview ---------------------------------------- The Debian package management system has two objectives: the manipulation of the package file itself and the retrieval of package files from the Debian archive. `dpkg' performs the former task, APT and `dselect' the latter. 2.3.3. `dpkg' ------------- This is the main program for manipulating package files; read dpkg(8) for a full description. `dpkg' comes with several primitive supplemental programs. * dpkg-deb: Manipulate `.deb' files. dpkg-deb(1) * dpkg-ftp: An older package file retrieval command. dpkg-ftp(1) * dpkg-mountable: An older package file retrieval command. dpkg-mountable(1) * dpkg-split: Splits a large package into smaller files. dpkg-split(1) `dpkg-ftp' and `dpkg-mountable' have been superseded by the introduction of the APT system. 2.3.4. APT ---------- APT is an advanced interface to the Debian packaging system. `apt-get', `apt-cache' and `apt-cdrom' are the command-line tools for handling packages. These also function as the user's "back-end" programs to other tools, such as `dselect' and `aptitude'. For more information, install the `apt' package and read apt-get(8), apt-cache(8), apt-cdrom(8), apt.conf(5), sources.list(5), apt_preferences(5) (woody), and `/usr/share/doc/apt/guide.html/index.html'. An alternative source of information is the APT HOWTO (http://www.debian.org/doc/manuals/apt-howto/). This can be installed by `apt-howto' at `/usr/share/doc/apt-howto/en/apt-howto-en.html/index.html'. `apt-get upgrade' and `apt-get dist-upgrade' have a tendency to pull in all packages listed under "Suggests:". To avoid this, use `dselect'. 2.3.5. `dselect' ---------------- This program is a menu-driven user interface to the Debian package management system. It is particularly useful for first-time installations and large-scale upgrades. See Sección 6.3.6, ``dselect' -- global configuration'. For more information, install the `install-doc' package and read `/usr/share/doc/install-doc/dselect-beginner.en.html' or dselect Documentation for Beginners (http://www.debian.org/releases/woody/i386/dselect-beginner). 2.3.6. Upgrade a running system ------------------------------- The kernel (file system) in Debian systems supports replacing files even while they're being used. We also provide a program called `start-stop-daemon' which is used to start daemons at boot time or to stop daemons when the kernel runlevel is changed (e.g., from multi-user to single-user or to halt). The same program is used by installation scripts when a new package containing a daemon is installed, to stop running daemons, and restart them as necessary. Note that the Debian system does not require use of the single-user mode to upgrade a running system. 2.3.7. Downloaded and cached `.deb' archive files ------------------------------------------------- If you have manually downloaded the files to your disk (which is not absolutely necessary, see above for the description of `dpkg-ftp' or APT), then after you have installed the packages, you can remove them from your system. If APT is used, these files are cached in the `/var/cache/apt/archives/' directory. You may erase them after installation (`apt-get clean') or copy them to another machine's `/var/cache/apt/archives/' directory to save downloading during subsequent installations. 2.3.8. Record-keeping for upgrades ---------------------------------- `dpkg' keeps a record of the packages that have been unpacked, configured, removed, and/or purged, but does not (currently) keep a log of terminal activity that occurred while a package was being so manipulated. The simplest way to work around this is to run your `dpkg', `dselect', `apt-get', etc., sessions within the script(1) program. 2.4. The Debian boot process ---------------------------- 2.4.1. The `init' program ------------------------- Like all Unices, Debian boots up by executing the program `init'. The configuration file for `init' (which is `/etc/inittab') specifies that the first script to be executed should be `/etc/init.d/rcS'. This script runs all of the scripts in `/etc/rcS.d/' by sourcing or forking subprocess depending on their file extension to perform initialization such as to check and to mount file systems, to load modules, to start the network services, to set the clock, and to perform other initialization. Then, for compatibility, it runs the files (except those with a `.' in the filename) in `/etc/rc.boot/' too. Any scripts in the latter directory are usually reserved for system administrator use, and using them in packages is deprecated. See Sección 9.1, `System initialization hints' for more info. 2.4.2. Runlevels ---------------- After completing the boot process, `init' executes all start scripts in a directory specified by the default runlevel (this runlevel is given by the entry for `id' in `/etc/inittab'). Like most System V compatible Unices, Linux has 7 runlevels: * 0 (halt the system), * 1 (single-user mode), * 2 through 5 (various multi-user modes), and * 6 (reboot the system). Debian systems come with `id=2', which indicates that the default runlevel will be 2 when the multi-user state is entered, and the scripts in `/etc/rc2.d/' will be run. In fact, the scripts in any of the directories `/etc/rc.d/' are just symbolic links back to scripts in `/etc/init.d/'. However, the _names_ of the files in each of the `/etc/rc.d/' directories are selected to indicate the _way_ the scripts in `/etc/init.d/' will be run. Specifically, before entering any runlevel, all the scripts beginning with `K' are run; these scripts kill services. Then all the scripts beginning with `S' are run; these scripts start services. The two-digit number following the `K' or `S' indicates the order in which the script is run. Lower-numbered scripts are executed first. This approach works because the scripts in `/etc/init.d/' all take an argument which can be either "start", "stop", "reload", "restart" or "force-reload" and will then do the task indicated by the argument. These scripts can be used even after a system has been booted, to control various processes. For example, with the argument "reload" the command # /etc/init.d/sendmail reload sends the sendmail daemon a signal to reread its configuration file. 2.4.3. Customizing the boot process ----------------------------------- Debian does not use a BSD-style `rc.local' directory to customize the boot process; what facilities are provided for doing this? Suppose a system needs to execute script `foo' on start-up, or on entry to a particular (System V) runlevel. Then the system administrator should: 1. Enter the script `foo' into the directory `/etc/init.d/'. 2. Run the Debian command `update-rc.d' with appropriate arguments, to set up links between the (command-line-specified) directories `rc.d' and `/etc/init.d/foo'. Here, is a number from 0 through 6 that corresponds to one of the System V runlevels. 3. Reboot the system. The command `update-rc.d' will set up links between files in the directories `rc.d' and the script in `/etc/init.d/'. Each link will begin with an `S' or a `K', followed by a number, followed by the name of the script. Scripts beginning with `S' in `/etc/rcN.d/' are executed when runlevel `N' is entered. Scripts beginning with a `K' are executed when leaving runlevel `N'. One might, for example, cause the script `foo' to execute at boot-up, by putting it in `/etc/init.d/' and installing the links with `update-rc.d foo defaults 19'. The argument `defaults' refers to the default runlevels, which are 2 through 5. The argument `19' ensures that `foo' is called before any scripts containing numbers 20 or larger. 2.5. Supporting diversity ------------------------- Debian offers several avenues to accommodate any wishes of the system administrator without breaking the system. * `dpkg-divert', see Sección 6.4.1, `dpkg-divert command'. * `equivs', see Sección 6.4.2, ``equivs' package'. * `update-alternative', see Sección 6.4.3, `Alternative commands'. * `make-kpkg' can accommodate many boot loaders. See make-kpkg(1) and Sección 7.1.1, `Debian standard method'. Any files under `/usr/local/' belong to the system administrator and Debian will not touch them. Most (or all) files under `/etc' are `conffiles' and Debian will not overwrite them upon upgrade unless the system administrator requests so explicitly. 2.6. Internationalization ------------------------- Debian system is internationalized and supports conventions which depend on the language and the cultural rules. Keyboard Debian is distributed with keymaps for nearly two dozen keyboards, and with utilities (in the `kbd', package or `console-tools' package with `kbd-compat' package) and to install, view, and modify the tables. The installation prompts the user to specify the keyboard he will use. Data The vast majority of Debian software packages support handling non-US-ASCII characters through `locale' technology offered by Glibc. * Just 8-bit clean: practically all programs * other Latin languages (e.g. ISO-8859-1 or ISO-8859-2): majority of programs * multi-byte languages such as Chinese Japanese or Korean: many new applications Note that Debian does _not_ come with all available locales pre-compiled. Check `/usr/lib/locale' to see which locales (besides the default "C") are compiled for your system. See locale(7), locale-gen(8) and Sección 9.7, `Localization'. Display X can support all fonts. The list includes not only all the 8 bit fonts but also 16 bit fonts such as Chinese Japanese or Korean. See Sección 9.4.10, `CJK and X'. Mamual Currently, support for German-, Spanish-, Finnish-, French-, Hungarian-, Italian-, Japanese-, Korean- and Polish-language manual pages is provided through the `manpages-' packages (where is the two-letter ISO country code). To access an NLS manual page, the user must set the shell LC_MESSAGES variable to the appropriate string. For example, in the case of the Italian-language manual pages, LC_MESSAGES needs to be set to `it'. The `man' program will then search for Italian manual pages under `/usr/share/man/it/'. 2.7. Debian and the kernel -------------------------- See Capítulo 7, `The Linux kernel under Debian'. 2.7.1. Compiling a kernel from non-Debian source ------------------------------------------------ One has to understand the Debian policy with respect to headers. The Debian C libraries are built with the most recent _stable_ releases of the _kernel_ headers. For example, the Debian-1.2 release used version 5.4.13 of the headers. This practice contrasts with the Linux kernel source packages distributed at all Linux FTP archive sites, which use even more recent versions of the headers. The kernel headers distributed with the kernel source are located in `/usr/include/linux/include/'. If you need to compile a program with kernel headers that are newer than those provided by `libc6-dev', then you must add `-I/usr/src/linux/include/' to your command line when compiling. This came up at one point, for example, with the packaging of the automounter daemon (`amd'). When new kernels changed some internals dealing with NFS, `amd' needed to know about them. This required the inclusion of the latest kernel headers. 2.7.2. Tools to build custom kernels ------------------------------------ Users who wish to (or must) build a custom kernel are encouraged to download the package `kernel-package'. This package contains the script to build the kernel package, and provides the capability to create a Debian kernel-image package just by running the command # make-kpkg kernel_image in the top-level kernel source directory. Help is available by executing the command # make-kpkg --help and through the manual page make-kpkg(8) and Capítulo 7, `The Linux kernel under Debian'. Users must separately download the source code for the most recent kernel (or the kernel of their choice) from their favorite Linux archive site, unless a kernel-source- package is available (where stands for the kernel version). The Debian `initrd' boot script requires a special kernel patch called `initrd'; see http://bugs.debian.org/149236. Detailed instructions for using the `kernel-package' package are given in the file `/usr/doc/kernel-package/README'. 2.7.3. Alternative boot loaders ------------------------------- To employ alternative boot loaders such as `grub' or `loadlin', copy the compiled Linux kernel `bzimage' to other locations (e.g., to `/boot/grub' or to an MS-DOS partition). 2.7.4. Custom boot floppies --------------------------- The task of making a custom boot floppy is greatly aided by the Debian package `boot-floppies', normally found in the `admin' section of the Debian FTP archive. Shell scripts in this package produce boot floppies in `syslinux' format. These are MS-DOS formatted floppies whose master boot records have been altered so that they boot Linux directly (or whatever other operating system has been defined in the `syslinux.cfg' file on the floppy). Other scripts in this package produce emergency root disks and can even reproduce the base disks. You will find more information about this in the `/usr/doc/boot-floppies/README' file after installing the `boot-floppies' package. 2.7.5. Special provisions for dealing with modules -------------------------------------------------- Debian's `modconf' package provides a shell script (`/usr/sbin/modconf') which can be used to customize the configuration of modules. This script presents a menu-based interface, prompting the user for particulars on the loadable device drivers in his system. The responses are used to customize the file `/etc/modules.conf' (which lists aliases, and other arguments that must be used in conjunction with various modules) through files in `/etc/modutils/', and `/etc/modules' (which lists the modules that must be loaded at boot time). Like the (new) Configure.help files that are now available to support the construction of custom kernels, the `modconf' package comes with a series of help files (in `/usr/lib/modules_help/') which provide detailed information on appropriate arguments for each of the modules. See Sección 7.2, `The modularized 2.4 kernel' for examples. 2.7.6. De-installing an old kernel package ------------------------------------------ The `kernel-image-.prerm' script checks to see whether the kernel you are currently running is the same as the kernel you are trying to de-install. Therefore you can safely remove unwanted kernel image packages using this command: dpkg --purge --force-remove-essential kernel-image- (replace with your kernel version and revision number, of course) ------------------------------------------------------------------------------- 3. Debian System installation hints ----------------------------------- Official documentation for installing Debian is located at http://www.debian.org/releases/stable/, and http://www.debian.org/releases/stable/installmanual. The development versions are located at http://www.debian.org/releases/testing/, and http://www.debian.org/releases/testing/installmanual. Although this "Guía de referencia Debian" dates from the days of the potato release, most of its contents are aimed at a Debian Woody (3.0r0) installation. 3.1. General Linux system installation hints -------------------------------------------- In order to minimize risks associated with "testing" and "unstable" packages, it is a good practice to set up your main Linux system for dual booting along with another small stable Linux system. 3.1.1. Hardware compatibility basics ------------------------------------ Linux is compatible with most PC hardware and can be installed to almost any system. For me it was as easy as installing Windoze 95/98/Me. The hardware compatibility list just seems to keep growing. If you have a laptop PC, check Linux on Laptops (http://www.linux-laptop.net/) for installation pointers by brand and model. My recommendation for desktop PC hardware is "Just be conservative": * SCSI rather than IDE for work, IDE/ATAPI HD for private use. * IDE/ATAPI CD-ROM (or CD-RW). * PCI rather than ISA, especially for the network card (NIC). * Use a cheap NIC. Tulip for PCI, NE2000 for ISA are good. * Avoid PCMCIA (notebook) as your first Linux install. * No USB keyboard, mouse . . . unless you want a challenge. For a slow machine, yanking out the hard drive and plugging it into another faster machine for installation is a good idea. 3.1.2. Determining a PC's hardware and chip set ----------------------------------------------- During installation, one will be asked to identify hardware or chip set. Sometimes that information may not seem easy to find. Here is my hint: 1. Open a PC box and check inside. 2. Record the numbers on the large chips on the graphics card, network card, chip near serial ports, chip near IDE ports. 3. Record card names printed on the back of the PCI and ISA cards. 3.1.3. Determining a PC's hardware via Debian --------------------------------------------- The following commands on a Linux system should give some idea of actual hardware and configuration. $ /sbin/lspci -v |pager $ pager /proc/pci $ pager /proc/interrupts $ pager /proc/ioports These commands can be run during the install process from the console screen by pressing ALT-F2. 3.1.4. Determining a PC's hardware via other OSs ------------------------------------------------ Hardware information can also be obtained from other OSs. Install another commercial Linux distribution. Hardware detection on those tends to be better than on Debian as of now. This may change as woody evolves. Install Windows. Hardware configuration can be obtained by right-clicking "My Computer" to get to Properties / Device Manager. Record all resource information such as IRQ, I/O port address, and DMA. Some old ISA cards may need to be configured under DOS and used accordingly. 3.1.5. A Lilo myth ------------------ Lilo is limited to 1024 cylinders. ---WRONG ! The newer `lilo' used in Debian Potato has lba32 support. If the BIOS of your motherboard is recent enough to support lba32, `lilo' should be able to load beyond the old 1024-cylinder limitation. Just make sure to add a line reading "lba32" somewhere near the beginning of your `lilo.conf' file if you have kept an old `lilo.conf.' 3.1.6. Choice of boot floppies (potato) --------------------------------------- An IDEPCI disk set is usually best if you are installing on a desktop. The IDEPCI kernel on the IDEPCI boot disk enables PCI network cards; thus you can get almost everything off the network. Only 2 floppy disks (boot and root) are needed. For special systems, create a custom rescue disk: replace the kernel image named "linux" on the Debian rescue disk by overwriting it with another compressed kernel image compiled offsite for the machine. Details are documented in `readme.txt' on the rescue disk. The rescue floppy uses the MS-DOS filesystem, so you can use any system to read and edit it. This should make life easier for people with a special network card, etc. If you have a PCMCIA network card, configure it in the PCMCIA setup; do not set it up in the standard network setup. 3.1.7. Installation ------------------- Follow the official instruction described in http://www.debian.org/releases/stable/installmanual or http://www.debian.org/releases/testing/installmanual (work in progress). Quick hints for a potato installation from the author's personal experience are: 1. Prepare rescue/root(/driver) disk set. (IDEPCI for a desktop system) 2. Boot with rescue FD and root FD. 3. Run `fdisk' and `fsck'; mount swap, root, tmp, var, home, usr, etc. (no 2.0 kernel support) 4. Install OS. (For IDEPCI, network installable) 5. If the standard kernel FD is used, install driver disks here. 6. Configure drivers. (No action option, if IDE) 7. Install base system from network or FD/CD. (`base2_2.tgz' for potato, `debootstrap' for woody) 8. Configure base system. 9. Do not install `lilo' as MBR and use multi-boot mbr. 10. Reboot the system. (Do not bother creating a boot FD) 11. MD5 passwords "yes", shadow passwords "yes"; set up an ordinary user account 12. Install "advanced" (dselect **) 13. Select minimum sets to your taste. Exclude emacs, nvi, tex, telnet, talk(d); include mc, vim, kernel-image-2.2.18pre21 (full kernel if IDE disk is used to install) ... 14. Install (download all...) 15. All configuration questions = "y" (replace current) 16. exim: select 2 for machine behind a firewall, 1 for an Internet machine For more information on dselect, see Sección 6.3.6, ``dselect' -- global configuration'. 3.1.8. Hosts and IP to use for LAN ---------------------------------- Example of LAN configuration (C subnet: 192.168.1.0/24): Internet | +--- External ISP provides POP service (accessed by fetchmail) | Access point ISP provides DHCP service and SMTP relay service | : Cable modem (Dial-up) | : LAN Gateway machine external port: eth0 (IP given by ISP's DHCP) use old notebook PC (IBM Thinkpad, 486 DX2 50 MHz, 20 MB RAM) run Linux 2.4 kernel with ext3 filesystem. run "ipmasq" package (with stronger patch, NAT and firewall) run "dhcp-client" package configured for eth0 (override DNS setting) run "dhcp" package configured for eth1 run "exim" as the smarthost (mode 2) run "fetchmail" with a long interval (fall back) run "bind" as the cache nameserver for Internet from LAN as authoritative nameserver for LAN domain from LAN run "ssh" on port 22 and 8080 (connect from anywhere) run "squid" as the cache server for the Debian archive (for APT) LAN Gateway machine internal port: eth1 (IP = 192.168.1.1, fixed) | +--- LAN Switch (10 base T) ---+ | | Some fixed IP clients on LAN Some DHCP clients on LAN (IP = 192.168.1.2-127, fixed) (IP = 192.168.1.128-200, dynamic) See Capítulo 10, `Building a gateway with a Debian system' for the details of configuring the LAN gateway server. 3.1.9. User accounts -------------------- In order to have a consistent feel across machines, the first few accounts are always the same in my system. I always create a first user account with a name like "admin" (uid=1000). I forward all root email there. This account is made to be a member of the "staff" group, which is given a good amount of root privilege through the `sudo' command. See Sección 4.2.2, `Añadir una cuenta de usuario' for details. 3.1.10. Hard disk partition and NFS setup ----------------------------------------- I prefer to use different partitions for different directory trees to limit damage upon system crash. E.g., / == (/ + /boot + /bin + /sbin) == 50MB+ /tmp == 100MB+ /var == 100MB+ /home == 100MB+ /usr == 700MB+ with X /usr/local == 100MB The size of the `/usr' directory is very dependent on X-window applications and documentation. `/usr' can be 300MB if one runs a console terminal only, whereas 2GB--3GB is not an unusual size if one has installed many Gnome applications. When `/usr' grows too big, moving out `/usr/share/' to a different partition is the most effective cure. With the new large pre-packaged Linux 2.4 kernels, `/' may need more than 200MB. For example, the current status of my Internet gateway machine is as follows (output of the `df -h' command): Filesystem Size Used Avail Use% Mounted on /dev/hda3 300M 106M 179M 38% / /dev/hda7 100M 12M 82M 13% /home /dev/hda8 596M 53M 513M 10% /var /dev/hda6 100M 834k 94M 1% /var/lib/cvs /dev/hda9 596M 222M 343M 40% /usr /dev/hda10 596M 130M 436M 23% /var/cache/apt/archives /dev/hda11 1.5G 204M 1.2G 14% /var/spool/squid (The large area reserved for `/var/spool/squid' is for a proxy cache for package downloading.) Following is `fdisk -l' output to provide an idea of partition structure: # fdisk -l /dev/hda # comment /dev/hda1 1 41 309928+ 6 FAT16 # DOS /dev/hda2 42 84 325080 83 Linux # (not used) /dev/hda3 * 85 126 317520 83 Linux # Main /dev/hda4 127 629 3802680 5 Extended /dev/hda5 127 143 128488+ 82 Linux swap /dev/hda6 144 157 105808+ 83 Linux /dev/hda7 158 171 105808+ 83 Linux /dev/hda8 172 253 619888+ 83 Linux /dev/hda9 254 335 619888+ 83 Linux /dev/hda10 336 417 619888+ 83 Linux /dev/hda11 418 629 1602688+ 83 Linux A few unused partitions exist. These are for installing a second Linux distribution or as expansion space for growing directory trees. If you have more than 2 hard disks, make a swap partition for each drive to gain maximum performance. Mounting the above filesystems properly is accomplished with the following `/etc/fstab': # /etc/fstab: static file system information. # # file system mount point type options dump pass /dev/hda3 / ext2 defaults,errors=remount-ro 0 1 /dev/hda5 none swap sw 0 0 proc /proc proc defaults 0 0 /dev/fd0 /floppy auto defaults,user,noauto 0 0 /dev/cdrom /cdrom iso9660 defaults,ro,user,noauto 0 0 # # keep partition separate /dev/hda7 /home ext2 rw 0 2 /dev/hda8 /var ext2 rw 0 2 /dev/hda6 /var/lib/cvs ext2 rw 0 2 /dev/hda9 /usr ext2 rw 0 2 /dev/hda10 /var/cache/apt/archives ext2 rw 0 2 # very big partition for proxy cache /dev/hda11 /var/spool/squid ext2 rw 0 2 # backup bootable DOS /dev/hda1 /mnt/dos vfat rw,noauto 0 0 # backup bootable Linux system (not done) /dev/hda2 /mnt/linux ext2 rw,noauto 0 0 # # nfs mounts mickey:/ /mnt/mickey nfs ro,noauto,intr 0 0 goofy:/ /mnt/goofy nfs ro,noauto,intr 0 0 # minnie:/ /mnt/minnie smbfs ro,soft,intr,credentials={filename} 0 2 Here I use `noauto,intr' combined with the default `hard' option for nfs. This way, it is possible to recover from a hung process due to a dead connection using Control-C. For a Windows machine connected with Samba (smbfs), `rw,auto,soft,intr' may be good idea. (FIXME) Check-out also autofs (FIXME) For a floppy drive, using `noauto,rw,sync,user,exec' instead prevents file corruption after accidental disk eject before unmount, but this slows the write process. The external Linux NFS server (goofy) resides behind a firewall (gateway). I have a very relaxed security policy on my LAN since I am the only user. To enable NFS access, the NFS server side needs to add `/etc/exports' as follows: # /etc/exports: the access control list for file systems which may be exported # to NFS clients. See exports(5). / (rw,no_root_squash) This is needed to activate the NFS server in addition to installing and activating the NFS server and client. For simplicity, I usually create a single partition of 2GB for an experimental and/or secondary lazy Linux install. I optionally share swap and `/tmp' partitions for these installs. A multi-partition scheme is too involved for these usages. If only a simple console system is needed, 500MB may be more than sufficient. 3.1.11. DRAM memory guidelines ------------------------------ Following are rough guidelines for DRAM. 4 MB: Bare minimum for Linux kernel to function. 16 MB: Minimum for reasonable console system. 32 MB: Minimum for simple X system. 64 MB: Minimum for X system with GNOME/KDE. 128 MB: Comfortable for X system with GNOME/KDE. 256+MB: Why not if you can afford it? DRAM is cheap. Using the boot option `mem=4m' (or lilo `append="mem=4m"') will show how the system would perform with 4MB of memory installed. A lilo boot parameter is needed for a system containing more than 64MB memory with an old BIOS. 3.1.12. Swap space ------------------ I use the following guidelines: Total swap = min(1x-2x installed RAM, 128 MB - 1 GB) Each swap < 128 MB Keep them on different drives. Use a central portion of the hard disk when possible. Even if you never need it, some swap space (128MB) is desirable so the system will slow down before it crashes hard with a program which leaks memory. 3.2. Bash configuration ----------------------- I modify shell start-up scripts to my taste across the system: /etc/bash.bashrc Replace with private one /etc/profile Keep distribution copy ( \w -> \W) /etc/skel/.bashrc Replace with private copy /etc/skel/.profile Replace with private copy /etc/skel/.bash_profile Replace with private copy ~/.bashrc Replace with private copy for all accounts ~/.profile Replace with private copy for all accounts ~/.bash_profile Replace with private copy for all accounts See details in my example scripts (examples/). I like a transparent system, so I set `umask' to 002 or 022. `PATH' is set by the following configuration files in this order: /etc/login.defs - before the shell sets PATH /etc/profile (may call /etc/bash.bashrc) ~/.bash_profile (may call ~/.bashrc) 3.3. Mouse configuration ------------------------ In the case of a PS/2-connector mouse on an ATX motherboard, the signal flow should be: mouse -> /dev/psaux -> gpm -> /dev/gpmdata = /dev/mouse -> X This allows the keyboard and mouse to be unplugged and reinitialized by restarting gpm upon reconnect. X will stay alive! For a Logitech 3-button PS2 mouse, configuration combinations should be: /etc/gpm.conf /etc/X11/X86Config or X86Config4 ============================================================= device=/dev/psaux Section "Pointer" responsiveness= Protocol "IntelliMouse" repeat_type=ms3 Device "/dev/gpmdata" type=ps2auto (woody) append="" -------------------------------------------------------------- device=/dev/psaux Section "Pointer" responsiveness= Protocol "IntelliMouse" repeat_type=raw Device "/dev/gpmdata" type=ps2auto (woody) append="" If a normal 2-button PS2 mouse is used, set the X protocol to `Microsoft' and enable `Emulate3Buttons'. For a scroll mouse, you can adjust X to the real protocol, such as `IMPS/2'. Create a softlink `/dev/gpmdata' --> `/dev/mouse' to make some configuration utilities happy. See my example scripts for details (examples/). For some recent thin Toshiba notebook PCs: Activate `gpm' before PCMCIA in the System-V init script. This keeps `gpm' from crashing. Weird but true. 3.4. NFS configuration ---------------------- Set up NFS by setting `/etc/exports'. # echo "/ *.domainname-for-lan-hosts(rw,no_root_squash,nohide)" \ >> /etc/exports See my example scripts for details (examples/). 3.5. Samba configuration ------------------------ Setting up Samba with "share" mode is much easier since this creates WfW-type share drives. But it is preferable to set it up with "user" mode. Samba can be configured by `sambaconfig' or `vi': $su -c "sambaconfig" $su -c "vi /etc/samba/smb.conf" See my example scripts for details (examples/). Adding a new user to the smbpasswd file can be done via `smbpasswd': $su -c "smbpasswd -a username" Make sure to use encrypted passwords for best compatibility. Set `os level' according to the following system equivalences (the larger the number, the higher the priority as server): 0: Samba with a loose attitude (will never become a master browser) 1: Wfw 3.1, Win95, Win98, Win/me? 16: Win NT WS 3.51 17: Win NT WS 4.0 32: Win NT SVR 3.51 33: Win NT SVR 4.0 255: Samba with mighty power Make sure that users are members of the group owning the directory that gives shared access and that the directory path has its execution bit set to access. 3.6. Printer configuration -------------------------- You may install LPRng (or GNUlpr) instead of standard `lpr'. # apt-get install lprng enscript gs As of 3/2001 Debian potato2.2r2, `printtool' and `lprngtool' are not in potato. Grab one of these from `woody/binary-all/admin' and `dpkg -i' to install. If Windoze machines use LPRng through Samba, they can access it without GS-filtering through a native Windows printer driver or with GS-filtering through PostScript printer drivers such as Apple LaserWriter. 3.7. Other host configuration hints ----------------------------------- 3.7.1. Install a few more packages and do the basics ---------------------------------------------------- See Sección 6.3.6, ``dselect' -- global configuration'. I usually dump (type `_'): TEX, nvi, ae, lynx, and add (type `+'): vim, ssh, lynx-ssl, mc. Edit `/etc/inittab' to have CTRL-DEL-ALT=halt for easy shutdown. 3.7.2. Modules -------------- Done while configuring drivers during installation. List module names in `/etc/modules'. I also use `lsmod' and `depmod' to control them manually. Also add a few lines in `/etc/modules' to handle ip-masquerading (ftp, etc.) for 2.4 kernels. See my example scripts for details (examples/). 3.7.3. CD-RW basic setup ------------------------ Edit the following files: /etc/lilo.conf (add append="hdc=ide-scsi ignore=hdc", run lilo to activate) /dev/cdrom (softlink # cd /dev; ln -sf scd0 cdrom) /etc/modules (add "ide-scsi" and "sg". If needed "sr" after this.) See Sección 9.3, `CD-writer' for details. 3.7.4. Large memory and auto power-off -------------------------------------- Edit `/etc/lilo.conf' as follows to set boot prompt parameters for large memory (for 2.2 kernels) and auto power-off (for apm): append="mem=128M apm=on apm=power-off" Run `lilo' to install these settings. `apm=power-off' is needed for an SMP-kernel. The same can be done directly by entering options at the boot prompt. See Sección 8.1.4, `Otros trucos con el indicador de arranque'. If apm is compiled as a module, as in Debian default 2.4 kernels, run `# insmod apm power_off=1' after boot or set `/etc/modules' by: # echo "apm power_off=1" >>/etc/modules Alternatively, compiling ACPI support achieves the same goal with newer kernels and seems to be more SMP-friendly (this requires a newer motherboard). The 2.4 kernel on newer motherboards should detect large memory correctly. CONFIG_PM=y CONFIG_ACPI=y ... CONFIG_ACPI_BUSMGR=m CONFIG_ACPI_SYS=m and add the following lines in `/etc/modules' in this order: ospm_busmgr ospm_system Or recompile the kernel with all of the kernel options above set to "y". In any case, none of the boot prompt parameters are needed with ACPI. 3.7.5. Other configuration files to tweak in `/etc' --------------------------------------------------- You may want to add an `/etc/cron.deny' file, missing from the standard Debian install (you can copy `/etc/at.deny'). ------------------------------------------------------------------------------- 4. Tutoriales de Debian ----------------------- Esta sección proporciona una orientación al mundo Linux para aquellos que son realmente novatos. Si ya hace tiempo que usa Linux, considérelo como un repaso. 4.1. Fuentes de información --------------------------- Visite el Proyecto de Documentación Debian (DDP) (http://www.debian.org/doc/) que tiene las referencias más importantes sobre Debian. Muchos de estos documentos se encuentran instalados en `/usr/share/doc/'. También consulte `/usr/share/doc-base/' que proporcionan enlaces a los documentos del sistema. Añada `export CDPATH=.:/usr/share/doc:/usr/src/local' al `~/.bash_profile' para un acceso más cómodo a los directorios de documentación. El Proyecto de documentación Linux (LDP) (http://www.tldp.org/) tiene las referencias más importantes sobre Linux en general. Los contenidos del LDP usualmente están instalados en `/usr/share/doc/HOWTO/'. Navegue por los documentos en forma local y en ftps remotos con la tecla `F9' del Midnight Commander (véase Sección 4.3, `Midnight Commander (MC)'). 4.2. La consola Linux --------------------- 4.2.1. Entrando al sistema -------------------------- En un sistema Linux existen 6 seudo-terminales independientes. Se puede pasar de una a otra presionando simultáneamente la tecla `Alt-izq' con la tecla `F1' - `F6'. Cada seudo-terminal permite el ingreso al sistema en forma independiente a diferentes cuentas. El sistema multi-usuario es una gran característca de los sistemas Unix y resulta muy adictiva. En Unix se considera un buen hábito acceder al sistema como usuario normal para realizar la mayoría de las tareas. Debo reconocer que, por pereza, utilizo la cuenta del superusuario (root) más de lo necesario. Generalmente utilizo una cuenta normal con los comandos `sudo', `super' o `su -c' para obtener accesos limitados de root. 4.2.2. Añadir una cuenta de usuario ----------------------------------- Tras la instalación del sistema, añada un cuenta de usuario normal. Si el nombre de usuario es "penguin", # adduser penguin creará dicha cuenta. Utilice el comando `vigr' para editar el `/etc/group' de la siguiente manera: src:x:40:admin, debian, ... staff:x:50:admin ... Consulte `adduser', `addgroup', `vipw', `vipw -s', `vigr' y `vigr -s' para configurar correctamente a usuarios y grupos. 4.2.3. Cómo apagar el sistema ----------------------------- Al igual que muchos sistemas operativos modernos donde los archivos son almacenados en memoria, Linux necesita apagarse correctamentes antes de poder cortar el suministro eléctrico sin ningún peligro. Veamos el comando para el modo multiusuario: # shutdown -h now Y el siguiente para el modo monousuario: # poweroff -i -f Espere a que aparezca el mensaje "System halted" y a continuación apague la máquina. Si apm está habilitado tanto en la BIOS como en Linux, el sistema se apagará por sí solo. Véase Sección 3.7.4, `Large memory and auto power-off' para más detalles. 4.2.4. Edición en línea de comandos ----------------------------------- El intérprete de comandos por defecto, `bash' tiene la capacidad de navegar por el histórico de comandos. Simplemente utilize la tecla flecha-arriba para entrar en él. Otras combinaciones de teclas importantes para tener en cuenta: Ctrl-C: Finaliza un programa Ctrl-D: Finaliza una entrada Ctrl-S: Detiene la salida por pantalla Ctrl-Q: Reactiva la salida por pantalla Ctrl-Alt-Supr: Reinicia/apaga el sistema (véase /etc/inittab) Lt-pulsar-y-arrastrar-ratón: Selecciona y copia al portapapeles (gpm) Ctrl-pulsar-ratón: Pega el contenido del portapapeles en el lugar donde se encuentra el cursor (gpm) En una consola Linux tipo únicamente funcionan correctamente las teclas `Ctrl' y `Alt' situadas a la izquierda del teclado. 4.2.5. Comandos básicos que se deben tener presente --------------------------------------------------- Los siguientes son comandos básicos de Unix: ls, ls -al, ls -d, pwd, cd, cd ~user, cd -, cat /etc/passwd, less, bg, fg, kill, killall, uname -a, type nombre_comando, sync, netstat, ping, traceroute, top, vi, ps aux, tar, zcat, grep, ifconfig, ... Averigüe su significado escribiendo el comando, usando `man' o `info' seguidos por el nombre del comando. En Linux, muchos comandos muestran una breve ayuda informativa si se los invoca de una de las siguientes maneras: $ nombre_comando --help $ nombre_comando -h `whatis _nombre_comando_' brinda una resumen de cualquier comando del sistema que tenga una entrada en el manual. 4.2.6. Sistema X Window ----------------------- Para iniciar el Sistema X Window desde la consola: # exec startx Pulsando con el botón derecho del ratón sobre la ventana raíz aparecerá un menú desplegable. 4.2.7. Combinaciones de teclas habituales ----------------------------------------- Algunas combinaciones de teclas importantes para tener en cuenta cuando se está en la consola de Linux: Alt-F1/F6: Para cambiar a otra seudo-terminal Ctrl-Alt-F1/ F6: Para cambiar a otra seudo-terminal (desde X-Window, DOSEMU, etc.) Alt-F7: Para volver a X-Window Ctrl-Alt-menos: Cambiar la resolución de la pantalla en X-Window Ctrl-Alt-más: Cambiar la resolución de la pantalla en X-Window en sentido opuesto Ctrl-Alt-Retroceso: Finalizar X-Window Alt-X, Alt-C, Alt-V: En algunos programas como en 'Netscape Composer', las combinaciones de teclas usadas con Ctrl utilizados en Windows/Mac para Cortar, Copiar y Pegar se reemplazan por las mismas combinaciones pero usando la tecla Alt. 4.3. Midnight Commander (MC) ---------------------------- Midnight Commander (MC) es la "navaja suiza" GNU para la consola de Linux y otros entornos de terminales. 4.3.1. Instalar MC ------------------ # apt-get install mc A continuación añada la siguiente función al `~/.bashrc' (o al `/etc/bash.bashrc' que es llamado desde el `.bashrc'). mc () { mkdir -p ~/.mc/tmp 2> /dev/null chmod 700 ~/.mc/tmp MC=~/.mc/tmp/mc-$$ /usr/bin/mc -P "$@" > "$MC" cd "$(cat $MC)" rm -f "$MC" unset MC; } Al salir, esto habilita al MC a cambiar al directorio de trabajo. Si utiliza una terminal como `kon' o `Kterm' para el idioma japonés que emplea determinados caracteres gráficos el agregar la opción `-a' a la línea de comando del MC puede ayudar a evitar problemas. 4.3.2. Iniciar MC ----------------- $ mc MC se encarga de todas las operaciones con archivos mediante menús requiriendo de un mínimo esfuerzo por parte del usuario. 4.3.3. Administrador de archivos -------------------------------- Por defecto, se tienen dos paneles con el listado de archivos de un directorio. Otro modo útil consiste en configurar la ventana derecha para que muestre toda la información referente a los archivos: permisos, tamaño, etc. Los siguientes son algunas teclas esenciales. Con el demonio `gpm' ejecutándose es posible también usar el ratón. Asegúrese de presionar la tecla Mayús para cortar y pegar en el MC. * `F1': Menú de ayuda * `F3': Visor de archivos interno * `F4': Editor interno * `F9': Activar menú desplegable * `F10': Salir del Midnight Commander * `Tab': Moverse entre las dos ventanas * `Insert': Marcar archivo para operaciones con múltiples archivos * `Supr': Borrar archivo (sea cuidadoso---configure MC para el modo de borrado seguro) * Teclas de desplazamiento: No necesita explicación alguna 4.3.4. Trucos para la línea de comandos: ---------------------------------------- * Cualquier comando `cd' cambiará el directorio mostrado en los paneles. * `Control-Enter' o `Alt-Enter' copiará el nombre de un archivo en la línea del comandos. Utilice este atajo con los comandos `cp' o `mv'. * `Alt-Tab' cumple el mismo rol que la tecla TAB en el shell. * Se puede especificar el directorio inicial para ambas ventanas ingresándolos como argumentos del MC; por ejemplo, `mc /etc /root'. * `Esc' + == `Fn' (es decir, `Esc' + `1' = `F1,' etc.; `Esc' + `0' = `F10)' * Tecla `Esc' == tecla `Alt' (= `Meta', `M-'); es decir, escriba `Esc' + `c' para `Alt-c' 4.3.5. Editor ------------- El editor interno sigue un esquema de cortar-y-pegar muy interesante. Con `F3' se marca el comienzo de una selección, un segundo `F3' marca el fin de la misma y resalta el área elegida. A continuación se puede mover el cursor. Si pulsa `F6' el área seleccionada se ubicará donde está el cursor. Presionando `F5' el área se copiará e insertará en dicha posición. `F2' grabará el archivo. Con `F10' se sale del editor. La mayoría de las teclas de desplazamiento funcionan en forma intuitiva. Este editor se puede iniciar directamente junto con un archivo: $ mc -e nombre_archivo_a_editar $ mcedit nombre_archivo_a_editar Si bien no se trata de un editor multiventana se pueden usar múltiples consolas Linux para lograr el mismo efecto. Para copiar entre ventanas, utilice las teclas `Alt-Fn' para alternar entre las consolas virtuales y use "Archivo->Insertar archivo" o "Archivo->Copiar a archivo" para mover una porción de un archivo en otro archivo. El editor interno se puede reemplazar por cualquier editor externo de su preferencia. Asimismo, muchos programas usan las variables de entorno `EDITOR' o `VISUAL' para decidir qué editor usar. Si no se siente cómodo con vim, iguale estas variables a `mcedit' añadiendo las siguientes líneas al `~/.bashrc': ... export EDITOR=mcedit export VISUAL=mcedit ... En lo posible, es recomendable dejarlas en `vim'. Acostumbrarse con los comandos de vi(m) es proceder de forma correcta pués es un editor de uso habitual en el mundo Linux/Unix. 4.3.6. Visor ------------ Es un visor muy sofisticado. Es una excelente herramienta para buscar palabras en un documento. Siempre lo uso para los archivos del directorio `/usr/share/doc'. Esta es la manera más rápida de navegar por la inmensa cantidad de información de Linux. Este visor se puede arrancar directamente de la siguiente manera: $ mc -v nombre_archivo (Obsérvese que algunos paquetes no respetan esta convención y almacenan sus documentos en `/usr/doc') 4.3.7. Inicio automático de programas ------------------------------------- Pulse `Enter' sobre un archivo y el programa apropiado manejará el contenido del archivo. Esta es una característica muy útil del MC. ejecutable: Ejecuta el programa man, archivo html: Deriva el contenido a un visor tar, gz, archivo rpm: Permite ver su contenido incluyendo subdirectorios Para que esto funcione, los archivos no deben ser ejecutables. Cambie su estado usando el comando chmod mediante el menú 'Archivo' del MC si fuese necesario. 4.3.8. Sistema de archivos virtuales FTP ---------------------------------------- Se puede usar el MC para acceder a archivos que se encuentran en Internet via FTP. Vaya al menú presionando `F9,' luego pulse `p' para activar el sistema de archivos virtual FTP. Ingrese la URL de la siguiente manera `nombre_usuario:contraseña@nombre_servidor.nombre_dominio' y se verá al directorio remoto como si fuera local. 4.4. Para saber más ------------------- Existen muy buenas referencias de iniciación Unix sobre el tema. Los libros de O'Reilly son, en general, excelentes guías para prácticamente cualquier tema de informática .Recomiendo _Unix Power Tools_ que está lleno de información. Tips-HOWTO (LDP) es otro recurso para tener en cuenta. ------------------------------------------------------------------------------- 5. Transición hacía Woody ------------------------- 5.1. Preparación para la transición ----------------------------------- Una actualización hacía la version "testing" via la Red es posible mediante el siguiente método (lo mejor es hacer un script como el siguiente go-woody (http://qref.sourceforge.net/quick/examples/go-woody) para lanzar el proceso en un solo comando): # cd /etc/apt # cp -f sources.list sources.old # :>sources.list # cd / # apt-setup noprobe ... select http or ftp # cd /etc/apt # grep -e "^deb " sources.list >sources.deb # grep -e "^deb-" sources.list >sources.src # sed -e "s/^d/#d/" \ > /usr/share/doc/apt/examples/sources.list > >sources.list # sed -e "s/stable/testing/" \ > sources.deb >>sources.list # apt-get update # apt-get install apt apt-utils # cat >preferences < Package: * > Pin: release a=testing > Pin-Priority: 700 > > Package: * > Pin: release a=unstable > Pin-Priority: 70 > > EOF # sed -e "s/stable/unstable/" sources.deb \ > >>sources.list # sed -e "s/stable/unstable/" sources.src | \ > sed -e "s/^deb-/#deb-/" >>sources.list Una guía para `/etc/apt/preferences' (consulte apt_preferences(5)): track stable: cambiar Pin-Priority de testing a 80 track testing: dejar como está (instalar unstable por /unstable) track testing(unstable): cambiar Pin-Priority de unstable a 600 track unstable(testing): cambiar Pin-Priority de unstable a 800 Esta tabla sirve para decidir el orden de la variable Pin-Priority según el orden de aparición (de arriba a abajo) y esto siguiendo el orden de transición de una versión distribuable a una versión "freeze". Asegúrese de configurar `apt' para utilizar un proxy, si necesario, configurando la variable `http_proxy' o completando la valor http en el fichero `/etc/apt/apt.conf'. La procedimiento descrito en esta sección solo actualiza `apt' y los paquetes necesarios para evitar problemas de dependencias. Since this upgrade method uses `apt-get', its handling of _recommends_ and _suggests_ is limited. Read Sección 2.2.8, `Package dependencies' and use `dselect' instead to achieve fine-grained control. 5.2. Actualización a Woody -------------------------- Después de la preparación precedente utilize los comandos: # apt-get update # siempre lanzar este comando antes del "upgrade" ... este comando sirve para actualizar todo el sistema con los paquetes sugeridos. # apt-get -u dist-upgrade ... para actualizar el sistema y guardar la configuración dselect actual. # apt-get -u dselect-upgrade # utiliza la configuración dselect para actualizar 5.3. Configuración de Woody --------------------------- Esto no sera necesario a medida que Woody se mejore. Para un sistema recientemente instalado con Woody, edite el fichero `/etc/apt/sources.list', `/etc/apt/apt.conf', y `/etc/apt/preferences' para conseguir la misma estructura que la descrita en las secciones precedentes. 5.4. `sources.list' Optimizado ------------------------------ Optimize `sources.list' probando la respuesta (latency) y anchura de banda (bandwidth) de cada sitio. Ejemplo utilizando apt-spy: # apt-get install apt-spy # cd /etc/apt ; mv sources.list sources.list.org # apt-spy -d testing -l sources.apt ------------------------------------------------------------------------------- 6. Gestión de paquetes Debian ----------------------------- Asegúrese de configurar un proxy HTTP local utilizando `squid' para los paquetes bajados con APT. Esto mejora considerablemente las actualizaciones via la Red, especialment con varios sistemas Debian en la LAN. Este documento está basado en el sistema Woody pero tambíen se aplica a Potato (excepto para apt_preferences(5) y asuntos relativos a `/etc/preferences)'). 6.1. Introducción ----------------- Si esto es mucho pedir, lea este documento primero y empieze a disfrutar de la potencia de Debian con testing/unstable :-) 6.1.1. Herramientas principales ------------------------------- dselect - Gestion de paquetes via menu (primer nivel) apt-get - Instala un paquete (package-archive centric, APT) dpkg - Instala un paquete (package-file centric) aptitude & deity - Futuros remplazos para dselect (GUI APT) Estas herramientas no son todas de mismo nivel. `dselect' se ejecuta por encima de APT (las líneas de comando son: `apt-get') y `dpkg'. Cuando se utilize `dselect', asegurarse de actualizar el fichero de estado (utilizando [U]pdate en el menu) antes de la selección si ha instalado paquetes con `apt-get'. As for package dependencies, `apt-get' automatically pulls in packages with _depends_ but leaves packages with _suggests_ and _recommends_, while `dselect' offers fine-grained control over choices of these packages. See Sección 2.2.8, `Package dependencies'. 6.1.2. Herramientas convenientes -------------------------------- apt-cache - consulta el archivo de paquetes en el "cache" local dpkg-reconfigure - lanza el proceso de reconfiguración de un paquete ya instalado dpkg-source - gestion de los paquetes de codigo fuente dpkg-buildpackage - construcción automatizada de paquetes ... 6.2. Comandos de supervivencia Debian ------------------------------------- Con este conocimiento, se puede vivir eternamente de "upgrades" :-) Refiérase tambíen a Capítulo 3, `Debian System installation hints' and Capítulo 5, `Transición hacía Woody'. 6.2.1. Instalar con `tasksel' ------------------------------------ `tasksel' es el _Debian Task Installer_, el cúal es el "`simple'" método para instalar el sistema. Cuando se necesita instalar una función común que requiere varios paquetes esta es la mejor manera. Asegúrese de ejecutar como sigue : # dselect update # tasksel 6.2.2. Instalar el sistema con APT ---------------------------------- Se puede instalar selectivamente paquetes desde archivos diferentes utilizando versiones más recientes de `apt-get' (>Woody). Esto activará la actualización selectiva hacia "unstable" y desactualización selectiva hacia "stable" mientras se sigue vigilando "testing". # apt-cache policy libc6 libc6-dev locales # verifica el estado # apt-get install libc6=2.2.4-1 libc6-dev=2.2.4-1 locales=2.2.4-1 # apt-get install libc6/unstable libc6-dev/unstable locales/unstable # apt-get install -t unstable libc6 libc6-dev locales # apt-get -u install interesting-new-package remove-package- # apt-get remove useless-old-package # apt-get remove --purge really-useless-old-package Para desactualizar todos los paquetes hacia "stable", modifique `/etc/apt/preferences' como sigue: Package: * Pin: release a=stable Pin-Priority: 1001 y lanze `apt-get upgrade', esto provoca la desactualización por causa de la variable Pin-priority > 1000. 6.2.3. Actualizar con APT ------------------------- Actualizar el sistema con APT: # apt-get update ... siguiendo con lo siguiente: # apt-get -u upgrade # instala según recomendado # apt-get -u dist-upgrade # instala lo recomendado y verifica las dependencias # apt-get -u dselect-upgrade # sigue la selección con dselect Utilize la opción `-s' para simular la actualización sin hacerlo realmente. `dselect' ofrece un interfaz de tipo menu por encima de APT. `deity' y `aptitude' ofrecerán alternativas a `dselect'. 6.2.4. Verificar los bugs Debian -------------------------------- A menudo, la mayor parte de los problemas ya son conocidos. Comienze primero consultando aquí: $ lynx http://bugs.debian.org/ $ lynx http://bugs.debian.org/ Buscar con Google (www.google.com) con palabras clave como "site:debian.org". Si duda consulte el manual. Modifique `CDPATH' como sigue: export CDPATH=.:/usr/local:/usr/share/doc y ejecute $ cd $ mc 6.2.5. Solución de problemas de actualización APT. -------------------------------------------------- Problemas de dependencias de paquetes pueden ocurrir cuando se actualiza en unstable/testing. frecuentemente, esto ocurre cuando un paquete debe ser actualizado y una nueva dependencia no es respetada. Estos problemas se solucionan utilizando: # apt-get dist-upgrade Sí esto no funciona, entonces repita lo siguiente hasta que el problema se solucione por si solo: # apt-get upgrade -f # continua la actualización mismo despues de un error. ... or # apt-get dist-upgrade -f # continua dist-upgrade mismo despues de un error. Algún script de actualización corrupto puede causar daños definitivos. Es mejor resolver este tipo de problemas inspectando los ficheros `/var/lib/dpkg/info/nombredelpaquete._{post-,pre-}{install,removal}_' del paquete corrupto y luego lanzando: # dpkg --configure -a # configura todos los paquetes parcialmente instalados Si un script se queja de la falta de un fichero de configuración, mire en `/etc' para encontrarlo. Si existe un fichero con la extensión `.new' (o algo similar), cambielo (`mv') quitando el sufijo. Pueden aparecer problemas de dependencias cuando se instalan paquetes unstable/testing. Es posible sobrepasar las dependencias. # apt-get install -f package # ignora la dependencias rotas El método alternativo para reparar estas situaciones es utilizar el paquete `equivs'. Vea Sección 6.4.2, ``equivs' package'. 6.2.6. Reparación utilizando `dpkg' ----------------------------------- Una reparación apropiada para un crash `dselect' (APT) es utilizando `dpkg' sin APT: # cd /var/cache/apt/archives # dpkg -i libc6* libdb2* perl* # dpkg -i apt* dpkg* debconf* # dpkg -i * (si no hay errores) Si falta un paquete, cogerlo por: # mc # utilize "FTP link" dirigido sobre el servidor FTP Debian Como recientemente, los paquetes actuales en los servidores HTTP/FTP puede ser que no se encuentren en el clasico dosier `/dist' en cambio mire en el nuevo `/pool'. Luego instale así: # dpkg -i /var/cache/apt/archives/elpaquete.deb Para una dependencia rota, repare o utilize: # dpkg --ignore-depends=paquete1,... -i elpaquete.deb # dpkg --force-depends -i elpaquete.deb # dpkg --force-depends --purge nombredelpaquete 6.2.7. Instalar un paquete en un sistema no bootable ---------------------------------------------------- Boot Linux a partir de un floppy, CD, o otra partición si se trata de un sistema Linux multiboot. Montar la partición sistema no bootable en `/target' y utilize el modo de instalación chroot de `dpkg'. # dpkg --root /target -i elpaquete.deb Luego configure y corriga los problemas. By the way, if a broken `lilo' is all that prevents booting, you can boot using a standard Debian rescue 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.) 6.3. Debian nirvana commands ---------------------------- Enlightment with these commands will save a person from the eternal karmic struggle of upgrade hell and let him reach Debian nirvana. :-) 6.3.1. Information on a file ---------------------------- To find the package to which a particular file belongs: $ dpkg {-S|--search} pattern # search package from installed filename $ zgrep -e pattern /local/copy/of/debian/woody/Contents-i386.gz # find filename-pattern of files in the debian archive Or use specialized package commands: # apt-get install dlocate # conflicts with slocate (secure version of locate) $ dlocate filename # fast alternative to dpkg -L and dpkg -S ... # apt-get install auto-apt # on-demand package installation tool # auto-apt update # create db file for auto-apt $ auto-apt search pattern # thorough search over the archive of packages 6.3.2. Information on a package ------------------------------- Search and display information from package archives. Make sure to point apt to the proper archive(s) by editing `/etc/apt/sources.list'. If you want to see how packages in testing/unstable do against the currently installed one, use `apt-cache policy'---quite nice. # apt-get check # update cache and check for broken packages $ apt-cache search pattern # search package from text description $ apt-cache policy package # package priority/dists information $ apt-cache show -a package # show description of package in all dists $ apt-cache showpkg package # package information for debugging # dpkg --audit|-C # search for partially installed packages $ dpkg {-s|--status} package ... # description of installed package $ dpkg -l package ... # status of installed package (1 line each) $ dpkg -L package ... # list file names installed by the package You can also find package information in (I use `mc' to browse these): /var/lib/apt/lists/* /var/lib/dpkg/{available|status} 6.3.3. Reconfigure installed packages ------------------------------------- Use the following to reconfigure any already-installed package. # dpkg-reconfigure --priority=medium package [...] # dpkg-reconfigure --all # reconfigure all packages Do this for `debconf' if you need to change the `debconf' dialog mode permanently. Some programs come with special configuration scripts. apt-setup - create /etc/sources.list install-mbr - install a Master Boot Record manager tzconfig - set the local timezone gpmconfig - set gpm mouse daemon smbconfig - configure Samba eximconfig - configure Exim (MTA) texconfig - configure teTeX apacheconfig - configure Apache (httpd) cvsconfig - configure CVS sndconfig - configure sound system ... update-alternatives - set default command, e.g., vim as vi update-rc.d - System-V init script management update-menus - Debian menu system ... 6.3.4. Remove and purge packages -------------------------------- Remove a package while maintaining its configuration: # apt-get remove package ... # dpkg --remove package ... Remove a package and all configuration: # apt-get remove --purge package ... # dpkg --purge package ... 6.3.5. Holding older packages ----------------------------- For example, holding of `libc6' and `libc6-dev' for `dselect' and `apt-get -u upgrade package' can be done as follows: # echo -e "libc6 hold\nlibc6-dev hold" | dpkg --set-selections `apt-get -u install package' will not be hindered by this "hold". To hold a package through forcing automatic downgrade for `apt-get -u upgrade package' or `apt-get -u dist-upgrade', add the following to `/etc/apt/preferences': Package: libc6* Pin: release a=stable Pin-Priority: 2000 The following will list packages on hold: dpkg --get-selections "*"|grep -e "hold$" 6.3.6. `dselect' -- global configuration ---------------------------------------- Add a line with "expert" in `/etc/dpkg/dselect.cfg' to reduce noise. When started, `dselect' automatically selects all "Required", "Important", and "Standard" packages. Some packages, such as `teTEX' and `emacs', are large and may not be needed when you first install a system. So be careful. `dselect' has a somewhat strange user interface. There are 4 ambiguous commands (Capital means CAPITAL!): Key-stroke Action Q Quit. Confirm current selection and quit anyway. (override dependencies) R Revert! I did not mean it. D Damn it! I do not care what dselect thinks. Just Do it! U Set all to sUggested state With `D' and `Q', you can select conflicting selections at your own risk. Handle these commands with care. For a slower machine, run `dselect' on another fast machine to find packages and use `apt-get install' to install them. `apt-get dselect-upgrade' best honors `dselect' selection. 6.3.7. Reduce cached package files ---------------------------------- Package install with APT leaves cached package files in `/var/cache/apt/archives' and these need to be cleaned. # apt-get autoclean # removes only useless package files # apt-get clean # removes all cache package files 6.3.8. Record/copy system configuration --------------------------------------- To make a local copy of the package selection states: $ dpkg --get-selections "*" >myselections # or use \* `"*"' makes `myselections' include package entries for "purge" too. You transfer this file to another computer, and install it there with: # apt-get update # dpkg --set-selections