System-Administrator-Guide.pdf

(325 KB) Pobierz
The Linux System Administrator's Guide
The Linux System Administrator's Guide
Version 0.8
Lars Wirzenius
Joanna Oja
Stephen Stafford
Alex Weeks
2003−12−03
An introduction to system administration of a Linux system for novices.
Copyright 1993−−1998 Lars Wirzenius.
Copyright 1998−−2001 Joanna Oja.
Copyright 2001−−2003 Stephen Stafford.
Copyright 2003−−Present Stephen Stafford & Alex Weeks.
Trademarks are owned by their owners.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free
Documentation License, Version 1.1; with no Invariant Sections, with no Front−Cover Texts, and with no
Back−Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation
License".
43921335.001.png
The Linux System Administrator's Guide
Table of Contents
Source and pre−formatted versions available. .................................................................................................1
Chapter 1. Introduction. .....................................................................................................................................2
Chapter 2. About This Book. .............................................................................................................................4
2.1. Acknowledgments.. ...........................................................................................................................4
2.1.1. Joanna's acknowledgments. .....................................................................................................4
2.1.2. Stephen's acknowledgments. ...................................................................................................4
2.1.3. Alex's Acknowledgments. .......................................................................................................5
2.2. Typographical Conventions. .............................................................................................................5
Chapter 3. Overview of a Linux System. ..........................................................................................................6
3.1. Various parts of an operating system. ...............................................................................................6
3.2. Important parts of the kerne. ............................................................................................................6
3.3. Major services in a UNIX system. ....................................................................................................7
3.3.1. ini. ...........................................................................................................................................8
3.3.2. Logins from terminals. ............................................................................................................8
3.3.3. Syslog. .....................................................................................................................................8
3.3.4. Periodic command execution: cron and at. .............................................................................8
3.3.5. Graphical user interface. ..........................................................................................................9
3.3.6. Networking. .............................................................................................................................9
3.3.7. Network logins. .......................................................................................................................9
3.3.8. Network file systems. ............................................................................................................10
3.3.9. Mail .......................................................................................................................................10
3.3.10. Printing. ...............................................................................................................................10
3.3.11. The filesystem layout. .........................................................................................................10
Chapter 4. Overview of the Directory Tree. ...................................................................................................12
4.1. Background. ....................................................................................................................................12
4.2. The root filesystem. ........................................................................................................................13
4.3. The /etc directory. ...........................................................................................................................14
4.4. The /dev directory. ..........................................................................................................................16
4.5. The /usr filesystem. .........................................................................................................................16
4.6. The /var filesystem. .........................................................................................................................16
4.7. The /proc filesystem. .......................................................................................................................17
Chapter 5. Device Files. ....................................................................................................................................19
5.1. The MAKEDEV Scrip. ..................................................................................................................19
5.2. The mknod command. ....................................................................................................................19
5.3. Device List. .....................................................................................................................................20
Chapter 6. Using Disks and Other Storage Media. ........................................................................................22
6.1. Two kinds of devices. .....................................................................................................................22
6.2. Hard disks. ......................................................................................................................................23
6.3. Floppies. ..........................................................................................................................................25
6.4. CD−ROMs. .....................................................................................................................................26
6.5. Tapes. ..............................................................................................................................................26
6.6. Formatting. ......................................................................................................................................27
i
43921335.002.png
The Linux System Administrator's Guide
Table of Contents
6.7. Partitions. ........................................................................................................................................28
6.7.1. The MBR, boot sectors and partition table. ...........................................................................29
6.7.2. Extended and logical partitions. ............................................................................................29
6.7.3. Partition types. .......................................................................................................................30
6.7.4. Partitioning a hard disk.. ........................................................................................................31
6.7.5. Device files and partitions. ....................................................................................................31
6.8. Filesystems. .....................................................................................................................................32
6.8.1. What are filesystems?. ...........................................................................................................32
6.8.2. Filesystems galore. ................................................................................................................32
6.8.3. Which filesystem should be used?. .......................................................................................34
6.8.4. Creating a filesystem. ............................................................................................................35
6.8.5. Mounting and unmounting. ...................................................................................................36
6.8.6. Checking filesystem integrity with fsck. ...............................................................................39
6.8.7. Checking for disk errors with badblocks. ..............................................................................39
6.8.8. Fighting fragmentation. .........................................................................................................40
6.8.9. Other tools for all filesystems ...............................................................................................40
6.8.10. Other tools for the ext2/ext3 filesystem. .............................................................................41
6.9. Disks without filesystems. ..............................................................................................................42
6.10. Allocating disk space. ...................................................................................................................43
6.10.1. Partitioning schemes. ...........................................................................................................43
6.10.2. Space requirements. .............................................................................................................43
6.10.3. Examples of hard disk allocation. .......................................................................................44
6.10.4. Adding more disk space for Linux. .....................................................................................44
6.10.5. Tips for saving disk space. ..................................................................................................44
Chapter 7. Memory Management. ..................................................................................................................46
7.1. What is virtual memory?. ................................................................................................................46
7.2. Creating a swap space. ....................................................................................................................46
7.3. Using a swap space. ........................................................................................................................47
7.4. Sharing swap spaces with other operating systems. .......................................................................49
7.5. Allocating swap space. ....................................................................................................................49
7.6. The buffer cache. ............................................................................................................................50
Chapter 8. Boots And Shutdowns. ...................................................................................................................52
8.1. An overview of boots and shutdowns. ............................................................................................52
8.2. The boot process in closer look. .....................................................................................................52
8.3. More about shutdowns. ...................................................................................................................54
8.4. Rebooting. .......................................................................................................................................55
8.5. Single user mode. ............................................................................................................................56
8.6. Emergency boot floppies. ...............................................................................................................56
Chapter 9. ini. ...................................................................................................................................................57
9.1. init comes first ................................................................................................................................57
9.2. Configuring init to start getty: the /etc/inittab file. .........................................................................57
9.3. Run levels .......................................................................................................................................58
9.4. Special configuration in /etc/inittab. ...............................................................................................59
9.5. Booting in single user mode ...........................................................................................................60
ii
43921335.003.png
The Linux System Administrator's Guide
Table of Contents
Chapter 10. Logging In And Ou. ....................................................................................................................61
10.1. Logins via terminals. .....................................................................................................................61
10.2. Logins via the network.. ................................................................................................................62
10.3. What login does. ...........................................................................................................................63
10.4. X and xdm. ....................................................................................................................................64
10.5. Access control. ..............................................................................................................................64
10.6. Shell startup. .................................................................................................................................64
Chapter 11. Managing user accounts. .............................................................................................................65
11.1. What's an account?.. ......................................................................................................................65
11.2. Creating a user. .............................................................................................................................65
11.2.1. /etc/passwd and other informative files. ..............................................................................65
11.2.2. Picking numeric user and group ids. ...................................................................................66
11.2.3. Initial environment: /etc/ske. ..............................................................................................66
11.2.4. Creating a user by hand. ......................................................................................................67
11.3. Changing user properties. .............................................................................................................67
11.4. Removing a user ...........................................................................................................................68
11.5. Disabling a user temporarily. ........................................................................................................68
Chapter 12. Backups. ........................................................................................................................................70
12.1. On the importance of being backed up. ........................................................................................70
12.2. Selecting the backup medium. ......................................................................................................70
12.3. Selecting the backup tool. .............................................................................................................71
12.4. Simple backups. ............................................................................................................................72
12.4.1. Making backups with tar. ....................................................................................................72
12.4.2. Restoring files with tar. .......................................................................................................73
12.5. Multilevel backups. .......................................................................................................................74
12.6. What to back up. ...........................................................................................................................75
12.7. Compressed backups. ....................................................................................................................76
Chapter 13. Keeping Time. ..............................................................................................................................77
13.1. The concept of localtime. ..............................................................................................................77
13.2. The hardware and software clocks. ...............................................................................................78
13.3. Showing and setting time. .............................................................................................................78
13.4. When the clock is wrong.. .............................................................................................................79
13.5. NTP − Network Time Protoco. ....................................................................................................79
13.6. Basic NTP configuration.. .............................................................................................................80
13.7. NTP Toolkit. .................................................................................................................................81
13.8. Some known NTP servers. ............................................................................................................83
13.9. NTP Links. ....................................................................................................................................83
Chapter 14. Finding Help. ................................................................................................................................84
14.1. Newsgroups and Mailing Lists. ....................................................................................................84
14.1.1. Finding The Right Forum. ...................................................................................................84
14.1.2. Before You Post. .................................................................................................................84
14.1.3. Writing Your Post ...............................................................................................................84
14.1.4. Formatting Your Post. .........................................................................................................85
14.1.5. Follow Up. ...........................................................................................................................85
iii
43921335.004.png
Zgłoś jeśli naruszono regulamin