Baixe Biblia Linux 8th Edition e outras Notas de estudo em PDF para Engenharia Informática, somente na Docsity!
Linux
®
BIBLE
8th Edition
Christopher Negus
with contributions by
Christine Bresnahan
As always, I dedicate this book to my wife, Sheree.
— Chris Negus
I would like to dedicate this book to my family and the Lord God Almighty.
“But as for you, be strong and do not give up, for your work will be
rewarded.” 2 Chronicles 15:
— Christine Bresnahan
Credits
Acquisitions Editor Mary James
Project Editor Linda Harrison
Technical Editor Richard Blum
Production Editor Daniel Scribner
Copy Editor Nancy Rapoport
Editorial Manager Mary Beth Wakefield
Freelancer Editorial Manager Rosemarie Graham
Associate Director of Marketing David Mayhew
Marketing Manager Ashley Zurcher
Business Manager Amy Knies
Production Manager Tim Tate
Vice President and Executive Group Publisher Richard Swadley
Vice President and Executive Publisher Neil Edde
Associate Publisher Jim Minatel
Project Coordinator, Cover Katie Crocker
Proofreaders Josh Chase, Word One Paul Sagan, Word One
Indexer Robert Swanson
Cover Designer Ryan Sneed
Cover Image © Aleksandar Velasevic / iStockPhoto
xi
Acknowledgments
S
ince I was hired by Red Hat, Inc. over three years ago, I have been exposed to the best Linux developers, testers, support professionals, and instructors in the world. I can’t thank everyone individually, so instead I salute the culture of cooperation and excellence that serves to improve my own Linux skills every day. I don’t speak well of Red Hat because I work there; I work there because Red Hat has earned its reputation as the leading force in Linux development.
That said, there are a few people at Red Hat I would like to acknowledge. Discussions with Victor Costea, Andrew Blum, and other Red Hat instructors have helped me adapt my ways of thinking about how people learn Linux. In my new role at Red Hat as a writer for the customer portal, my manager Sam Folk-Williams has allowed me to extend my skills into areas such as virtualization, troubleshooting, and performance tuning.
When we needed help to bring this book in on time, Christine Bresnahan was an excel- lent addition to the team. Christine wrote new material and updated content for the security chapters in this book, bringing her solid Linux teaching and writing skills to this project.
As for the people at Wiley, I particularly thank them for their patience. Mary James and Linda Harrison have gently guided me through a demanding schedule. Thanks to Richard Blum for his thorough technical editing... giving me an Ubuntu slant to this otherwise Red Hat–centric book. Thanks to Margot Maley Hutchison and Maureen Maloney from Waterside Productions for contracting the book for me with Wiley.
Finally, thanks to my wife, Sheree, for sharing her life with me and doing such a great job raising Seth and Caleb.
— Christoper Negus
Many thanks go to the fantastic team of people at John Wiley & Sons for their outstanding work on this project. Thanks to Mary James, the acquisitions editor, for offering me the opportunity to work on this book. Also thanks to Linda Harrison, the development edi- tor, for keeping things on track and making this book more presentable. Thanks Linda for all your hard work and diligence. The technical editor, Rich Blum, did a wonderful job of double-checking all the work in the book, plus making suggestions to improve the content. Thanks to Nancy Rapoport, the copy editor, for her endless patience and diligence to make our work readable.
I would also like to thank Carole McClendon at Waterside Productions, Inc. for arrang- ing this opportunity for me, and for helping me in my writing career. I would also like to thank my husband, Timothy, for his encouragement, patience, and willingness to listen, even when he has no idea what I’m talking about.
— Christine Bresnahan
xv
xvii
xviii
- Part I: Getting Started Introduction xxxiii
- Chapter 1: Starting with Linux
- Chapter 2: Creating the Perfect Linux Desktop
- Part II: Becoming a Linux Power User
- Chapter 3: Using the Shell
- Chapter 4: Moving Around the Filesystem
- Chapter 5: Working with Text Files ............................................................................
- Chapter 6: Managing Running Processes ....................................................................
- Chapter 7: Writing Simple Shell Scripts ......................................................................
- Part III: Becoming a Linux System Administrator
- Chapter 8: Learning System Administration ...............................................................
- Chapter 9: Installing Linux ........................................................................................
- Chapter 10: Getting and Managing Software ...............................................................
- Chapter 11: Managing User Accounts .........................................................................
- Chapter 12: Managing Disks and Filesystems .............................................................
- Part IV: Becoming a Linux Server Administrator
- Chapter 13: Understanding Server Administration ......................................................
- Chapter 14: Administering Networking ......................................................................
- Chapter 15: Starting and Stopping Services .................................................................
- Chapter 16: Configuring a Print Server .......................................................................
- Chapter 17: Configuring a Web Server ........................................................................
- Chapter 18: Configuring an FTP Server ......................................................................
- Chapter 19: Configuring a Windows File Sharing (Samba) Server ................................
- Chapter 20: Configuring an NFS File Server................................................................
- Chapter 21: Troubleshooting Linux .............................................................................
- Part V: Learning Linux Security Techniques
- Chapter 22: Understanding Basic Linux Security ........................................................
- Chapter 23: Understanding Advanced Linux Security..................................................
- Chapter 24: Enhancing Linux Security with SELinux ..................................................
- Chapter 25: Securing Linux on a Network
- Part VI: Appendixes
- Appendix A: Media....................................................................................................
- Appendix B: Exercise Answers ...................................................................................
- Index ........................................................................................................................
- Part I: Getting Started Introduction......................................................... xxxiii
- Chapter 1: Starting with Linux
- Understanding What Linux Is...............................................................................
- Understanding How Linux Differs from Other Operating Systems
- Exploring Linux History
- Free-flowing UNIX culture at Bell Labs
- Commercialized UNIX
- Berkeley Software Distribution arrives.................................................
- UNIX Laboratory and commercialization
- GNU transitions UNIX to freedom
- BSD loses some steam
- Linus builds the missing piece
- OSI open source defi nition
- Understanding How Linux Distributions Emerged...............................................
- Choosing a Red Hat distribution
- Using Red Hat Enterprise Linux.........................................................
- Using Fedora
- Choosing Ubuntu or another Debian distribution
- Finding Professional Opportunities with Linux Today
- Understanding how companies make money with Linux
- Becoming Red Hat Certified
- RHCSA topics....................................................................................
- RHCE topics
- Summary...........................................................................................................
- Chapter 2: Creating the Perfect Linux Desktop.
- Understanding Linux Desktop Technology
- Starting with the Fedora GNOME Desktop Live CD
- Using the GNOME 3 Desktop
- After the computer boots up
- Navigating with the mouse
- Navigating with the keyboard
- Setting up the GNOME 3 desktop
- Extending the GNOME 3 desktop Contents
- Using GNOME shell extensions..........................................................
- Using the GNOME Tweak Tool
- Starting with desktop applications
- Managing fi les and folders with Nautilus
- Installing and managing additional software
- Playing music with Rhythmbox.........................................................
- Stopping the GNOME 3 desktop
- Using the GNOME 2 Desktop
- Using the Metacity window manager
- Changing GNOME appearance
- Using the GNOME panels...........................................................................
- Using the Applications and System menus
- Adding an applet
- Adding another panel
- Adding an application launcher
- Adding a drawer
- Changing panel properties
- 3D effects with AIGLX
- Summary...........................................................................................................
- Exercises
- Part II: Becoming a Linux Power User
- Chapter 3: Using the Shell
- About Shells and Terminal Windows
- Using the shell prompt
- Using a terminal window
- Using virtual consoles
- Choosing Your Shell
- Running Commands
- Understanding command syntax................................................................
- Locating commands
- Recalling Commands Using Command History
- Command-line editing
- Command-line completion
- Command-line recall
- Connecting and Expanding Commands
- Piping between commands
- Sequential commands
- Background commands
- Expanding commands
- Expanding arithmetic expressions
- Expanding variables Contents
- Using Shell Variables..........................................................................................
- Creating and using aliases
- Exiting the shell
- Creating Your Shell Environment
- Configuring your shell
- Setting your prompt...................................................................................
- Adding environment variables
- Getting Information About Commands
- Summary...........................................................................................................
- Exercises
- Chapter 4: Moving Around the Filesystem
- Using Basic Filesystem Commands
- Using Metacharacters and Operators
- Using fi le-matching metacharacters............................................................
- Using fi le-redirection metacharacters
- Using brace expansion characters .............................................................
- Listing Files and Directories ..............................................................................
- Understanding File Permissions and Ownership ................................................
- Changing permissions with chmod (numbers)...........................................
- Changing permissions with chmod (letters) ..............................................
- Setting default fi le permission with umask ................................................
- Changing fi le ownership ...........................................................................
- Moving, Copying, and Removing Files ..............................................................
- Summary..........................................................................................................
- Exercises ..........................................................................................................
- Chapter 5: Working with Text Files
- Editing Files with vim and vi ............................................................................
- Starting with vi ........................................................................................
- Adding text......................................................................................
- Moving around in the text................................................................
- Deleting, copying, and changing text ...............................................
- Pasting (putting) text .......................................................................
- Repeating commands .......................................................................
- Exiting vi ........................................................................................
- Skipping around in the fi le .......................................................................
- Searching for text .....................................................................................
- Using ex mode .........................................................................................
- Learning more about vi and vim ...............................................................
- Finding Files.....................................................................................................
- Using locate to find fi les by name..............................................................
- Searching for fi les with find ......................................................................
- Finding fi les by name ......................................................................
- Finding fi les by size ......................................................................... Contents
- Finding fi les by user ........................................................................
- Finding fi les by permission ..............................................................
- Finding fi les by date and time ..........................................................
- Using not and or when finding fi les ..................................................
- Finding fi les and executing commands.............................................
- Searching in fi les with grep ......................................................................
- Summary..........................................................................................................
- Exercises ..........................................................................................................
- Chapter 6: Managing Running Processes
- Understanding Processes...................................................................................
- Listing Processes ..............................................................................................
- Listing processes with ps ..........................................................................
- Listing and changing processes with top ...................................................
- Listing processes with System Monitor ......................................................
- Managing Background and Foreground Processes ..............................................
- Starting background processes..................................................................
- Using foreground and background commands ...........................................
- Killing and Renicing Processes ..........................................................................
- Killing processes with kill and killall ........................................................
- Using kill to signal processes by PID ................................................
- Using killall to signal processes by name ..........................................
- Setting processor priority with nice and renice ..........................................
- Summary..........................................................................................................
- Exercises ..........................................................................................................
- Chapter 7: Writing Simple Shell Scripts
- Understanding Shell Scripts...............................................................................
- Executing and debugging shell scripts ......................................................
- Understanding shell variables ...................................................................
- Special shell positional parameters ...................................................
- Reading in parameters .....................................................................
- Parameter expansion in bash ...........................................................
- Performing arithmetic in shell scripts .......................................................
- Using programming constructs in shell scripts ..........................................
- The “if then” statements ............................................................
- The case command ..........................................................................
- The “for do” loop .......................................................................
- The “while do” and “until do” loops .....................................
- Trying some useful text manipulation programs........................................
- The general regular expression parser ..............................................
- Remove sections of lines of text (cut)................................................
- Translate or delete characters (tr) .....................................................