Cung cấp các thông tin tổng quan về CentOS, các dịch vụ mà CentOS cung cấp, hướng dẫn sử dụng, các lệnh thường được sử dụng. Ebook gồm tổng cộng 19 chương cung cấp cho bạn các thông tin cụ thể. Tóm tắt các chương: Chapter 1 will give you a walkthrough on how to install CentOS into your computers. You will be given advice on how to prepare for your first Linux installations such as where to get an install CentOS DVD and having a checklist for an enterprise server setup and enterprise workstation setup. After this chapter, you now have at least two working CentOS machines that are good enough for you to experiment with Linux. Chapter 2 will introduce you to the commandline interface of Linux using the Bourneagain shell or BASH. With BASH, you will be able to find out who is currently logged in, see the concepts behind the Linux filesystem and why the directories are arranged like that, and how to manage directories such as making symbolic links (or shortcuts) or removing directories. If you ever get stumped on any of the shell commands, you will be given an overview on how to get help about it using the man pages. Chapter 3 will show you how to customize your installed CentOS systems depending on your requirements. You will be given an overview of the Linux boot process,the importance of a bootloader, the runlevels your systems can use, and configuring the system services needed to be started at boot. In addition, you will see how you can configure other system settings such as the keyboard, the current language, the system networking, the graphical adjustment, and the printer. Chapter 4 will dig deeper into the realm of storage. You will learn how to manage storage devices such as preparing and adding hard drives and what filesystems you can use for them on your system. You will be shown how to set them up for redundancy using RAID or have an extensible partitioning capability with the Logical Volume Manager. Chapter 5 will show you how to manage users on your systems. You will learn how to add, remove, and modify users, and change passwords on both the graphical desktop and on the commandline interface. Armed with the concepts of Linux users, you will know how to put restrictions on the amount of storage space users can access through the use of disk quotas. Chapter 6 will introduce you to the X Windows, the base system that is used by graphical Linux applications such as the GNOME Desktop. You will also learn how to use the GNOME Desktop controls like menus and buttons. Later, you will see how you can use your desktop to connect to another X Windows server for remote graphical administration. Chapter 7 will show you how to manage packages in your system. You will learn how to install, update, and remove packages, and use repositories to further streamline package management in your system. Chapter 8 will give you a background on basic Linux security to secure your system. You will know how to configure the system logger and view log files to monitor your system in case of a breakin. You will also see how to schedule tasks for automation. Lastly, you will learn how to use LinuxPAM to have a central way of authenticating users with PAMenabled applications. Chapter 9 will show you advanced methods of securing your system. You will learn how to use digital certificates for encryption, install and configure intrusion detection tools to detect unwanted attacker breakins, and monitor system consistency through packages and additional tools. You will be introduced to how to apply a strict security mechanism in your system through SELinux policies. Chapter 10 will show you how to secure your system onthe network. You will learn how to create firewall rules to prevent unwanted traffic and attackers from entering your system through the network. You will also see how to use tcp_wrappers that can provide security for services that can interface with it. To have a secure way to save your system log files, you willlearn how to configure a central log server in this chapter. Chapter 11 will show you how to install and configure different network services on your servers. Some of these network services include the secure shell (SSH) for encrypted connections and the Network Time Protocol server to have synchronized time data on your network. You will see that CentOS is enough to provide the required network services on your network. Chapter 12 will introduce you to some of the open source databases that you can use with CentOS. These include MySQL and PostgreSQL. You will learn how to install and configure each database system and see how to run database queries on them. You will also see the similarities and differences among database systems, which will aid you in choosing the one that is right for you based on your requirements. Chapter 13 will show you how to use web services with the Apache Web Server. You will be able to install and configure Apache to serve web pages and scripts such as PHP. If you plan to manage multiple domains using Apache, you will learn that using the virtual hosts. Chapter 14 will introduce you to the available file services that you can use on your system. These services are FTP to distribute files, NFS to share files with fellow LinuxUnixcomputers, and Samba to share files on your Windows network. You will also begiven a walkthrough on how to share a printer on your Samba server to allow Windows computers to have a central print server. Chapter 15 will show you how to provide email serviceson your network. You will see how to install and configure mail servers to send email and IMAPPOP3 servers to retrieve emails. Chapter 16 will introduce you to the directory services. You will know how to provide central authentication on Linux or Unixonly computers and to hybrid systems. This will make user credentials available to computers that can use your directory services. Chapter 17 will introduce you to the Linux kernel, the core of your CentOS system. You will learn about the different types of kernels you can use, manage additional kernel capabilities through modules, and make yourself a new kernel. Having kernel building techniques on hand will be advantageous because you get to customize your system as you wish. Chapter 18 will teach you about virtualization, the technology that companies and organizations use to save on cost and energy. You will learn about the various virtualization technologies that you can use later. You will experience virtualization using Xen bycreating new separate instances of CentOS systems within your current CentOS system. Chapter 19 will teach you about the basics of Linux troubleshooting to prepare you for situations when your system cannot boot as expected. You will learn how to use the rescue environment to enter your system to know why it cannot load, and fix it. You will know how to find the correct partitions and directories of your unbootable system to begin your repairs. After you finish this book, you will have a better grasp of the basics of Linux in general and CentOS in particular that will be essential when you learn other advanced Linux administration techniques in your career. You can get an even more advanced Linux book, and you will find that it is much easier to understand because of what you have learned in this book. If you are an aspiring Redhat Certified Engineer, reading this book will give you an edgewhen using review materials aimed for the RHCE exam. You will better understand the mock exam questions and mock setups that the RHCE reviewer teaches you because you will be able to associate whatyou have learned in thisbook to your practice sessions with the reviewer.
this print for content only—size & color not accurate trim = 7.5" x 9.25" spine = 0.000" 000 page count CYAN MAGENTA YELLOW BLACK Foundations of CentOS Linux ThE ExpErT’s VOiCE ® iN LiNux Foundations of CentOS Linux Enterprise Linux On the Cheap Ryan Baclit, Chivas Sicam, Peter Membrey, and John Newbigin Companion eBook Available A truly free enterprise alternative to Red Hat Enterprise Linux Baclit Sicam Membrey Newbigin BOOKs fOr prOfEssiONALs BY prOfEssiONALs ® US $42.99 Shelve in Linux User level: Beginning Companion eBook See last page for details on $10 eBook version Foundations of CentOS Linux: Enterprise Linux On the Cheap Dear Reader, I’ve been using Linux for years for software development, for personal enter- tainment, and to create servers to be deployed on the network. But when asked on which distribution I always use when creating and deploying network serv- ers, I always say CentOS. With CentOS, I have all the tools that I need to do tasks with Linux, from command-line shell scripting to graphical systems adminis- tration with virtualization. The book you are holding now contains expert advice that will help you learn Linux administration with the CentOS distribution. You will be able to write shell scripts, schedule automated tasks and use the GNOME desktop. For network servers, you will learn how to properly install and configure file sharing and print servers, combine servers with directory services for unified authentication, and use virtualization to save on hardware costs. With this book, you have a concrete starting guide to learning Linux with CentOS. You will spend less time asking questions and more time to build- ing whatever you need with CentOS as you learn about it with this book. If you have plans of becoming an RHCE (Red Hat Certified Engineer), what you have learned here will give you a boost in studying review materials for the RHCE exam. I hope that you will enjoy learning Linux with CentOS and use it to create masterpiece servers with this book. Ryan Baclit THE APRESS ROADMAP The Definitive Guide to SUSE Linux Enterprise Server Pro Linux System Administration The Definitive Guide to CentOS Pro Ubuntu Server Beginning the Linux Command Line Beginning Ubuntu Linux, 4th edition Beginning SUSE Linux Foundations of CentOS Linux Beginning Ubuntu LTS Server Administration )3". Ryan Baclit Chivas Sicam Peter Membrey John Newbigin Download at WoweBook.Com Foundations of CentOS Linux Enterprise Linux On the Cheap ■ ■ ■ Ryan Baclit, Chivas Sicam, Peter Membrey, and John Newbigin Download at WoweBook.Com ii Foundations of CentOS Linux: Enterprise Linux On the Cheap Copyright © 2009 by Ryan Baclit, Chivas Sicam, Peter Membrey, and John Newbigin All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. The Evolution Mail Client logo is a copyright of Evolution project and was printed with permission. ISBN-13 (pbk): 978-1-4302-1964-4 ISBN-13 (electronic): 978-1-4302-1965-1 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. President and Publisher: Paul Manning Lead Editor: Frank Pohlmann Technical Reviewers: Peter Membrey and Ann Tan-Pohlmann Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Debra Kelly Copy Editors: James A. Compton, Heather Lang, Patrick Meader, and Sharon Terdeman Compositor: Bob Cooper Indexer: BIM Indexing and e-Services Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit http://www.springeronline.com. For information on translations, please e-mail info@apress.com, or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales—eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com. Download at WoweBook.Com I dedicate this book to all current and future users of Linux. —Ryan Baclit To Anna. May all your dreams come true. —Chivas Sicam For my granddad, Bill “Pappy” Membrey. Without his unwavering support and guidance (not to mention patience), I would not be where I am today. —Peter Membrey To my fiancée, Jenna. —John Newbigin Download at WoweBook.Com iv Contents at a Glance ■About the Authors xvii ■About the Technical Reviewer xx ■Acknowledgments xxi ■Introduction xxii ■Chapter 1: Installation 1 ■Chapter 2: BASH 31 ■Chapter 3: Client/Host Configuration 55 ■Chapter 4: Data Storage Management 71 ■Chapter 5: User Management 87 ■Chapter 6: X Window System 105 ■Chapter 7: Package Management 133 ■Chapter 8: Basic Linux Security 153 ■Chapter 10: Network Security 203 ■Chapter 11: Network Services 227 ■Chapter 12: Open Source Databases 261 ■Chapter 13: Linux Web Services 289 ■Chapter 14: File Sharing Services 313 ■Chapter 15: Linux Mail Servers 335 ■Chapter 16: Directory Services 373 ■Chapter 17: The Linux Kernel 415 ■Chapter 18: Linux Virtualization 435 ■Chapter 19: Linux Troubleshooting 457 ■Index 471 Download at WoweBook.Com ■ CONTENTS v Contents ■About the Authors xvii ■About the Technical Reviewer xx ■Acknowledgments xxi ■Introduction xxii ■Chapter 1: Installation 1 Preinstallation Steps 1 Installation 3 Troubleshooting 29 Summary 30 ■Chapter 2: BASH 31 Working with the Command-Line Interface 31 Identifying the Working User 32 The Linux Filesystem 33 Directory Management 35 Listing the Contents of a Directory 36 Traversing Directories 39 Absolute and Relative Paths 39 Creating Directories 40 Renaming and Moving Files 40 Deleting Directories and Files 41 Creating and Viewing Text Files 42 Viewing the Contents of a File 44 Text Processing 45 Standard I/O Devices 46 Redirection 47 Piping 47 Getting Help 48 Environment Variables 51 Creating and Running Your Own Script 52 Summary 54 ■Chapter 3: Client/Host Configuration 55 The Boot Process 55 The Boot Loader 55 Download at WoweBook.Com ■ CONTENTS vi Kernel, Init, and Runlevels 60 Services 62 Keyboard Settings 63 Language Settings 64 Date and Time Settings 65 Network Settings 67 Graphics Settings 68 Printer Settings 69 Summary 70 ■Chapter 4: Data Storage Management 71 Provisioning a New Hard Drive 71 Partitioning a Disk Using RAID 77 Understanding RAID Types and Levels 78 RAID 0 78 RAID 1 78 RAID 5 79 Checking on RAID 81 Partitioning with LVM 81 Understanding How LVM Works 82 Volume Groups 83 Physical Volumes 83 Logical Volumes 84 Making Sure Your Volumes Work 85 Finding More Information on LVM 85 Summary 85 ■Chapter 5: User Management 87 Managing Users and Groups with the Graphical Interface 87 Adding a User 87 Changing User Properties 89 Deleting a User 91 Adding a Group 91 Changing Group Properties 92 Deleting a Group 93 User Management on the Command Line 93 Adding a User 94 Changing User Properties 94 Deleting a User 95 Adding a Group 96 Changing Group Properties 96 Deleting a Group 96 Implementing Disk Quotas 98 Enabling User and Group Quotas on a Filesystem 99 Setting Up the Quota Files 99 Download at WoweBook.Com ■ CONTENTS vii Setting Up Quotas 100 Setting Grace Periods 101 Managing Quotas for Groups 101 Enabling Quotas 101 Reporting on Quotas 101 Setting Resource Limits 102 Summary 103 ■Chapter 6: X Window System 105 X.Org 106 xorg.conf 106 The Keyboard Section 107 The Device Section 108 The Screen Section 108 The ServerLayout Section 110 Making a New xorg.conf File 111 The GNOME Desktop 111 Top Panel 112 Applications 113 Places 115 System 117 Customizing Menus 118 Launchers 120 Separator, Update, Clock, and Sound Applet 121 Bottom Panel 121 XDMCP Remote Connections 122 GDM Configuration 123 Reloading Options with gdmflexiserver 125 Using XDMCP with GDM 125 Requesting an X Session with XDMCP 126 XDMCP with X Query 126 XDMCP with Xnest 128 X with SSH 130 Summary 131 ■Chapter 7: Package Management 133 RPM 133 The RPM Filename Convention 134 The rpm Command 135 Installing a Package 135 Signed Packages 136 Importing Keys 136 Verifying Packages 137 Adding More Output 137 Package Dependencies 138 Download at WoweBook.Com ■ CONTENTS viii Upgrading a Package 139 Removing a Package 140 Querying a Package 141 Information and File Contents of a Package 141 Source RPMs 142 The Spec File 143 The rpmbuild Command 144 Building a Binary Package from a Source Package 144 YUM 145 Installing Packages with YUM 146 Removing Packages with YUM 146 Updating Packages with YUM 147 Searching Packages with YUM 148 Adding Sources for YUM 148 Creating Repositories for YUM 150 Summary 151 ■Chapter 8: Basic Linux Security 153 System Logger 153 Using syslog.conf 154 Selectors 155 Actions 157 Detecting Intruders with the System Logger 158 Automating Tasks with cron 160 Using crontab 161 Using cron.allow and cron.deny 161 Working with the crontab File 161 The crontab Task 161 Browsing Available Tasks 163 Removing Tasks 163 Pluggable Authentication Modules 163 Understanding PAM Rules and Configuration Files 165 servicename 166 Management Groups 167 Control 167 modulepath 168 Testing PAM 168 Testing pam_time.so with crond 169 Finding Other PAM Modules 170 Summary 170 ■Chapter 9: Advanced Security 171 Using Digital Certificates 171 Creating Certificates 172 Deploying Certificates 176 Download at WoweBook.Com [...]... Foundations of CentOS Linux: Enterprise Linux on the Cheap was written for beginning to intermediate level administrators who want to learn Linux using CentOS This book was designed to be a hands-on type of book to enable you to grasp Linux concepts fast Starting with Chapter 1, you will be given background and instructions on how to install CentOS in your computers properly Then you will install CentOS. .. or CentOS, is an enterprise Linux distribution It was developed by the CentOS Project community using the source code of the commercial Linux distribution from Redhat, the Redhat Enterprise Linux (RHEL) They created CentOS to have a free alternative to RHEL and to have a Linux distribution that's as stable as its commercial counterpart and can keep up with the requirements of the enterprise Using CentOS. .. me to the world of writing books with Apress The CentOS community They created the alternative Linux distribution to RHEL for the use of all The rest of the open source community They have shown a commitment to providing great open source software God If it were not for Him, I would not have everything I have now –Ryan Baclit I would like to thank the people of Apress for their support in this endeavor... you won’t be able to see the performance and reliability of CentOS if it is running on virtual machines instead of running standalone So you’ve decided to learn CentOS, the cheapest enterprise Linux operating system available When we say cheap, we mean cheap! You can actually download CentOS for free from this link: http://isoredirect .centos. org /centos/ 5/isos/i386/ We recommend, though, that you obtain... better CentOS after each release CentOS has an interactive community, and you can ask them for assistance (go to http:/ /centos. org) if you need it You can send email to community members to share ideas or ask for solutions on the problems that you may have encountered while using CentOS For business users that plan to use CentOS on their organization, they can avail of commercial support for CentOS. .. and software analysis and design with UML When not playing with Linux, he studies manga illustration, reads manga, and collects anime toys ■Chivas Sicam works as an entrepreneur and IT consultant Chivas takes pride in being part of the DOST-ASTI (Department of Science and Technology Advanced Science and Technology Institute) Bayanihan Linux project His team has advocated the use of open source software... your repairs After you finish this book, you will have a better grasp of the basics of Linux in general and CentOS in particular that will be essential when you learn other advanced Linux administration techniques in your career You can get an even more advanced Linux book, and you will find that it is much easier to understand because of what you have learned in this book If you are an aspiring Redhat... and software updates and quality assurance measures to maintain the stability of the distribution The packages they build for CentOS are placed on their distributed mirror network to allow users to download and install software on their system manually if needed Because of the core developers and its community, CentOS is able to have a constant release upgrade schedule to allow users to use new software... need blank CDs or a DVD and a CD/DVD burner and software The instructions for burning a CD/DVD of CentOS are available at http://www .centos. org/docs/5/html/CD_burning_howto.html This link provides instructions on burning your CentOS images once you have downloaded them in both Windows and Linux Preinstallation Steps At this point, you will be installing CentOS as a server on one computer and as a workstation... separate instances of CentOS systems within your current CentOS system Chapter 19 will teach you about the basics of Linux troubleshooting to prepare you for situations when your system cannot boot as expected You will learn how to use the rescue environment to enter your system to know why it cannot load, and fix it You will know how to find the correct partitions and directories of your unbootable . page count CYAN MAGENTA YELLOW BLACK Foundations of CentOS Linux ThE ExpErT’s VOiCE ® iN LiNux Foundations of CentOS Linux Enterprise Linux On the Cheap Ryan Baclit, Chivas Sicam,. Administration The Definitive Guide to CentOS Pro Ubuntu Server Beginning the Linux Command Line Beginning Ubuntu Linux, 4th edition Beginning SUSE Linux Foundations of CentOS Linux Beginning Ubuntu LTS. last page for details on $10 eBook version Foundations of CentOS Linux: Enterprise Linux On the Cheap Dear Reader, I’ve been using Linux for years for software development, for personal enter- tainment,