logo资料库

The Debian Administrator’s Handbook.pdf

第1页 / 共513页
第2页 / 共513页
第3页 / 共513页
第4页 / 共513页
第5页 / 共513页
第6页 / 共513页
第7页 / 共513页
第8页 / 共513页
资料共513页,剩余部分请下载后查看
1. The Debian Project
What Is Debian?
A Multi-Platform Operating System
The Quality of Free Software
The Legal Framework: A Non-Profit Organization
The Foundation Documents
The Commitment towards Users
The Debian Free Software Guidelines
The Inner Workings of the Debian Project
The Debian Developers
The Active Role of Users
Teams and Sub-Projects
Existing Debian Sub-Projects
Administrative Teams
Development Teams, Transversal Teams
Follow Debian News
The Role of Distributions
The Installer: debian-installer
The Software Library
Lifecycle of a Release
The Experimental Status
The Unstable Status
Migration to Testing
The Promotion from Testing to Stable
The Oldstable and Oldoldstable Status
2. Presenting the Case Study
Fast Growing IT Needs
Master Plan
Why a GNU/Linux Distribution?
Why the Debian Distribution?
Commercial and Community Driven Distributions
Why Debian Jessie?
3. Analyzing the Existing Setup and Migrating
Coexistence in Heterogeneous Environments
Integration with Windows Machines
Integration with OS€X machines
Integration with Other Linux/Unix Machines
How To Migrate
Survey and Identify Services
Network and Processes
Backing up the Configuration
Taking Over an Existing Debian Server
Installing Debian
Installing and Configuring the Selected Services
4. Installation
Installation Methods
Installing from a CD-ROM/DVD-ROM
Booting from a USB Key
Installing through Network Booting
Other Installation Methods
Installing, Step by Step
Booting and Starting the Installer
Selecting the language
Selecting the country
Selecting the keyboard layout
Detecting Hardware
Loading Components
Detecting Network Hardware
Configuring the Network
Administrator Password
Creating the First User
Configuring the Clock
Detecting Disks and Other Devices
Starting the Partitioning Tool
Guided partitioning
Manual Partitioning
Configuring Multidisk Devices (Software RAID)
Configuring the Logical Volume Manager (LVM)
Setting Up Encrypted Partitions
Installing the Base System
Configuring the Package Manager (apt)
Debian Package Popularity Contest
Selecting Packages for Installation
Installing the GRUB Bootloader
Finishing the Installation and Rebooting
After the First Boot
Installing Additional Software
Upgrading the System
5. Packaging System: Tools and Fundamental Principles
Structure of a Binary Package
Package Meta-Information
Description: the control File
Dependencies: the Depends Field
Conflicts: the Conflicts field
Incompatibilities: the Breaks Field
Provided Items: the Provides Field
Replacing Files: The Replaces Field
Configuration Scripts
Installation and Upgrade
Package Removal
Checksums, List of Configuration Files
Structure of a Source Package
Format
Usage within Debian
Manipulating Packages with dpkg
Installing Packages
Package Removal
Querying dpkg's Database and Inspecting .deb Files
dpkg's Log File
Multi-Arch Support
Enabling Multi-Arch
Multi-Arch Related Changes
Coexistence with Other Packaging Systems
6. Maintenance and Updates: The APT Tools
Filling in the sources.list File
Syntax
Repositories for Stable Users
Security Updates
Stable Updates
Proposed Updates
Stable Backports
Repositories for Testing/Unstable Users
The Experimental Repository
Non-Official Resources: mentors.debian.net
Caching Proxy for Debian Packages
aptitude, apt-get, and apt Commands
Initialization
Installing and Removing
System Upgrade
Configuration Options
Managing Package Priorities
Working with Several Distributions
Tracking Automatically Installed Packages
The apt-cache Command
Frontends: aptitude, synaptic
aptitude
Managing Recommendations, Suggestions and Tasks
Better Solver Algorithms
synaptic
Checking Package Authenticity
Upgrading from One Stable Distribution to the Next
Recommended Procedure
Handling Problems after an Upgrade
Keeping a System Up to Date
Automatic Upgrades
Configuring dpkg
Configuring APT
Configuring debconf
Handling Command Line Interactions
The Miracle Combination
Searching for Packages
7. Solving Problems and Finding Relevant Information
Documentation Sources
Manual Pages
info Documents
Specific Documentation
Websites
Tutorials (HOWTO)
Common Procedures
Configuring a Program
Monitoring What Daemons Are Doing
Asking for Help on a Mailing List
Reporting a Bug When a Problem Is Too Difficult
8. Basic Configuration: Network, Accounts, Printing...
Configuring the System for Another Language
Setting the Default Language
Configuring the Keyboard
Migrating to UTF-8
Configuring the Network
Ethernet Interface
Connecting with PPP through a PSTN Modem
Connecting through an ADSL Modem
Modems Supporting PPPOE
Modems Supporting PPTP
Modems Supporting DHCP
Automatic Network Configuration for Roaming Users
Setting the Hostname and Configuring the Name Service
Name Resolution
Configuring DNS Servers
The /etc/hosts file
User and Group Databases
User List: /etc/passwd
The Hidden and Encrypted Password File: /etc/shadow
Modifying an Existing Account or Password
Disabling an Account
Group List: /etc/group
Creating Accounts
Shell Environment
Printer Configuration
Configuring the Bootloader
Identifying the Disks
Configuring LILO
GRUB€2 Configuration
For Macintosh Computers (PowerPC): Configuring Yaboot
Other Configurations: Time Synchronization, Logs, Sharing Access…
Timezone
Time Synchronization
For Workstations
For Servers
Rotating Log Files
Sharing Administrator Rights
List of Mount Points
locate and updatedb
Compiling a Kernel
Introduction and Prerequisites
Getting the Sources
Configuring the Kernel
Compiling and Building the Package
Compiling External Modules
Applying a Kernel Patch
Installing a Kernel
Features of a Debian Kernel Package
Installing with dpkg
9. Unix Services
System Boot
The systemd init system
The System€V init system
Remote Login
Secure Remote Login: SSH
Key-Based Authentication
Using Remote X11 Applications
Creating Encrypted Tunnels with Port Forwarding
Using Remote Graphical Desktops
Managing Rights
Administration Interfaces
Administrating on a Web Interface: webmin
Configuring Packages: debconf
syslog System Events
Principle and Mechanism
The Configuration File
Syntax of the Selector
Syntax of Actions
The inetd Super-Server
Scheduling Tasks with cron and atd
Format of a crontab File
Using the at Command
Scheduling Asynchronous Tasks: anacron
Quotas
Backup
Backing Up with rsync
Restoring Machines without Backups
Hot Plugging: hotplug
Introduction
The Naming Problem
How udev Works
A concrete example
Power Management: Advanced Configuration and Power Interface (ACPI)
10. Network Infrastructure
Gateway
Virtual Private Network
OpenVPN
Public Key Infrastructure: easy-rsa
Configuring the OpenVPN Server
Configuring the OpenVPN Client
Virtual Private Network with SSH
IPsec
PPTP
Configuring the Client
Configuring the Server
Quality of Service
Principle and Mechanism
Configuring and Implementing
Reducing Latencies: wondershaper
Standard Configuration
Dynamic Routing
IPv6
Tunneling
Domain Name Servers (DNS)
Principle and Mechanism
Configuring
DHCP
Configuring
DHCP and DNS
Network Diagnosis Tools
Local Diagnosis: netstat
Remote Diagnosis: nmap
Sniffers: tcpdump and wireshark
11. Network Services: Postfix, Apache, NFS, Samba, Squid, LDAP, SIP, XMPP, TURN
Mail Server
Installing Postfix
Configuring Virtual Domains
Virtual Alias Domains
Virtual Mailbox Domains
Restrictions for Receiving and Sending
IP-Based Access Restrictions
Checking the Validity of the EHLO or HELO Commands
Accepting or Refusing Based on the Announced Sender
Accepting or Refusing Based on the Recipient
Restrictions Associated with the DATA Command
Applying Restrictions
Filtering Based on the Message Contents
Setting Up greylisting
Customizing Filters Based On the Recipient
Integrating an Antivirus
Authenticated SMTP
Web Server (HTTP)
Installing Apache
Configuring Virtual Hosts
Common Directives
Requiring Authentication
Restricting Access
Log Analyzers
FTP File Server
NFS File Server
Securing NFS
NFS Server
NFS Client
Setting Up Windows Shares with Samba
Samba Server
Configuring with debconf
Configuring Manually
Samba Client
The smbclient Program
Mounting Windows Shares
Printing on a Shared Printer
HTTP/FTP Proxy
Installing
Configuring a Cache
Configuring a Filter
LDAP Directory
Installing
Filling in the Directory
Managing Accounts with LDAP
Configuring NSS
Configuring PAM
Securing LDAP Data Exchanges
Real-Time Communication Services
DNS settings for RTC services
TURN Server
Install the TURN server
Managing the TURN users
SIP Proxy Server
Install the SIP proxy
Managing the SIP proxy
XMPP Server
Install the XMPP server
Managing the XMPP server
Running services on port 443
Adding WebRTC
12. Advanced Administration
RAID and LVM
Software RAID
Different RAID Levels
Setting up RAID
Backing up the Configuration
LVM
LVM Concepts
Setting up LVM
LVM Over Time
RAID or LVM?
Virtualization
Xen
LXC
Preliminary Steps
Network Configuration
Setting Up the System
Starting the Container
Virtualization with KVM
Preliminary Steps
Network Configuration
Installation with virt-install
Managing Machines with virsh
Installing an RPM based system in Debian with yum
Automated Installation
Fully Automatic Installer (FAI)
Preseeding Debian-Installer
Using a Preseed File
Creating a Preseed File
Creating a Customized Boot Media
Simple-CDD: The All-In-One Solution
Creating Profiles
Configuring and Using build-simple-cdd
Generating an ISO Image
Monitoring
Setting Up Munin
Configuring Hosts To Monitor
Configuring the Grapher
Setting Up Nagios
Installing
Configuring
13. Workstation
Configuring the X11 Server
Customizing the Graphical Interface
Choosing a Display Manager
Choosing a Window Manager
Menu Management
Graphical Desktops
GNOME
KDE
Xfce and Others
Email
Evolution
KMail
Thunderbird and Icedove
Web Browsers
Development
Tools for GTK+ on GNOME
Tools for Qt on KDE
Collaborative Work
Working in Groups: groupware
Collaborative Work With FusionForge
Office Suites
Emulating Windows: Wine
Real-Time Communications software
14. Security
Defining a Security Policy
Firewall or Packet Filtering
Netfilter Behavior
Syntax of iptables and ip6tables
Commands
Rules
Creating Rules
Installing the Rules at Each Boot
Supervision: Prevention, Detection, Deterrence
Monitoring Logs with logcheck
Monitoring Activity
In Real Time
History
Detecting Changes
Auditing Packages with dpkg --verify
Auditing Packages: debsums and its Limits
Monitoring Files: AIDE
Detecting Intrusion (IDS/NIDS)
Introduction to AppArmor
Principles
Enabling AppArmor and managing AppArmor profiles
Creating a new profile
Introduction to SELinux
Principles
Setting Up SELinux
Managing an SELinux System
Managing SELinux Modules
Managing Identities
Managing File Contexts, Ports and Booleans
Adapting the Rules
Writing a .fc file
Writing a .if File
Writing a .te File
Compiling the Files
Other Security-Related Considerations
Inherent Risks of Web Applications
Knowing What To Expect
Choosing the Software Wisely
Managing a Machine as a Whole
Users Are Players
Physical Security
Legal Liability
Dealing with a Compromised Machine
Detecting and Seeing the Cracker's Intrusion
Putting the Server Off-Line
Keeping Everything that Could Be Used as Evidence
Re-installing
Forensic Analysis
Reconstituting the Attack Scenario
15. Creating a Debian Package
Rebuilding a Package from its Sources
Getting the Sources
Making Changes
Starting the Rebuild
Building your First Package
Meta-Packages or Fake Packages
Simple File Archive
Creating a Package Repository for APT
Becoming a Package Maintainer
Learning to Make Packages
Rules
Procedures
Tools
Acceptance Process
Prerequisites
Registration
Accepting the Principles
Checking Skills
Final Approval
16. Conclusion: Debian's Future
Upcoming Developments
Debian's Future
Future of this Book
A. Derivative Distributions
Census and Cooperation
Ubuntu
Linux Mint
Knoppix
Aptosid and Siduction
Grml
Tails
Kali Linux
Devuan
Tanglu
DoudouLinux
Raspbian
And Many More
B. Short Remedial Course
Shell and Basic Commands
Browsing the Directory Tree and Managing Files
Displaying and Modifying Text Files
Searching for Files and within Files
Managing Processes
System Information: Memory, Disk Space, Identity
Organization of the Filesystem Hierarchy
The Root Directory
The User's Home Directory
Inner Workings of a Computer: the Different Layers Involved
The Deepest Layer: the Hardware
The Starter: the BIOS or UEFI
The Kernel
The User Space
Some Tasks Handled by the Kernel
Driving the Hardware
Filesystems
Shared Functions
Managing Processes
Rights Management
The User Space
Process
Daemons
Inter-Process Communications
Libraries
Index
The Debian Administrator’s Handbook Raphaël Hertzog and Roland Mas Copyright © 2003-2015 Raphaël Hertzog Copyright © 2006-2015 Roland Mas Copyright © 2012-2015 Freexian SARL ISBN: 979-10-91414-04-3 (English paperback) ISBN: 979-10-91414-05-0 (English ebook) This book is available under the terms of two licenses compatible with the Debian Free Software Guide- lines. Creative Commons License Notice: This book is licensed under a Creative Commons Attribution- ShareAlike 3.0 Unported License. Ł http://creativecommons.org/licenses/by-sa/3.0/ GNU General Public License Notice: This book is free documentation: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Founda- tion, either version 2 of the License, or (at your option) any later version. This book is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Gen- eral Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. Show your appreciation This book is published under a free license because we want everybody to ben- efit from it. That said maintaining it takes time and lots of effort, and we ap- preciate being thanked for this. If you find this book valuable, please consider contributing to its continued maintenance either by buying a paperback copy or by making a donation through the book’s official website: Ł http://debian-handbook.info
Contents 1. The Debian Project 1.1 What Is Debian? 1.2 The Foundation Documents 1.3 The Inner Workings of the Debian Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.1 A Multi-Platform Operating System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.2 The Quality of Free Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.3 The Legal Framework: A Non-Profit Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.1 The Commitment towards Users 1.2.2 The Debian Free Software Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.1 The Debian Developers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.2 The Active Role of Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.3 Teams and Sub-Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Existing Debian Sub-Projects Administrative Teams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Development Teams, Transversal Teams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 Follow Debian News . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 The Role of Distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5.1 The Installer: debian-installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5.2 The Software Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.6.1 The Experimental Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.6.2 The Unstable Status 1.6.3 Migration to Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.6.4 The Promotion from Testing to Stable 1.6.5 The Oldstable and Oldoldstable Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.6 Lifecycle of a Release 2. Presenting the Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 Fast Growing IT Needs 2.2 Master Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Why a GNU/Linux Distribution? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 Why the Debian Distribution? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.1 Commercial and Community Driven Distributions 2.5 Why Debian Jessie? 3. Analyzing the Existing Setup and Migrating 3.1 Coexistence in Heterogeneous Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 2 4 4 5 5 7 9 9 13 16 16 17 19 20 22 22 22 22 23 23 24 25 29 31 32 32 33 35 35 36 39 40
3.2 How To Migrate 3.2.1 Survey and Identify Services 3.1.1 Integration with Windows Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.2 Integration with OS X machines 3.1.3 Integration with Other Linux/Unix Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.2 Backing up the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.3 Taking Over an Existing Debian Server 3.2.4 Installing Debian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.5 Installing and Configuring the Selected Services Network and Processes 4.1 Installation Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.1 Installing from a CD-ROM/DVD-ROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.2 Booting from a USB Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.3 Installing through Network Booting 4.1.4 Other Installation Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Installing, Step by Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 Booting and Starting the Installer 4.2.2 Selecting the language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.3 Selecting the country . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.4 Selecting the keyboard layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.5 Detecting Hardware 4.2.6 Loading Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.7 Detecting Network Hardware 4.2.8 Configuring the Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.9 Administrator Password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.10 Creating the First User 4.2.11 Configuring the Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.12 Detecting Disks and Other Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Guided partitioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Manual Partitioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . Configuring Multidisk Devices (Software RAID) Configuring the Logical Volume Manager (LVM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting Up Encrypted Partitions 4.2.14 Installing the Base System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.15 Configuring the Package Manager (apt) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.16 Debian Package Popularity Contest 4.2.17 Selecting Packages for Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.18 Installing the GRUB Bootloader 4.2.19 Finishing the Installation and Rebooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 After the First Boot 4.2.13 Starting the Partitioning Tool 4. Installation 4.3.1 Installing Additional Software IV The Debian Administrator’s Handbook 40 40 40 41 41 42 42 43 44 44 47 48 48 49 50 50 50 50 52 53 53 54 54 54 55 55 56 57 57 57 59 61 62 62 63 64 64 65 66 66 67 67 68
5. Packaging System: Tools and Fundamental Principles 5.2.1 Description: the control File 5.2.3 Checksums, List of Configuration Files 4.3.2 Upgrading the System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1 Structure of a Binary Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Package Meta-Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dependencies: the Depends Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Conflicts: the Conflicts field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Incompatibilities: the Breaks Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Provided Items: the Provides Field Replacing Files: The Replaces Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.2 Configuration Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Installation and Upgrade Package Removal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Structure of a Source Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.1 Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.2 Usage within Debian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Manipulating Packages with dpkg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.1 Installing Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.2 Package Removal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.3 Querying dpkg’s Database and Inspecting .deb Files 5.4.4 dpkg’s Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.5 Multi-Arch Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Enabling Multi-Arch Multi-Arch Related Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 71 72 74 74 75 77 77 77 80 80 81 81 83 84 84 87 87 88 89 90 94 94 94 95 96 99 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 6.1.1 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 6.1.2 Repositories for Stable Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Security Updates Stable Updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Proposed Updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 6.2 aptitude, apt-get, and apt Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 6.2.1 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 6.2.2 Installing and Removing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 6.2.3 System Upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 6.2.4 Configuration Options 5.5 Coexistence with Other Packaging Systems 6.1 Filling in the sources.list File Stable Backports 6.1.3 Repositories for Testing/Unstable Users The Experimental Repository 6.1.4 Non-Official Resources: mentors.debian.net 6.1.5 Caching Proxy for Debian Packages 6. Maintenance and Updates: The APT Tools Contents V
6.4.1 aptitude Better Solver Algorithms 6.4.2 synaptic Managing Recommendations, Suggestions and Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 6.2.5 Managing Package Priorities 6.2.6 Working with Several Distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 6.2.7 Tracking Automatically Installed Packages 6.3 The apt-cache Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 6.4 Frontends: aptitude, synaptic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 . . . . . . . . . . . . . . . . . . . . . . . . . . 119 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 6.5 Checking Package Authenticity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 . . . . . . . . . . . . . . . . . . . . . . . . 123 6.6 Upgrading from One Stable Distribution to the Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 6.6.1 Recommended Procedure 6.6.2 Handling Problems after an Upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 6.7 Keeping a System Up to Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 6.8 Automatic Upgrades . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 6.8.1 Configuring dpkg 6.8.2 Configuring APT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 6.8.3 Configuring debconf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 6.8.4 Handling Command Line Interactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 6.8.5 The Miracle Combination 6.9 Searching for Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 133 7.1 Documentation Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 7.1.1 Manual Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 7.1.2 info Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 7.1.3 Specific Documentation 7.1.4 Websites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 7.1.5 Tutorials (HOWTO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 7.2.1 Configuring a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 7.2.2 Monitoring What Daemons Are Doing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 7.2.3 Asking for Help on a Mailing List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 7.2.4 Reporting a Bug When a Problem Is Too Difficult 145 . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 8.1.1 Setting the Default Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 8.1.2 Configuring the Keyboard 8.1.3 Migrating to UTF-8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 8.2 Configuring the Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 8.2.1 Ethernet Interface 8.2.2 Connecting with PPP through a PSTN Modem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 8.2.3 Connecting through an ADSL Modem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Modems Supporting PPPOE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 8.1 Configuring the System for Another Language 7.2 Common Procedures 7. Solving Problems and Finding Relevant Information 8. Basic Configuration: Network, Accounts, Printing… VI The Debian Administrator’s Handbook
Configuring DNS Servers The /etc/hosts file 8.2.4 Automatic Network Configuration for Roaming Users Modems Supporting PPTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Modems Supporting DHCP . . . . . . . . . . . . . . . . . . . . . . . . . 153 8.3 Setting the Hostname and Configuring the Name Service . . . . . . . . . . . . . . . . . . . . . 154 8.3.1 Name Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 8.4 User and Group Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 8.4.1 User List: /etc/passwd . . . . . . . . . . . . . . . . . . . . . . . . 157 8.4.2 The Hidden and Encrypted Password File: /etc/shadow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 8.4.3 Modifying an Existing Account or Password 8.4.4 Disabling an Account . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 8.4.5 Group List: /etc/group 8.5 Creating Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 8.6 Shell Environment 8.7 Printer Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 8.8 Configuring the Bootloader 8.8.1 Identifying the Disks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 8.8.2 Configuring LILO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 8.8.3 GRUB 2 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 . . . . . . . . . . . . . . . . . . . . . . . 167 8.8.4 For Macintosh Computers (PowerPC): Configuring Yaboot 8.9 Other Configurations: Time Synchronization, Logs, Sharing Access… . . . . . . . . . . . . . . 168 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 For Workstations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 For Servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 8.9.3 Rotating Log Files 8.9.4 Sharing Administrator Rights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 8.9.5 List of Mount Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 8.9.6 locate and updatedb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 8.10.5 Compiling External Modules 8.10.6 Applying a Kernel Patch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 8.11.1 Features of a Debian Kernel Package 8.11.2 Installing with dpkg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 181 9.1 System Boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 9.1.1 The systemd init system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 8.10.1 Introduction and Prerequisites 8.10.2 Getting the Sources 8.9.1 Timezone 8.9.2 Time Synchronization 8.10.3 Configuring the Kernel 8.10.4 Compiling and Building the Package 8.10 Compiling a Kernel 8.11 Installing a Kernel 9. Unix Services Contents VII
9.2.2 Using Remote Graphical Desktops Creating Encrypted Tunnels with Port Forwarding 9.5 syslog System Events 9.1.2 The System V init system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 9.2 Remote Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 9.2.1 Secure Remote Login: SSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Key-Based Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 Using Remote X11 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 9.3 Managing Rights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 9.4 Administration Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 9.4.1 Administrating on a Web Interface: webmin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 9.4.2 Configuring Packages: debconf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 9.5.1 Principle and Mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 9.5.2 The Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Syntax of the Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Syntax of Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 9.6 The inetd Super-Server 9.7 Scheduling Tasks with cron and atd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 9.7.1 Format of a crontab File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 9.7.2 Using the at Command 9.8 Scheduling Asynchronous Tasks: anacron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 9.9 Quotas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 9.10 Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 9.10.1 Backing Up with rsync . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 9.10.2 Restoring Machines without Backups 9.11 Hot Plugging: hotplug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 9.11.1 Introduction 9.11.2 The Naming Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 9.11.3 How udev Works 9.11.4 A concrete example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 9.12 Power Management: Advanced Configuration and Power Interface (ACPI) . . . . . . . . . . 218 221 10.1 Gateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 10.2 Virtual Private Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 10.2.1 OpenVPN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Public Key Infrastructure: easy-rsa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Configuring the OpenVPN Server Configuring the OpenVPN Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 10.2.2 Virtual Private Network with SSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 10.2.3 IPsec 10.2.4 PPTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 10. Network Infrastructure Configuring the Client Configuring the Server VIII The Debian Administrator’s Handbook
分享到:
收藏