Old Linux Course Modules
562
0
0
Full text
(2) Contents 1 Apache Basics Objectives . . . . . . . . . . . . . 1.1 What is ? . . . . . . . . . 1.2 Installation . . . . . . . . . . . . . 1.3 How Apache Listens . . . . . . . 1.4 Configuration File(s) . . . . . . . 1.5 Key Configuration Directives . . . 1.6 ServerRoot, DocumentRoot . . . 1.7 ServerAdmin . . . . . . . . . . . 1.8 BindAddress, and Port . . . . . . 1.9 Listen . . . . . . . . . . . . . . . 1.10 User and Group . . . . . . . . . . 1.11 Apache Processes . . . . . . . . 1.12 Logging . . . . . . . . . . . . . . 1.13 Customizable Logging . . . . . . 1.14 CustomLog examples . . . . . . 1.15 Example Configuration . . . . . . 1.16 Basic Exercises . . . . . . . . . . 1.17 Solutions . . . . . . . . . . . . . 1.18 Two sites and more ... . . . . . . 1.19 Virtual Hosting Options . . . . . . 1.20 Name-based hosting . . . . . . . 1.21 Name-based hosting (continued) 1.22 Block Directives . . . . . . . . . . 1.23 Block Directives (continued) . . . 1.24 DirectoryMatch, et al. . . . . . . . 1.25 Access Control . . . . . . . . . . 1.26 Access Control (continued) . . . 1.27 Authorisation Files . . . . . . . . 1.28 Authorisation Files (continued) . 1.29 Other useful directives . . . . . . 1.30 Examples . . . . . . . . . . . . . 1.31 Exercises . . . . . . . . . . . . . 1.32 Solutions . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34. 2 Key Configuration Files Objectives . . . . . . . . . . . .
(3) 2.1. . . . . . . . . . .
(4) 2.2. (continued) . . . .
(5) 2.3 Editing . . . . . ..
(6) 2.4 Other Changes To .
(7) 2.5 . . . . . . . . . . .. . . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. . . . . . .. 36 36 37 38 39 40 41. . . . . . .. i.
(8) CONTENTS. 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27. ii.
(9) . . . . . . . . Editing Important Note . . . . . . . . . . Shadow Passwords . . . . . . . .
(10) . . . . . . . . . . . . Scheduling Jobs ( ) . . . . .
(11) . . . . . . . . . . . . .
(12) . . . . . . . . . . . . . . . . . . . . . . . . . . . Module Configuration . . . . . . . Modules Configuration - ‘Options’ Mounting Filesystems . . . . . . Runlevels . . . . . . . . . . . . . Single User Mode . . . . . . . . . Multi User Mode . . . . . . . . . Starting up and Shutting down . Changing runlevel . . . . . . . . Initscripts . . . . . . . . . . . . . ! . . . . . . . . . . . . . . . Initscripts - An example . . . . . Restarting Services . . . . . . . Exercises . . . . . . . . . . . . . Solutions . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63. 3 Dial Up and Remote Access Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1 Dial-In/Out . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Authentication . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 Setting-up dial-out . . . . . . . . . . . . . . . . . . . . . . 3.5 One Dial-Out Setup . . . . . . . . . . . . . . . . . . . . . 3.6 Dial-Out Setup contd. . . . . . . . . . . . . . . . . . . . . 3.7 Dial-In Setup . . . . . . . . . . . . . . . . . . . . . . . . . 3.8 Other options . . . . . . . . . . . . . . . . . . . . . . . . . 3.9 Preferred Installation Architectures . . . . . . . . . . . . . 3.10 Preferred Setup 1 . . . . . . . . . . . . . . . . . . . . . . . 3.11 Preferred Setup 2 . . . . . . . . . . . . . . . . . . . . . . . 3.12 Appendix - sendmail configuration for non dial-on-demand. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. . . . . . . . . . . . . .. 65 65 66 67 68 69 70 71 72 73 74 75 76 77. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. 78 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92. 4 Email. ). 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 4.12 4.13 4.14. Objectives . . . . . . . . . . . . How email works . . . . . . . . Where does an email go? . . . Overview . . . . . . . . . . . . Email Protocols . . . . . . . . . Where the protocols go . . . . Basic Installation . . . . . . . . Sendmail behaviour . . . . . . Linuxconf & sendmail . . . . . . "#%$ ' Configuration files ( & "#%$ Configuration files ( & Explanation of examples . . . . Monitoring sendmail . . . . . . Monitoring sendmail (cont.) . . "#%$ Example of ( . . . . . . . .. c GBdirect Ltd, 2000. . . . . . . . . . . . . . . . . . . . . . . . . . . . ) . . and . . . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . %. . . . .. . . . .. . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "#%$ ) . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. www.linuxtraining.co.uk.
(13) CONTENTS. 4.15 4.16 4.17 4.18 4.19 4.20 4.21. iii. Talking the talk ... . . . . . . . . . Talking SMTP . . . . . . . . . . . Talking POP . . . . . . . . . . . . Managing Users under sendmail
(14) $ . . . . . . . . . . . . Aliases - other uses . . . . . . . Sendmail Exercises . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. 93 94 95 96 97 98 99. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 100 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131. 6 More on the Filesystem Objectives . . . . . . . . . . . . . . . . . 6.1 Inodes in Depth . . . . . . . . . . . . . . 6.2 Inodes (continued) . . . . . . . . . . . . 6.3 Links . . . . . . . . . . . . . . . . . . . . 6.4 Hard links . . . . . . . . . . . . . . . . . 6.5 Soft links . . . . . . . . . . . . . . . . . . 6.6 Non-native Filesystems . . . . . . . . . '% +* 6.7 Disk Checking and Recovery ( ) . . -'% * 6.8 Check a Linux Ext2 filesystem ( ) ' 6.9 Disk Free Space ( ) . . . . . . . . . . . 6.10 Disk Usage ( ) . . . . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. 133 133 134 135 136 137 138 139 140 141 142 143. 5 Basic Filesystem Objectives . . . . . . . . . . . 5.1 Filesystem Overview . . . . . 5.2 Files . . . . . . . . . . . . . . 5.3 Directories . . . . . . . . . . . 5.4 Directory Hierarchy . . . . . . 5.5 Pathnames . . . . . . . . . . 5.6 Current Directory . . . . . . . 5.7 Dot (.) and DotDot(..) . . . . . 5.8 Moving and Copying Files . . 5.9 Removing Files . . . . . . . . 5.10 Operations on Directories . . 5.11 Inodes . . . . . . . . . . . . . 5.12 Inodes (continued) . . . . . . 5.13 Links . . . . . . . . . . . . . . 5.14 Hard links . . . . . . . . . . . 5.15 Soft links . . . . . . . . . . . . 5.16 Access Control and UID . . . 5.17 Categories of Access Control 5.18 Access Control - Example . . 5.19 Changing Access Permission: " 5.20 symbolically . . . . . . " 5.21 numerically . . . . . . "# +* . . . . . . . . . . . . . 5.22 , 5.23 Special Files - . . . . . . 5.24 Special Files - . . . . . 5.25 Filesystem Structure . . . . .
(15) '% + . 5.26 - Example . . . . 5.27 Mounting Additional Volumes 5.28 Mounting shared filesystems 5.29 Summary . . . . . . . . . . . 5.30 Filesystem Exercises . . . . . 5.31 Filesystem Solutions . . . . .. ). c GBdirect Ltd, 2000. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . .. www.linuxtraining.co.uk.
(16) CONTENTS. 6.11 6.12 6.13 6.14 6.15 6.16 6.17 6.18 6.19 6.20 6.21 6.22 6.23 6.24 6.25. iv. Disk Partitioning Concepts . . . . . . . . A Partitioned Disk . . . . . . . . . . . . . Making and Changing Partitions . . . . How Many Partitions? . . . . . . . . . . What Size Partitions? . . . . . . . . . . BIOS Problems With LILO and Partitions Disk Partitioning Tools . . . . . . . . . . '
(17) $ +* Using . . . . . . . . . . . . . . . . '
(18) $ +* The Interface . . . . . . . . . . . '
(19) $ +* Interactive Commands in . . . . "%*-' Making Linux Filesystems ( ) . . . Block Devices . . . . . . . . . . . . . . . Character Devices . . . . . . . . . . . . More Filesystem Exercises . . . . . . . More Filesytem Solutions . . . . . . . .. 7 Shared File Systems Objectives . . . . . . . . . . 7.1 NFS (Network File System) 7.2 NFS Basics . . . continued . 7.3 Exporting File Systems . . . 7.4 Viewing exports . . . . . . . 7.5 Importing File Systems . . . 7.6 Samba . . . . . . . . . . . . 7.7 Samba Installation . . . . . 7.8 Samba Basics . . . . . . . . 7.9 Access to Files and Printers 7.10 Testing Samba . . . . . . . 7.11 Smbclient . . . . . . . . . . 7.12 Samba configuration File . . 7.13 Testing Samba . . . . . . . Notes on Testing Samba . . 7.14 Exercises . . . . . . . . . . 7.15 Solutions . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . .. 144 145 146 147 148 149 150 151 152 153 154 155 156 157 159. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. 162 162 163 164 165 166 167 168 169 170 171 172 173 174 175 175 176 177. 8 Firewalling and Network Security Objectives . . . . . . . . . . . . . . 8.1 Concepts . . . . . . . . . . . . . . 8.2 What is Packet Filtering? . . . . . . 8.3 Controlling Access to Daemons . .. $
(20) 8.4 TCP Wrappers ( ). 8.5 TCP Wrapper Validation . . . . . . 8.6 Introduction to Packet Filtering . . 8.7 Basic Packet Filtering . . . . . . . $#$ 8.8 . . . . . . . . . . . . . . $#$ Details . . . . . . . . . . 8.9 $#$ schematic . . . . . . . . 8.10 $#$ Options . . . . . . . . . . 8.11 8.12 Options For Rules . . . . . . . . . $#$ 8.13 - Examples . . . . . . . . 8.14 Removing Rules . . . . . . . . . . 8.15 Implementing ipchains . . . . . . . 8.16 Save and restore . . . . . . . . . . $#$ 8.17 setup script . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. 179 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196. ). c GBdirect Ltd, 2000. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. www.linuxtraining.co.uk.
(21) CONTENTS. 8.18 8.19 8.20 8.21 8.22 8.23 8.24 8.25 8.26 8.27 8.28 8.29 8.30 8.31 8.32 8.33 8.34 8.35 8.36. v. $
(22) %$ . . . . . . . . . . . . . . . . . Real World "# . . . . . . . . . . . . . . . Port Scanning with "# Performance and Reliability Features . . . . . "# Target and Port Specification . . . . . . . . . "
(23) Running . . . . . . . . . . . . . . . . . . . . . Reporting the State of Ports . . . . . . . . . . . . . "# Reporting Other Details with . . . . . . . . . . Scanning Modes: Vanilla TCP & SYN . . . . . . . Scanning Modes: IP Fragments & Reverse ident . Scanning Modes: TCP ftp proxy . . . . . . . . . . . Scanning Modes: UDP raw ICMP port unreachable "
(24) Some other Scanning Modes . . . . . . . . . "# Documentation . . . . . . . . . . . . . . . . . "# Basic Howto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . principles . . . . . . . . . . . . . . . . . . . . . Use of . . . . . . . . . . . . . . . . . . . . . . . Exercises . . . . . . . . . . . . . . . . . . . . . . . Solutions . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. 197 198 199 200 201 202 203 204 205 206 207 208 209 210 214 215 216 217 218. 9 Job Control Tools Objectives . . . . . . . . . . . . . . . . . . 9.1 Introduction . . . . . . . . . . . . . . . . . 9.2 Background Jobs . . . . . . . . . . . . . . *#$ . . . . . . . . . . . . . . . . . . . . . 9.3 $ 9.4 The Command . . . . . . . . . . . . 9.5 Hang Up ( ) . . . . . . . . . . . . . . . 9.6 Execute programs at specified times ( ) . . 9.7 Options and commands related to . . . . 9.8 Running commands regularly ( ) . 9.9 Summary . . . . . . . . . . . . . . . . . . 9.10 Job Control Exercises . . . . . . . . . . . 9.11 Job Control Solutions . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . .. 219 219 220 221 222 223 224 225 226 227 228 229 230. 10 Overview Objectives . . . . . . . . . . . . . . . . . . 10.1 Generic Features of Unix . . . . . . . . . 10.2 Linux — The Kernel of a System . . . . . 10.3 Fundamental Characteristics of Linux . . . 10.4 Multiuser Multitasking and Time-sharing . 10.5 Protected memory mode . . . . . . . . . . 10.6 Multiple Filesystem Types . . . . . . . . . 10.7 The Many Faces of a GNU/Linux System 10.8 The Filesystem . . . . . . . . . . . . . . . 10.9 Filenames . . . . . . . . . . . . . . . . . . 10.10 Filename Extensions and File Types . . . 10.11 Hidden Filenames . . . . . . . . . . . . . ) . . . . . . . . . . . . . . 10.12 The Shell ( 10.13 Key Features of the Bash Shell . . . . . . 10.14 Interacting with a Linux ‘Terminal’ . . . . . 10.15 Software Tools: The UNIX Philosophy . . 10.16 Tasks/Processes . . . . . . . . . . . . . . 10.17 Process Communication . . . . . . . . . . 10.18 Re-directing I/O to and from Files . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. 231 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249. ). c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(25) CONTENTS. 10.19 10.20 10.21 10.22 10.23 10.24 10.25 10.26 10.27. vi. Re-directing I/O to and from Files (continued) Pipes & Tools . . . . . . . . . . . . . . . . . . Linux as a Programming Environment . . . . Networking . . . . . . . . . . . . . . . . . . . TCP/IP . . . . . . . . . . . . . . . . . . . . . . Documentation . . . . . . . . . . . . . . . . . Using the man pages (On-Line Manual) . . . Overview Exercises . . . . . . . . . . . . . . Overview Solutions . . . . . . . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. 250 251 252 253 254 255 256 257 260. 11 Printing Services Objectives . . . . . . . . . . . . . . . . . 11.1 Linux Printing . . . . . . . . . . . . . . . 11.2 Printing documents . . . . . . . . . . . . 11.3 Main Printing Tools . . . . . . . . . . . . 11.4 Using . . . . . . . . . . . . . . . . . 11.5 Using ( . . . . . . . . . . . . . . . . . " 11.6 Using . . . . . . . . . . . . . . . . 11.7 Samba Printing . . . . . . . . . . . . . . 11.8 Printing to a Windows Printer via Samba. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. 263 263 264 265 266 267 268 269 270 271. 12 Basic Shell Objectives . . . . . . . . . . . . . . . 12.1 Introduction . . . . . . . . . . . . . . 12.2 Getting around the command line . . 12.3 History . . . . . . . . . . . . . . . . . 12.4 Plumbing . . . . . . . . . . . . . . . 12.5 Plumbing (continued) . . . . . . . . . 12.6 Output Redirection . . . . . . . . . . 12.7 Input Redirection . . . . . . . . . . . 12.8 Combining Redirection . . . . . . . . 12.9 Pipelines . . . . . . . . . . . . . . . . 12.10 Background Processes . . . . . . . . 12.11 Background Processes (continued) . . 12.12 Background Processes and 12.13 Command Grouping and Sub-shells 12.14 Process Management . . . . . . . . 12.15 Signals . . . . . . . . . . . . . . . . . 12.16 Signals (continued) . . . . . . . . . .. 12.17 Background Processes: . . . . . 12.18 Filename Generation . . . . . . . . . 12.19 Quoting Mechanisms . . . . . . . . . 12.20 Shell built-in commands . . . . . . . 12.21 Basic Shell Exercises . . . . . . . . 12.22 Basic Shell Solutions . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. 272 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 295. 13 Shell Programming Objectives . . . . . . . . . . . . . . . . . 13.1 Introduction . . . . . . . . . . . . . . . . 13.2 Writing and Running Shell Scripts . . . . 13.3 Subshell or Subroutine? . . . . . . . . . 13.4 Processing Commands . . . . . . . . . 13.5 Command Substitution . . . . . . . . . . 13.6 Shell Variables and Variable Substitution. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. . . . . . . .. 296 296 297 298 299 300 301 302. ). c GBdirect Ltd, 2000. . . . . . . . . . . . . . . . . . . . . . . .. www.linuxtraining.co.uk.
(26) CONTENTS. 13.7 13.8 13.9 13.10 13.11 13.12 13.13 13.14 13.15 13.16 13.17 13.18 13.19 13.20 13.21 13.22 13.23 13.24 13.25 13.26 13.27 13.28 13.29 13.30 13.31 13.32 13.33 13.34 13.35 13.36 13.37 13.38 13.39 13.40 13.41 13.42. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 339. 14 Special Topics Objectives . . . . . . . . . . . . . . . . . 14.1 The Linux Bootloader (LILO) . . . . . . . 14.2 LILO configuration . . . . . . . . . . . . $ ' 14.3 Understanding / . . . . . . . . " 14.4 Red Hat Package Management Tool ( " 14.5 Install, Upgrade and Uninstall with . " 14.6 Query Options for . . . . . . . . . . " 14.7 Verify Options for . . . . . . . . . . . " 14.8 Output From the Verification Option 14.9 Building And Installing Applications . . .. ' 14.10 . . . . . . . . . . . . . . . . . '
(27) $ . . . . . . . . . . . . 14.11 Using 0 14.12 Options to configure . . . . . . . . . . . 14.13 Location of install . . . . . . . . . . . . . 14.14 Installation requirements . . . . . . . . . 14.15 Compilation roundup . . . . . . . . . . .. . . . . ) . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . .. 343 343 344 345 347 348 349 350 351 352 353 354 355 356 357 358 359. ). Shell Environment Variables . Examples . . . . . . . . . . . Examples (continued) . . . . . . . . . . . . . . . . . . . . Quoting . . . . . . . . . . . . Examples . . . . . . . . . . . '%$ File . . . . . . . . . '%$ (continued) . . . . . Arguments . . . . . . . . . . . Shell Parameters . . . . . . . Blank Interpretation . . . . . . Comments . . . . . . . . . . . . . . . . . . . . . . . . . $+'. . . . . . . . . . . . . . Exit Status or Return Code .. +. . . . . . . . . . . . . . . File Status Tests . . . . . . . Relational Tests . . . . . . . . ' Loop . . . . . . . . . . . $+' . . . . . . . . . . . . . . . $+' (continued) . . . . . . . . .. ' . . . . . . . . and . #$ $ . . . . . . . and * #$ and . . . . . . . . . . . . . . . . . . . (continued) . . . . . . . (continued) . . . . . . . Simple Conditionals . . . . . Here Documents . . . . . . . Use of commands . . . . . . '
(28) $ . . . . . . . . . . . . . . . Evaluate Expressions ( ) . (continued) . . . . . . . Summary . . . . . . . . . . . Shell Programming Exercises Shell Programming Solutions. vii. c GBdirect Ltd, 2000. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. www.linuxtraining.co.uk.
(29) CONTENTS. 14.16 14.17 14.18 14.19 14.20 14.21 14.22 14.23 14.24 14.25 14.26 14.27 14.28 14.29 14.30 14.31 14.32 14.33 14.34 14.35 14.36 14.37. viii. The filesytem . . . . . . . . . . . . . . Process specific subdirectories . . . . . . . . Process Status . . . . . . . . . . . . . . . . . + +" ) . . . . . . . Process Memory Usage ( Kernel data . . . . . . . . . . . . . . . . . . . Interrupts In Use . . . . . . . . . . . . . . . . $+ IDE Devices ( ) . . . . . . . . . . . . Networking ( + ) . . . . . . . . . . . . . Networking 2 ( ) . . . . . . . . . . . $ SCSI info ( ) . . . . . . . . . . . . . Parallel Port ( ) . . . . . . . . . 1
(30) Kernel Parameters ( ) . . . . . . . . '% File system data ( ) . . . . . . . . . . Example: Increase Maximum Filehandles . . +1
(31) * General Kernel Parameters ( +1% ," ) . Virtual Memory Subsystem ( +1
(32) ,. Device Specific Parameters ( ) +1
(33) % Remote Procedure Calls ( ) +1
(34) . Networking ( ) . . . . . . . . . +1
(35) $,2 IPV4 settings ( +. ) . . . . . Special Topics Exercises . . . . . . . . . . . . Special Topics Solutions . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . ) . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 382. 15 Fundamentals of TCP/IP Objectives . . . . . . . . . . . . . . . . . . . 15.1 Fundamentals of TCP/IP Networking . . . . 15.2 History . . . . . . . . . . . . . . . . . . . . . 15.3 Recap of basic IP Concepts - Components 15.4 IP versions . . . . . . . . . . . . . . . . . . 15.5 Packets . . . . . . . . . . . . . . . . . . . . 15.6 Addresses . . . . . . . . . . . . . . . . . . . 15.7 Addresses (continued) . . . . . . . . . . . . 15.8 Netmasks and subnetting . . . . . . . . . . .. . . . . . . . . . . . . . . 15.9 Netmasks with 15.10 Transferring Data . . . . . . . . . . . . . . . 15.11 Hosts & Interfaces . . . . . . . . . . . . . . 15.12 Routing . . . . . . . . . . . . . . . . . . . . 15.13 Ports . . . . . . . . . . . . . . . . . . . . . . 15.14 Ports cont.. . . . . . . . . . . . . . . . . . . 15.15 Exercises . . . . . . . . . . . . . . . . . . . 15.16 Solutions . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. 384 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400. 16 Practical TCP/IP Objectives . . . . . . . . . . . . . . . . . 16.1 Ping Protocols . . . . . . . . . . . . . .
(36) + . 16.2 Network Statistics ( ) in Practice
(37) + . 16.3 (continued) . . . . . . . . . . .
(38) + . 16.4 - Further Examples . . . . . . ..
(39) " 16.5 Network Traffic ( ) in Practice . ..
(40) " 16.6 Options . . . . . . . . . . . . ..
(41) " 16.7 Examples . . . . . . . . . . . . 16.8 Firewalling . . . . . . . . . . . . . . . . . 16.9 Basic Theory . . . . . . . . . . . . . . . 16.10 Basic Theory (continued) . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. . . . . . . . . . . .. 402 402 403 404 405 406 407 408 409 410 411 412. ). c GBdirect Ltd, 2000. . . . . . . . . . . .. . . . . . . . . . . .. www.linuxtraining.co.uk.
(42) CONTENTS. ix. $#$ . . . . . . . . . . . . . . . . . . $#$ Details . . . . . . . . . . . . . . $#$ Options . . . . . . . . . . . . . . Options For Rules . . . . . . . . . . . . . $#$ - Examples . . . . . . . . . . . . Removing Rules . . . . . . . . . . . . . . Implementing ipchains . . . . . . . . . . . Save and restore . . . . . . . . . . . . . . $#$ setup script . . . . . . . . . . . $
(43) %$ Real World . . . . . . . . . . . . Interface Configuration and Management Point-and-Click Interface Administration .
(44) +1
(45) '
(46) $ * $3 . . . . $+'%' .
(47) . . . . . . . . . . . . . . . . . Altering An Interface . . . . . . . . . . . . Adding an Interface . . . . . . . . . . . . . The ‘Proper’ Way . . . . . . . . . . . . . . Drivers . . . . . . . . . . . . . . . . . . . . The Secure Shell in Practice ( ) . . . . Secure Copying in Practice ( ) . . . . . Summary . . . . . . . . . . . . . . . . . . Exercises . . . . . . . . . . . . . . . . . . Solutions . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435. 17 Basic Tools Objectives . . . . . . . . . . . . . . . . . . 17.1 Introduction . . . . . . . . . . . . . . . . . 17.2 Using Tools . . . . . . . . . . . . . . . . . "# 17.3 The On-Line Manual ( ) . . . . . . . . . '%$ 17.4 Finding Files the Long Way ( ) . . . . 17.5 Locate Files ( ). . . . . . . . . . . . . ). . . . . 17.6 View and Concatenate Files ( 17.7 View Large Files & Output ( ) . . . . . . %$ 17.8 Viewing Parts of Files ( and ) . .. 17.9 Listing File Information ( ) . . . . . . . . '%$ 17.10 File Classification ( ) . . . . . . . . . .
(48) 17.11 Count Words, Lines, Characters ( ) . . .
(49) $'' 17.12 Differences Between Files ( ) . . . . . 4" 17.13 Compare Binary Files ( ) . . . . . . . . 17.14 Regular Expression Searches ( ) . . . 17.15 examples . . . . . . . . . . . . . . . . 17.16 Sort and Merge Files ( ) . . . . . . . . . 17.17 Examples . . . . . . . . . . . . . . . $ 17.18 Display Unique Lines ( ( ) . . . . . . . . $. 17.19 Split Files ( ). . . . . . . . . . . . . . $. 17.20 Splitting Files by Context ( ) . . . . $ 17.21 Compression Utilities (5 ) . . . . . . . .. 17.22 Store and Retrieve Archives ( ) . . . . .. 17.23 Translating Characters ( ) . . . . . . . .. 17.24 Examples of Usage . . . . . . . . . . . . 17.25 Execute programs at specified times ( ) . . 17.26 Options and commands related to . . . . 17.27 Running commands regularly ( ) . . 17.28 Evaluate expressions ( ). . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 436 436 437 438 439 440 441 442 443 444 445 446 447 448 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465. 16.11 16.12 16.13 16.14 16.15 16.16 16.17 16.18 16.19 16.20 16.21 16.22 16.23 16.24 16.25 16.26 16.27 16.28 16.29 16.30 16.31 16.32 16.33. ). c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(50) CONTENTS. 17.29 17.30 17.31 17.32 17.33 17.34 17.35 17.36. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. 466 467 468 469 470 471 472 474. 18 More Tools Objectives . . . . . . . . . . . . . . . . . . . 18.1 Introduction . . . . . . . . . . . . . . . . . .. 18.2 Displaying System Processes ( ) . . . . .. 18.3 Options and Interactive Commands for # 18.4 Reporting process status ( ) . . . . . . . . # 18.5 Options for Reporting process status ( ) . '
(51) $ 18.6 Finding Files using specified criteria ( ) '
(52) $ 18.7 Criteria used in expressions . . . . . . '
(53) $ 18.8 Examples of using ( ) . . . . . . . . . . ,"6 . 18.9 Reporting virtual memory statistics ( ) ,+"6 + . 18.10 Output from . . . . . . . . . . . . . . 18.11 free . . . . . . . . . . . . . . . . . . . . . . . 18.12 ldd . . . . . . . . . . . . . . . . . . . . . . . 18.13 uptime . . . . . . . . . . . . . . . . . . . . . 18.14 xargs . . . . . . . . . . . . . . . . . . . . . . .. 18.15 Options to . . . . . . . . . . . . . . . .. 18.16 Positioning filenames with . . . . . . 18.17 cpio . . . . . . . . . . . . . . . . . . . . . . $ 18.18 5 . . . . . . . . . . . . . . . . . . . . . . 18.19 Unzipping . . . . . . . . . . . . . . . . . . . 18.20 tar . . . . . . . . . . . . . . . . . . . . . . .. 18.21 Raw devices and . . . . . . . . . . . . . 18.22 Exercises . . . . . . . . . . . . . . . . . . . 18.23 Solutions . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. 476 476 477 478 479 480 481 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500. ,#$ 19 Introduction to Editing With Objectives . . . . . . . . . . . . . . 19.1 Text editors under Linux . . . . . . ,#$ 19.2 and your terminal . . . . . . . . ,#$ screen layout . . . . . . . . . . 19.3 ,#$ 19.4 Opening files with . . . . . . . . ,#$ 19.5 Modes . . . . . . . . . . . . . . 19.6 Saving, changing file and quitting . 19.7 Moving around in command mode 19.8 Numeric Prefixes . . . . . . . . . . 19.9 Further Movement . . . . . . . . . 19.10 Further Movement - Example . . . 19.11 Movement by lines . . . . . . . . . 19.12 Movement by lines - Examples . . 19.13 Inserting text . . . . . . . . . . . . $ 19.14 command . . . . . . . . . . . . . 19.15 Multiple Insertion . . . . . . . . . . 19.16 Deleting Text . . . . . . . . . . . . 19.17 Changing Text . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. 501 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518. ). Linux Printing . . . . . Printing documents . . Main Printing Tools . . Using . . . . . . . Using ( . . . . . . . " Using . . . . . . Basic Tools Exercises Basic Tools Solutions .. x. c GBdirect Ltd, 2000. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. www.linuxtraining.co.uk.
(54) CONTENTS. 19.18 19.19 19.20 19.21 19.22 19.23 19.24 19.25 19.26 19.27. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. 519 520 521 522 523 524 525 526 527 529. 20 Basic X-Windows Objectives . . . . . . . . . . . . . . . . . . . . 20.1 What X-Windows Is . . . . . . . . . . . . . . . 20.2 X Needs Window Managers . . . . . . . . . . 20.3 Window Managers Are Applications . . . . . 20.4 Desktop Environments . . . . . . . . . . . . . 20.5 Starting X . . . . . . . . . . . . . . . . . . . . 20.6 Stopping X . . . . . . . . . . . . . . . . . . . 20.7 Running Shells (Xterms) Under X . . . . . . . . " . . . . . 20.8 Running Applications from an 20.9 Running Applications from a window manager 20.10 Configuring X . . . . . . . . . . . . . . . . . . 20.11 Basic X Hardware Configuration . . . . . . . 20.12 Basic X Software Configuration . . . . . . . . 20.13 Networked X - The Client-Server Relationship 20.14 Principles of Running Remote X Apps . . . . 20.15 How to Run Remote X Apps . . . . . . . . . . 20.16 Authentication . . . . . . . . . . . . . . . . . . 20.17 Better Authentication . . . . . . . . . . . . . . 20.18 Basic X Exercises . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. 531 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549. ). Copy and Paste . . . . . . . . . . . Finding your place . . . . . . . . . Miscellaneous Commands . . . . . Search and replace . . . . . . . . . Regular Expressions . . . . . . . . Regular Expression Conventions . Regular Expression Examples . . . Regular Expression Replacement . ,#$ Exercises . . . . . . . . . . . . ,#$ Solutions . . . . . . . . . . . . .. xi. c GBdirect Ltd, 2000. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. . . . . . . . . . .. www.linuxtraining.co.uk.
(55) Module 1. Apache Basics Objectives On completion of this module you should be able to: Install and configure the. 798;:=<?>A@. Set up virtual hosts Use access controls Set up basic authentication. 1. webserver.
(56) Apache Basics. 1.1. 2. What is 798A:C<D>;@. 7B8;:C<D>;@. ?. is the most widely-used web-server1. Listens for requests and hands something back Normally the contents of a file Possibly the result of a program Designed to be stable and configurable Not meant to be fast Probably fast enough . . .. ). 1. 59.99 % of all servers as of February 2001 (Netcraft - www.netcraft.com). c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(57) Apache Basics. 1.2. 3. Installation Basic installation is easy You may be able to install from your distribution Most come with. 798A:C<?>A@. Otherwise just follow the download instructions from the official site >BEBEF8HG6IBIKJFJBJMLN:O8A:C<D>;@PLRQTSVU=I. Then follow the instructions in the. W?XCY[Z. 7F\B\. file. Normally just ]. L6IC<VQK^`_ba?UBcCS`@ ]. d :fe;@ ]. d :fe;@. a?^AgOE;:`hFh. If you have problems check the docs. ). Available at. c GBdirect Ltd, 2000. >FEBEF8HGNIFIKJFJBJiL6:O8A:C<?>A@PLRQTSTU;IVjCQk<Tg. www.linuxtraining.co.uk.
(58) Apache Basics. 1.3. 4. How Apache Listens Apache runs several processes at any one time Parent and several children Parent ‘watches over’ the children Tracks how many are answering requests Spawns more if free processes drop below a certain point Kills spare processes if there are lots free Configure child numbers using MinSpareServers and MaxSpareServers directives Default is reasonable for a small business. ). Tune it for busier sites. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(59) Apache Basics. 1.4. 5. Configuration File(s) If compiled from source,. 798A:C<?>A@. IOclgTSkI`h9QC<[:khVIB:f8;:=<?>;@. installs in. Earlier versions installed under IOcAgVS`Ikh9Qk<T:`h9IB@OEm<[If>BEBEF8Cj. Your distribution may differ again . . . Configuration file is called. 2. >BEBEF8CjnLo<TQO^`_. Older versions use 3 >BEBEF8CjnLo<TQO^`_ gTS d. Lo<VQK^`_. :C<B<T@FgFgpLo<VQK^k_. Controls what requests. 7B8;:=<?>;@. answers. and how . . .. 2. Redhat installs config files under q#r
(60) s&tNqu6sNsvxw and the sample web pages and logs directories under qu&yz{rxqu6sNsvxw 3 Some pre-packaged versions (Such as the RedHat RPM) also use separate files ). c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(61) Apache Basics. 1.5. 6. Key Configuration Directives Wide range of configuration directives For a very basic server you need at least the following: ServerRoot DocumentRoot ServerAdmin BindAddress Port Listen User. ). Group. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(62) Apache Basics. 1.6. 7. ServerRoot, DocumentRoot Tells. 7B8;:C<D>;@. where its files live. ServerRoot tells directories live. 7B8;:=<?>;@. where its. <VQK^k_. and. h9QfU;g. Not always necessary Good practice to have it 7B8;:=<?>;@. DocumentRoot tells documents to serve up. where to look for. Requested filenames are appended to this If you have | QC<?c d @O^FEF}AQBQKE. IOJBJBJlIVjCQk<Tg. then a request to >BEFEB8iGNIBIOJBJFJiL#jCQ d :=a~^iLo<VQpLc`e=IT_=QBQPL>FE d h. ). points to the file. c GBdirect Ltd, 2000. IKJFJBJlIVjkQC<TgBI[_=QFQpL>BE d h. www.linuxtraining.co.uk.
(63) Apache Basics. 1.7. 8. ServerAdmin 798A:C<D>;@. sometimes can’t complete requests. In these cases it serves up an error page ServerAdmin is given as a contact address Usually set to something like JA@f d :FgKEA@VSFBjkQ d :;a~^HL{<TQPLcFe. You should of course ensure that it is a valid email address Possible to specify a different error page. ). Doesn’t have to use ServerAdmin. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(64) Apache Basics. 1.8. 9. BindAddress, and Port Tells. 7B8;:C<D>;@. which requests to answer. 798A:C<?>A@. By default your machine. listens to every IP address on. But only to the port given by the Port directive a?^CjV7kjBjFS`@`gBg. KB L/OVnL L. 7B8;:C<D>;@. tells anything that doesn’t come in on QVS[E. FBF. to ignore. KB L/OVnL L. ignores all but the specified port. You can use more than one Port directive, e.g. QVS[E. F. QVS[E. FBF. If you don’t specify a port then a default is used4 You can only use one BindAddress!. 4. This is usually 80, but if you are using a binary package then bear in mind whoever compiled your package may have chosen a different value ). c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(65) Apache Basics. 1.9. 10. Listen Listen is a replacement for BindAddress and Port Given IP:port or just port, e.g. \aTgKEA@O^. KB L/OVnL LGF9`. will answer requests on the IP address KB LKVnLL/ FBF and port and no others To answer requests to all valid IP addresses, but ` only a certain port (e.g. ) use: \aTgKEA@O^. F. Can use more than one Listen directive. ). Should be used instead of BindAddress and Port in new servers. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(66) Apache Basics. 1.10. 11. User and Group. 798A:C<D>;@. should normally be started as root. So it can change the user ID of the children These should not run as root User and Group directives say what user/group the children should run as Important security feature Should be set to something that has no real power on your system Most people use user and group. ^AQOAQTjT. Web documents should be readable by this user. ). Nothing should be writeable except log files. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(67) Apache Basics. 1.11. 12. Apache Processes. Looking at a process list5 you can see The parent . . %. 2. /. . . The children . . . . . 1 1 1 1 1 1. . . . . . . // /- / / / / / 6 / 6 /. . . . $ . % . . . . #$ $ # $ # $ # $ # $ #. . . . . . . . . . . . . . . . . . . . . Spare processes don’t use processor time They are ‘sleeping’ They do use memory, however Negligible for a default. 798A:C<?>A@. Watch carefully the more modules you add!. ). 5. Some fields from the v/ output have been left out to aid clarity. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(68) Apache Basics. 1.12. 13. Logging. 798A:C<D>;@. can log information about accesses. Use the TransferLog and ErrorLog directives Sk:O^lgf_C@9SV\;QOU Z. h9QfU;g9IF:C<F<[@FgFg9kh9QOU. will log all requests in the file Y. @9S[ A@VST}AQBQOE;I`hBQOUAg9IB:=<B<T@FgBgB`hBQOU I. If the filename starts with a then it is treated as a proper pathname, not appended to ServerRoot ErrorLog is similar but controls where error messages go Useful for debugging CGI scripts and misconfigurations. ). Check here first if. c GBdirect Ltd, 2000. 7B8;:C<D>;@. won’t start. www.linuxtraining.co.uk.
(69) Apache Basics. 1.13. 14. Customizable Logging. Customizable logs available with CustomLog ¡VclgKElQ d \;QOU. _aVhV@f^;: d @. _=QVS d :OEm¢TgKE=SAa~^`U. _=QTS d :fEm¢[gOECSla~^FU. consists of ‘% directives’ and/or. text % directives include: £¥¤ £§¦ £?¨©«ª¬¯®?ª¯°!±K¬o²fª¥³D´ £§µ £° £¥¶ £¥· £¥¸ £¯¹. ). £¥º. c GBdirect Ltd, 2000. Bytes sent, excluding HTTP headers Filename The contents of headername: header in the request The process ID of the child that serviced the request First line of request Time, in common log format time format The time taken to serve the request, in seconds Remote username (may be bogus if return status (%s) is 401) The URL path requested The ServerName of the server answering the request. www.linuxtraining.co.uk.
(70) Apache Basics. 1.14. 15. CustomLog examples. To@9S[log the referer information in the file A@VST}AQBQOE;I`hBQOUAg9IVSk@[_=@VS`@9S Y. .
(71) " » ' ' Á1¯ ' $ ½¼3¾À¿ ¾Â¿ à ¼. % directives can be conditional on reply status .
(72) " » ' ' Á1¯ -{ÄÅ 2&ÄÅ' $ ½¼3¾À¿ ¾ ¿ à ¼. Logs the refering page only on status 200,304,302 6 For full details consult the Apache documentation Gives list of all possible % directives. ). 6. For full details consult the Apache documentation. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(73) Apache Basics. 1.15. 16. Example Configuration. A sample configuration file could look like this : Y. @9S[ A@VST}AQBQOE. IfcAgVS`I`hBQk<T:`hVIF:O8A:C<?>A@. | QC<?c d @O^FEF}AQBQKE. IfcAgTSkI`hBQk<[:khVIF:O8;:=<?>A@BIO>FECjCQk<Tg. @9S[ A@VST7Cj d a~^ JA@f d :`gKEA@VSBFjkQ d :=a?^HL{<TQpLcFe Y \ aTgKEA@O^ KB L/OVnL LDÆbG#` Ç gB@VS. ^AQOAQVj[. È`SCQKcF8. ^lQKlQTj[. É SFSkQVSV\=QfU. IOcAgVS`Ikh9Qk<T:`h9IB:O8A:C<D>;@BIkh9QfU;g9IF@VSFSkQTSk`hBQOU. We recommend starting with the default >BEFEB8=jLo<VQK^k_ rather than from scratch Correctly configures many things for you The default is well annotated Everything after a Ignored by 798A:C<D>;@. character is a comment. 798;:=<?>A@. can check the syntax of its configuration. >BEBEF8Cj. ¢~E. :O8;:=<?>A@C<?Eh. ). Ê. c GBdirect Ltd, 2000. <TQK^k_aDU9E;@`gKE. www.linuxtraining.co.uk.
(74) Apache Basics. 1.16. 17. Basic Exercises. 1. Apache Installation (a) Find out if Apache is installed on your machine . . . if not, install it. (b) Check Apache is running on your system. i. You should be able to point your web browser at check this ! - ii. You might have to try . ¯. . -. . . . to. (c) If Apache is not running, start it. $ . i. Run % Ë for information (d) If Apache still doesn’t appear to be running, find its configuration and log files and try to fix the error. 2. Basic configuration (a) Familiarise yourself with the. . . . '. file.. (b) How would you change the directory where the log files are kept?. (c) How would you change the ’root’ for documents? (d) How would you enable symbolic links to be followed on the cgi-bin directory. (e) Make your site only accessible on Port 8080 (f) Now make it only accessible on the IP address 127.0.0.1, and port 80 (g) Make the changes and check them.
(75) +
(76) file: (h) Place the following line in your m + *b ÌÍÎ ÏÏ ¿Ð /Ñ. ÌÍÎ ÏÏ ¿Ð where is the IP address of your machine. You should now be able ! + * &Ñ to browse 3. Logging (a) Take a look at the access logs and familiarise yourself with the information they contain. (b) Set up a custom log to give the time of the request, the request, referer, and number of bytes sent, as well as the time taken to serve the request.. ). (c) Alter your custom log to show the time taken and bytes sent only if a 200 status response occured.. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(77) Apache Basics. 1.17. 18. Solutions. 1. Apache Installation (a) If Apache is not installed you should be able to install it off a RedHat CD by " $, " " Ò ÍÓ " ¿ ¿. Ô mounting the CD and typing . . (b) There are several ways to check this. One is to + to port 80 of your machine and see if you get a response. i. This should work for a default RedHat install, though the port number that Apache first listens on changes in various different packaging so you should try both 80 and 8080. (c) You can start Apache one of two ways (Which may be the same on some machines!) Õ Õ /etc/rc.d/init.d/httpd start somepath/apachectl start 7 (d) If you can’t work out why Apache isn’t running ask the tutor for assistance. 2. Basic configuration. ' (a) You should make sure that you understand everything in the including those sections that are commented out. "
(78) » » and Ð directives to change where the log files are (b) Alter the kept, e.g. » , "%1 Ð + "
(79) » , "%1 "" Ï "#. ¿ directive, e.g. (c) The ’root’ for documents is specified by the Ï "
(80) . "%1 "#
(81) ¿ . #$ × . Ø Ï
(82) $ +. 1Û Ì Ð Ù to the Ú (d) You can enable symbolic links by adding Ö $ $ section for your , e.g. Ï#$ +. 1 "1 "#
(83) $ $ Û Ú . #$ Ø× . Ì Ö Ð Ù Ï#$ +. 1Û Ú . '. Í Í (e) Add/Change the directive in your file to read ' »
(84) $ + - 6Ü : (f) Add the following to your (g) Restart the server and try to access it on both port 80 and 8080. Check that it only works as you expect and fetches documents from the correct place. ! + * &Ý (h) Check that you can browse. ). 7. You may have to dig a little to find where this script is. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(85) Apache Basics. 19. 3. Logging (a) Make sure you understand what each of the columns in the access logs is for.. $ ing the logs as you browse your webserver Try ' "#. which holds the desired log (b) The following should create a file format. » "#. ' $ Þ ¼3¾ ¾ß½¾Â¿ à ¾ ¾àN¼l + "
(86) » ' "# . ). (c) Change your LogFormat line to » "#. ' $ - Þ ¼á ¾ß½¾Â¿ à ¾ + "
(87) » ' "# . c GBdirect Ltd, 2000. ¾. -. àN¼A. . . www.linuxtraining.co.uk.
(88) Apache Basics. 1.18. 20. Two sites and more .... 798A:C<D>;@. can serve multiple sites easily. Known as ‘Virtual Hosting’, e.g. â/ã ´/°!¶§¸«¬ä/嫿ç&¶. è{é§êlëè{ì!íbëîëê§ï. ð æ~ñ&¸¯²fª/±§¶ò«æ§æ/¶ôó&õ§õ§õOó&õKª/¤Øë¶«ªç&¶Dê~ó¯®?æ~ñ¥ç ö ª¯°¥º«ª¯°¥÷D¬{²fªøõ§õ§õùë+¶Kªç&¶Dêlëñ!æAë+¸§ú ö ª¯°¥º«ª¯°!û~®²V´o±üõ§õ§õ?ý¥¶«ªç&¶Dêëñ!æAë+¸ú þ °§°D毰§ÿ?æ. ó/õ§õ§õKó&õOª/¤Øë+¶«ª~ç&¶Dêóä§æKç!󧪯°¥°D毰~䥿. ·~°?¬±Kç/¦Dª¯°ÿ?æó&õ§õ§õOó&õKª/¤Øë¶«ªç&¶Dê~ó䥿Kç!ó¬~ñ¥ñ!ªç¥ç?䥿 â ó ã ´&°!¶§¸«¬~ä&嫿ç&¶«ï. to make apache answer requests to address KB LKVnLL IKJFJBJAIOJA@fHLEA@FgOE=FI9jkQC<Tg from Your machine must answer to this address8 798A:C<D>;@. must be listening on the address. \a[gOE;@f^. `. 798;:=<?>A@. will make answer to all available addresses on port 80 This is known as IP-based virtual hosting. ). 8. If you don’t know how to set up IP aliases ask the instructor. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(89) Apache Basics. 1.19. 21. Virtual Hosting Options. IP-based Each site must have a unique, IP address Uses up valuable IP addresses Site accessible by all browsers Name-based Sites share an IP address Useful if short of available addresses Some browsers may have problems Most use IP-based hosting where possible. ). Ensures maximum accessibility. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(90) Apache Basics. 1.20. 22. Name-based hosting. Name-based hosting looks like: ÷D¬o²[ª ã ´&°!¶¸«¬ä&嫿~ç&¶ â/ã ´/°!¶§¸«¬ä/嫿ç&¶ ö ª¯°¥º«ª¯°!û~®²V´o±. è{éêlë#è{ì!ímëîlë. ¦Dæ§æAë ®?æo²f¬?´{±Øëñ!æA븧úDï ¦Dæ§æo²[¬ç&¶«ª¯°ý§®?æo²f¬D´o±Øëñ!æ;븧ú. ð æ~ñ&¸¯²fª/±§¶ò«æ§æ/¶ôó&õ§õ§õOó¦Dæ§æ§ó!®?æ~ñ¥ç þ °§°D毰§ÿ?æ. ó/õ§õ§õK󦫿§æ§ó䥿Kç¥ó§ª¯°°?毰~䥿. ·~°?¬±Kç/¦Dª¯°ÿ?æó&õ§õ§õOó¦Dæ§æ§ó~䥿Kç¥ó¬~ñ§ñ!ªç¥ç ~ä!æ â ó ã ´&°!¶§¸«¬~ä&嫿ç&¶«ï â/ã ´/°!¶§¸«¬ä/嫿ç&¶ü¤«¬¯°bë ®?æo²f¬?´{±Øëñ!æA븧úDï ö ª¯°¥º«ª¯°!û~®²V´o±. ¤«¬¯°/²[¬ç&¶«ª¯°ý§®?æo²f¬D´o±Øëñ!æ;븧ú. ð æ~ñ&¸¯²fª/±§¶ò«æ§æ/¶ôó&õ§õ§õOó/¤«¬¯°?ó!®?æ~ñ¥ç þ °§°D毰§ÿ?æ. ó/õ§õ§õKó/¤K¬¯°?ó䥿Kç¥ó§ª¯°°?毰~䥿. ·~°?¬±Kç/¦Dª¯°ÿ?æó&õ§õ§õOó/¤«¬¯°?ó~䥿Kç¥ó¬~ñ§ñ!ªç¥ç ~ä!æ. ). â ó ã ´&°!¶§¸«¬~ä&嫿ç&¶«ï. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(91) Apache Basics. 1.21. 23. Name-based hosting (continued) : d @ ØaKSTEBcA:`h
(92) AQBgOE. 798A:C<D>;@. tells can serve multiple hosts X. that an IP address. ØaOS[EFc;:`h
(93) ;QFgKE. sections describe how documents for each site are served 798;:=<?>A@. must be able to resolve the names in the <VirtualHost> directives to the IP address 798A:C<D>;@.
(94) AQBgKEiG. looks at the header to decide which documents to serve Not sent by all browsers Requests on other IP addresses will be processed as normal. ). Can use both IP-based and name-based hosting. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
(95) Apache Basics. 1.22. 24. Block Directives. 798A:C<D>;@. has several block directives. Limit enclosed directives to apply to a certain set of ‘things’ ùaKSTEBc;:kh
(96) AQBgKE. is a block directive. Enclosed directives apply only to that virtual host. ). Others are: . | aOS`@=<?EAQVS[. . | aOS`@=<?EAQVS[;:OEm<?>. . I | aKSk@C<?ElQTST;:fEb<D>. . aVhV@`g. . aVhV@`g ;:fEb<D>. LBLFL. I. \=QC<[:fEma[QO^. . \=QC<[:fEma[QO^A:OEb<D>. c GBdirect Ltd, 2000. LFLBL. aTh9@Fg. . . LBLFL. . LBLFL. I | aKS`@=<?ElQTS[. . LFLBL. . I. aTh9@Fg ;:OEm<?>. . IT\=QC<[:OEØa[QO^ LBLFL. . IT\=QC<[:OEØa[QO^;:fEb<D>. www.linuxtraining.co.uk.
(97) Apache Basics. 1.23 . 25. Block Directives (continued) | aKSk@C<?ElQTST. ^A: d @. Limits the enclosed directives ^A: d @ to apply to everything below the directory ^;: d @. can be anywhere on the filesystem. Independent of DocumentRoot . \;Qk<T:OEmaTQK^. ^;: d @. is similar but is a URL path rather than a filesystem path . aTh9@Fg. ^;: d @. limits directives to files called. ^A: d @. Path of the file is irrelevant. ). Only checks the file name, not its location. c GBdirect Ltd, 2000. www.linuxtraining.co.uk.
Related documents