Beginning Ubuntu Server administration from novice to professional
CYAN MAGENTA YELLOW BLACK PANTONE 123 C Books for professionals by professionals ® Beginning Ubuntu Server Administration: From Novice to Professional Author of The Definitive Guide to SUSE Linux Enterprise Server Pro Novell Open Enterprise Server For the past few years, many have hailed Ubuntu Linux as the best chance to finally sway the computing masses toward the Linux desktop And it’s easy to see why: it offers an amazingly user-friendly interface, intuitive installation and configuration process, and an enormous choice of applications Indeed, it’s become so popular that system administrators are rapidly adopting Ubuntu Server Edition to configure, deploy, and manage network services more effectively than ever before Whether you’re interested in using Ubuntu within a Fortune 500 environment or just managing your home network, you hold in your hands the only book you need While writing it, I kept your daily administration tasks constantly in mind, and I’ve included chapters on how to set up and run Ubuntu Server as a file and print server, a virtualization server, and a web server I also show you how to perform many other tasks that you’ll frequently encounter as an Ubuntu Server administrator, such as automating installation, configuration, and deployment processes, and managing the kernel Along the way, this book will help you become a more proficient administrator as you learn to take advantage of little-known shell-related features, tips, and tricks Efficiency is a major theme of this book, and you’ll also learn how to optimize, troubleshoot, and remotely manage your server Reading this book will help you master every aspect of Ubuntu Server, from both the command line and the graphical interface Whether you’re about to manage your first server or are interested in expanding your knowledge of Ubuntu Server, this is the book for you! Sander van Vugt Companion eBook THE APRESS ROADMAP Beginning Ubuntu, Second Edition See last page for details on $10 eBook version Beginning Ubuntu Server Administration Practical MythTV: Building a PVR and Media Center The Definitive Guide to SUSE Linux Enterprise Server The Definitive Guide to Samba 4, Second Edition ISBN-13: 978-1-59059-923-5 ISBN-10: 1-59059-923-3 53999 US $39.99 Beginning van Vugt www.apress.com Beginning SUSE Linux, Second Edition From Bash to Z-Shell: Conquering the Command Line Companion eBook Available Ubuntu Server Administration Dear Reader, The EXPERT’s VOIce ® in Open Source Beginning Ubuntu Server Administration From Novice to Professional Everything you need to know to manage Ubuntu Server Sander van Vugt Shelve in Operating Systems/Linux User level: Beginner–Intermediate 781590 599235 this print for content only—size & color not accurate spine = 0.875" 376 page count 9233fm.qxd 11/13/07 2:51 PM Page i Beginning Ubuntu Server Administration From Novice to Professional Sander van Vugt 9233fm.qxd 11/13/07 2:51 PM Page ii Beginning Ubuntu Server Administration: From Novice to Professional Copyright © 2008 by Sander van Vugt 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 ISBN-13 (pbk): 978-1-59059-923-5 ISBN-10 (pbk): 1-59059-923-3 ISBN-13 (electronic): 978-1-4302-0509-8 ISBN-10 (electronic): 1-4302-0509-1 Printed and bound in the United States of America 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 Lead Editors: Jason Gilmore, Tom Welsh Technical Reviewer: Curtis Smith Editorial Board: Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Jason Gilmore, Kevin Goff, Jonathan Hassell, Matthew Moodie, Joseph Ottinger, Jeffrey Pepper, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Senior Project Manager: Kylie Johnston Copy Editor: Tom Gillen Associate Production Director: Kari Brooks-Copony Senior Production Editor: Laura Cheu Compositor: Molly Sharp, ContentWorks Proofreader: April Eddy Indexer: Brenda Miller Artist: April Milne Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski 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 contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705 Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http://www.apress.com 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 f7670b088a34e6aa65a5685727db1ff4 9233fm.qxd 11/13/07 2:51 PM Page iii This book is dedicated to Alex 9233fm.qxd 11/13/07 2:51 PM Page iv 9233fm.qxd 11/13/07 2:51 PM Page v Contents at a Glance About the Author xv About the Technical Reviewer xvii Introduction xix ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER 10 11 12 Installing Ubuntu Server Getting the Most Out of the Command Line 25 Performing Essential System Administration Tasks 47 Performing File System Management Tasks 73 Configuring Your Server for Security 107 Setting the System to Your Hand 151 Running It Anyway You Like 185 Making Connection 217 Configuring Network Infrastructure Services 255 Using Ubuntu Server As a File and Print Server 287 Setting Up Web Services 313 Multiplying Your Server 329 ■INDEX 343 v 9233fm.qxd 11/13/07 2:51 PM Page vi 9233fm.qxd 11/13/07 2:51 PM Page vii Contents About the Author xv About the Technical Reviewer xvii Introduction xix ■CHAPTER Installing Ubuntu Server Preparing for the Installation Starting the Ubuntu Server Installation Process Configuring the Server’s Hard Drive Completing the Installation 22 Summary 24 ■CHAPTER Getting the Most Out of the Command Line 25 Working As root? 25 Working with the Shell 26 Using Bash to Best Effect 26 Managing Bash with Key Sequences 29 Performing Basic File System Management Tasks 30 Working with Directories 30 Working with Files 31 Viewing the Content of Text Files 33 Finding Files That Contain Specific Text 35 Creating Empty Files 36 Piping and Redirection 37 Piping 37 Redirection 37 Finding Files 40 Working with an Editor 40 Vi Modes 41 Saving and Quitting 42 Cut, Copy, and Paste 42 Deleting Text 42 vii 9233fm.qxd viii 11/13/07 2:51 PM Page viii ■CONTENTS Getting Help 43 Using man to Get Help 43 Using the help Option 45 Getting Information on Installed Packages 46 Summary 46 ■CHAPTER Performing Essential System Administration Tasks 47 Software Management 47 Software Repositories and Package Databases 48 Package Management Utilities 49 Installing Software from Tarballs 57 Configuring a Graphical User Interface 58 Creating Backups 60 Making File Backups with tar 60 Making Device Backups Using dd 63 Configuring Logging 64 Configuring syslog 64 Logging in Other Ways 69 Rotating Log Files 69 Summary 72 ■CHAPTER Performing File System Management Tasks 73 Mounting Disks 73 Using the mount Command 73 Unmounting Devices 77 Automating Mounts with /etc/fstab 78 Checking File System Integrity 81 Working with Links 82 Why Use Links? 82 Working with Symbolic Links 82 Working with Hard Links 84 Configuring Storage 85 Comparing File Systems 85 Creating File Systems 94 Working with Logical Volumes 97 Doing Magic on Your File Systems with dd 102 Summary 105 ... 11/13/07 2:51 PM Page i Beginning Ubuntu Server Administration From Novice to Professional Sander van Vugt 9233fm.qxd 11/13/07 2:51 PM Page ii Beginning Ubuntu Server Administration: From Novice... 255 Using Ubuntu Server As a File and Print Server 287 Setting Up Web Services 313 Multiplying Your Server ... xix ■CHAPTER Installing Ubuntu Server Preparing for the Installation Starting the Ubuntu Server Installation Process