30
OpenSUSE ® 11.0 and SUSE ® Linux ® Enterprise Server Bible Roger Whittaker Justin Davies Wiley Publishing, Inc.

OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

  • Upload
    others

  • View
    26

  • Download
    0

Embed Size (px)

Citation preview

Page 1: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ffirs.tex V2 - 06/18/2008 3:59pm Page iii

OpenSUSE®

11.0and SUSE

®

Linux® EnterpriseServer Bible

Roger WhittakerJustin Davies

Wiley Publishing, Inc.

Page 2: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ffirs.tex V2 - 06/18/2008 3:59pm Page ii

Page 3: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ffirs.tex V2 - 06/18/2008 3:59pm Page i

OpenSUSE®

11.0and SUSE

®

Linux® EnterpriseServer Bible

Page 4: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ffirs.tex V2 - 06/18/2008 3:59pm Page ii

Page 5: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ffirs.tex V2 - 06/18/2008 3:59pm Page iii

OpenSUSE®

11.0and SUSE

®

Linux® EnterpriseServer Bible

Roger WhittakerJustin Davies

Wiley Publishing, Inc.

Page 6: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ffirs.tex V2 - 06/18/2008 3:59pm Page iv

OpenSUSE® 11.0 and SUSE® Linux® Enterprise Server Bible

Published byWiley Publishing, Inc.10475 Crosspoint BoulevardIndianapolis, IN 46256www.wiley.com

Copyright © 2008 by Wiley Publishing, Inc., Indianapolis, Indiana

Published simultaneously in Canada

ISBN: 978-0-470-27587-0

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form orby any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permittedunder Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written per-mission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copy-right Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600.Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing,Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online athttp://www.wiley.com/go/permissions.

Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations orwarranties with respect to the accuracy or completeness of the contents of this work and specifically dis-claim all warranties, including without limitation warranties of fitness for a particular purpose. No war-ranty may be created or extended by sales or promotional materials. The advice and strategies containedherein may not be suitable for every situation. This work is sold with the understanding that the publisheris not engaged in rendering legal, accounting, or other professional services. If professional assistance isrequired, the services of a competent professional person should be sought. Neither the publisher nor theauthor shall be liable for damages arising herefrom. The fact that an organization or Website is referred toin this work as a citation and/or a potential source of further information does not mean that the authoror the publisher endorses the information the organization or Website may provide or recommendations itmay make. Further, readers should be aware that Internet Websites listed in this work may have changedor disappeared between when this work was written and when it is read.

For general information on our other products and services or to obtain technical support, please contactour Customer Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 orfax (317) 572-4002.

Library of Congress Cataloging-in-Publication Data:

Whittaker, Roger, 1955-OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies.

p. cm.Includes indexISBN 978-0-470-27587-0 (paper/dvd)

1. Linux. 2. Operating systems (Computers) I. Davies, Justin, 1979- II. Title.QA76.76.O63W488 2008005.4’32 — dc22

2008014649

Trademarks: Wiley, the Wiley logo, and related trade dress are trademarks or registered trademarks ofJohn Wiley & Sons, Inc., in the United States and other countries, and may not be used without writtenpermission. OpenSUSE and SUSE are registered trademarks of Novell, Inc. Linux is a registered trademarkof Linus Torvalds. All other trademarks are the property of their respective owners. Wiley Publishing, Inc.,is not associated with any product or vendor mentioned in this book.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print maynot be available in electronic books.

Page 7: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ffirs.tex V2 - 06/18/2008 3:59pm Page v

To Shekufeh and Golnaz, who tolerate all this — Roger WhittakerTo my wife, Aimee — Justin Davies

Page 8: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ffirs.tex V2 - 06/18/2008 3:59pm Page vi

Page 9: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker fauth.tex V2 - 06/18/2008 5:34pm Page vii

About the AuthorsAfter working as a teacher of Mathematics and as Deputy Head of an independent school inLondon, Roger Whittaker discovered Linux in 1996 and became increasingly interested (somewould say obsessed). When SUSE Linux opened its UK office in 1999, he changed careers andworked as a technical and training consultant until early in 2004. He now works for Novellsupporting Linux installations for large customers. He is Newsletter Editor for UKUUG, the UK’sUnix and Open Systems user group.

Justin Davies has been a Linux user since the age of 15. After University, he joined SUSE Linuxas a Technical Consultant where he specialized in Linux on non-Intel architecture. He thenspent time working with value-added resellers in Europe to define their open source strategyand go-to-market plans around Linux. He is now the founder and CTO of Ninetyten, a socialnetworking consultancy based in London, where he is still providing solutions based on opensource software.

Page 10: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker fauth.tex V2 - 06/18/2008 5:34pm Page viii

Page 11: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker fcre.tex V2 - 06/18/2008 5:35pm Page ix

CreditsAcquisitions EditorJenny Watson

Development EditorGus A. Miklos

Senior Development EditorKevin Kent

Technical EditorWarren E. Wyrostek

Production EditorDaniel Scribner

Copy EditorNancy Rapoport

Editorial ManagerMary Beth Wakefield

Production ManagerTim Tate

Vice President and Executive GroupPublisherRichard Swadley

Vice President and Executive PublisherJoseph B. Wikert

Project Coordinator, CoverLynsey Stanford

ProofreaderJosh Chase, Word One

IndexerRon Strauss

Page 12: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker fcre.tex V2 - 06/18/2008 5:35pm Page x

Page 13: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker cag.tex V2 - 06/18/2008 7:12pm Page xi

Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxixPreface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiii

Part I: SUSE Linux BasicsChapter 1: Installing SUSE ................................................................................................................3Chapter 2: Linux Fundamentals .....................................................................................................47Chapter 3: Partitions, Filesystems, and Files ..................................................................................77

Part II: The SUSE SystemChapter 4: Booting the System .....................................................................................................109Chapter 5: Documentation ............................................................................................................139Chapter 6: Understanding Your Linux Network ..........................................................................159Chapter 7: Logging ........................................................................................................................175Chapter 8: The X Window System ...............................................................................................193Chapter 9: Configuring the System with YaST ............................................................................225

Part III: Using the Command Line in SUSE LinuxChapter 10: Text Manipulation .....................................................................................................269Chapter 11: Text Editors ...............................................................................................................297Chapter 12: Working with Packages ............................................................................................319Chapter 13: Working with Files ...................................................................................................347Chapter 14: Working with the System .........................................................................................379Chapter 15: Linux Networking .....................................................................................................411

Part IV: Implementing Network Services in SUSE LinuxChapter 16: Setting Up a Web Site with the Apache Web Server ..............................................447Chapter 17: Mail Servers — Postfix, Sendmail, Qpopper, and Cyrus ........................................469Chapter 18: Setting Up Windows Interoperability with Samba ..................................................503Chapter 19: Setting Up Printing with CUPS ................................................................................521Chapter 20: Configuring and Using DHCP Services ....................................................................541Chapter 21: Configuring a DNS Server ........................................................................................559Chapter 22: Working with NFS ...................................................................................................577Chapter 23: Running an FTP Server on SUSE .............................................................................589Chapter 24: Implementing Firewalls in SUSE Linux ...................................................................601Chapter 25: Network Information and Directory Services ..........................................................621Chapter 26: Setting Up a Web Proxy with Squid ........................................................................647

xi

Page 14: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker cag.tex V2 - 06/18/2008 7:12pm Page xii

Contents at a Glance

Part V: SUSE Linux in the EnterpriseChapter 27: Enterprise Architecture .............................................................................................659Chapter 28: Emulation and Virtualization ...................................................................................685Chapter 29: The Kernel ................................................................................................................ 713Chapter 30: Business Desktop Linux: SLED ................................................................................729

Appendix A: What’s on the DVD .................................................................................................737

Index ..............................................................................................................................................739

xii

Page 15: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xiii

Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxixPreface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiii

Part I: SUSE Linux Basics

Chapter 1: Installing SUSE . . . . . . . . . . . . . . . . . . . . . . . . . 3Selecting Your Installation Method ...................................................................................4Starting Your Installation ...................................................................................................5

Selecting Boot Options ..................................................................................................6Configuring Language Settings .....................................................................................8

Installation Mode ...............................................................................................................11Customizing the Installation ............................................................................................12

Selecting Your Desktop Environment .........................................................................13Partitioning Your Disks ...............................................................................................14Resizing Existing Operating System Partitions ...........................................................16Primary and Extended Partitions ................................................................................17Defining Filesystems ....................................................................................................18Creating a User ............................................................................................................23Installation Settings .....................................................................................................24Customizing Your Installation ....................................................................................24Selecting Software for Installation ...............................................................................25Selecting a Boot Loader ...............................................................................................28Changing the Default Runlevel ...................................................................................31

Running the Installation ...................................................................................................32Configuring Your Network Access .............................................................................33Testing Your Connection and Online Updates ..........................................................38Configuring Your Modem ...........................................................................................39ISDN and ADSL Connections .....................................................................................40Cable Modem Connections .........................................................................................41Wireless Networking ...................................................................................................41User Management ........................................................................................................41SuSEconfig ...................................................................................................................42Reviewing the Release Notes .......................................................................................42Configuring Your Hardware ........................................................................................43

Completing Installation .....................................................................................................45

xiii

Page 16: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xiv

Contents

Chapter 2: Linux Fundamentals . . . . . . . . . . . . . . . . . . . . . . 47Command Line 101: The Shell .........................................................................................48

Commonly Used Shell Features ..................................................................................49Advanced Shell Features .............................................................................................49

Getting Help for Linux Commands .................................................................................55Working with Files and Directories ................................................................................56

Listing Files ................................................................................................................. 56Copying Files ...............................................................................................................57Moving and Renaming Files .......................................................................................57Deleting Files and Directories .....................................................................................58Changing Directories ...................................................................................................58Making Directories ......................................................................................................58Removing Directories ..................................................................................................59Making Links to Files or Directories ..........................................................................59Concatenating Files .....................................................................................................59Viewing Files with more and less ...............................................................................60Viewing the Start or End of Files ...............................................................................60Searching Files with grep ............................................................................................60Finding Files with find and locate ..............................................................................61Editing Text with vi and emacs ..................................................................................61

Common Administrative Tasks ........................................................................................62Basic User and Group Concepts .................................................................................62Creating Users and Groups .........................................................................................63Working with File Ownership and Permissions ........................................................64Configuring User Preferences ......................................................................................67Mounting and Unmounting Filesystems ....................................................................68

Working with Software Packages ....................................................................................69Checking What’s Installed ..........................................................................................70Examining RPM Packages ...........................................................................................70Extracting Files from Packages ...................................................................................71Working with Source RPMs ........................................................................................72

Compiling Source Packages ..............................................................................................72Connecting Over the Network ..........................................................................................73Backing Up, Restoring, and Archiving Files ..................................................................74

Creating and Reading Simple Archives ...................................................................... 75Creating an ISO Image to Burn to CD .......................................................................76

Chapter 3: Partitions, Filesystems, and Files . . . . . . . . . . . . . . . . 77Partitions .............................................................................................................................77

Types of Partitions .......................................................................................................78Creating Partitions .......................................................................................................80Updating a Disk’s Partition Table ...............................................................................85Changing Partition Types ............................................................................................85Logical Volume Management ......................................................................................86

xiv

Page 17: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xv

Contents

Filesystems .......................................................................................................................... 87EXT2 ............................................................................................................................89EXT3 ............................................................................................................................89ReiserFS .......................................................................................................................89JFS ................................................................................................................................90XFS ..............................................................................................................................91VFAT/NTFS .................................................................................................................91

Creating Filesystems ..........................................................................................................92Creating an EXT2 Filesystem ......................................................................................93Creating an EXT3 Filesystem ......................................................................................94Upgrading an EXT2 Filesystem to an EXT3 Filesystem ............................................95Creating a ReiserFS Filesystem ...................................................................................96

Filesystem Comparisons ................................................................................................... 97Mounting Filesystems ........................................................................................................98

Mount Options ............................................................................................................99Mounting Filesystems Automatically ........................................................................104

Unmounting Filesystems .................................................................................................105

Part II: The SUSE System

Chapter 4: Booting the System . . . . . . . . . . . . . . . . . . . . . . 109Booting Concepts .............................................................................................................109

Runlevels ....................................................................................................................114Switching Runlevels Manually ..................................................................................115Using chkconfig to Control Runlevels ......................................................................118Customizing Runlevels for Different Types of Systems ...........................................119

Boot Managers ..................................................................................................................120LILO ...........................................................................................................................120GRUB .........................................................................................................................122Getting Out of Trouble with GRUB .........................................................................126

Dual Booting .....................................................................................................................128Installing Windows and Linux on a New System ....................................................128Installing Linux on an Existing Windows System ...................................................129Manually Partitioning an Existing Windows System ...............................................130Sharing Data on Windows and Linux Partitions .....................................................132

Troubleshooting Booting .................................................................................................133Fixing Boot Problems Using Runlevels .....................................................................133The SUSE Rescue System ..........................................................................................135

Chapter 5: Documentation . . . . . . . . . . . . . . . . . . . . . . . . 139Finding Help on Your SUSE System .............................................................................139

The SUSE Manuals ....................................................................................................140Man Pages ..................................................................................................................141Info Pages ..................................................................................................................144

xv

Page 18: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xvi

Contents

The KDE Help Center ...............................................................................................146/usr/share/doc/packages/ ............................................................................................146Other Documentation Packages ................................................................................147

Linux Documentation Project Resources .....................................................................148FAQs ..........................................................................................................................148HOWTOs ...................................................................................................................149Linux Documentation Project Guides ......................................................................149The SUSE Books Package ..........................................................................................150

Finding Help Online ........................................................................................................151The openSUSE Web Site ...........................................................................................151The Novell Customer Center ....................................................................................152openSUSE Public Mailing Lists .................................................................................153The Unofficial SUSE FAQ .........................................................................................153Other Unofficial SUSE Help Sites .............................................................................153Other SUSE Documents ............................................................................................154Topic-Specific Sites ...................................................................................................154Finding Software .......................................................................................................156IBM ............................................................................................................................156Other Distributions ...................................................................................................157News Sites .................................................................................................................157IRC .............................................................................................................................157Local User Groups .....................................................................................................157

Finding Further Information ..........................................................................................157

Chapter 6: Understanding Your Linux Network . . . . . . . . . . . . . . 159Internet 101 ...................................................................................................................... 160TCP/IP ................................................................................................................................161

The ISO OSI Model ..................................................................................................161The DoD Model .........................................................................................................165IP Addresses ..............................................................................................................165

Routing ...............................................................................................................................172

Chapter 7: Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175The Files in /var/log .........................................................................................................176Logging with syslog ..........................................................................................................177Logging with syslog-ng ....................................................................................................181

The Log Source .........................................................................................................182The Filter ...................................................................................................................182The Log Destination ..................................................................................................183The Log Definition — Tying It All Together ...........................................................183

Managing Your Logs with logrotate ..............................................................................184Analyzing Your Logs with logcheck ..............................................................................186Using Webalizer ............................................................................................................... 188Reading Log Files .............................................................................................................190

xvi

Page 19: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xvii

Contents

Chapter 8: The X Window System . . . . . . . . . . . . . . . . . . . . 193X Window System Concepts ..........................................................................................194

Window Managers ....................................................................................................194KDE and GNOME .....................................................................................................195

Configuring X ....................................................................................................................196Getting Hardware Information ..................................................................................196Using sax2 .................................................................................................................197Framebuffer Graphics ................................................................................................198Accessing Framebuffer Graphics After Installation ..................................................200If X Still Doesn’t Start ...............................................................................................201Switching Resolutions ...............................................................................................201Switching to a Text Console .....................................................................................201Copy and Paste in X .................................................................................................201User Preferences in X ................................................................................................202Using X Remotely ......................................................................................................202Diskless X Terminals .................................................................................................207

KDE .....................................................................................................................................208Konqueror ..................................................................................................................209The KDE Control Center ..........................................................................................211KDE Applications ......................................................................................................212

GNOME ..............................................................................................................................213Nautilus .....................................................................................................................215Firefox ........................................................................................................................215Evolution ...................................................................................................................215Gnucash .....................................................................................................................215AbiWord ....................................................................................................................216Gnumeric ...................................................................................................................216

Other Window Managers ................................................................................................216FVWM2 .....................................................................................................................217Blackbox ....................................................................................................................217IceWM .......................................................................................................................218XFCE ..........................................................................................................................218Window Maker ..........................................................................................................218

Xgl and Compiz ................................................................................................................219Setting Up Desktop Effects .......................................................................................222

Chapter 9: Configuring the System with YaST . . . . . . . . . . . . . . 225YaST Modules ...................................................................................................................228Configuring Installation Sources ...................................................................................234Setting Up Proxy Settings ...............................................................................................237Using NTP Time Services ................................................................................................237Printer Configuration ......................................................................................................239Setting Up a Scanner .......................................................................................................242

xvii

Page 20: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xviii

Contents

Boot Loader Configuration .............................................................................................243Setting Up SCPM ..............................................................................................................245Runlevel Editor .................................................................................................................247Users and Groups ............................................................................................................248

Adding or Editing Users ...........................................................................................249Adding or Editing Groups ........................................................................................252

Installing Additional Software with YaST ...................................................................253YOU — The YaST Online Update .................................................................................255

YOU on SUSE Professional and on SLES .................................................................255opensuse-updater ......................................................................................................256The YaST Online Update Module .............................................................................257YOU Dangers .............................................................................................................258

The YaST Installation Server Module ...........................................................................258Setting Up an Installation Server ..............................................................................258Installing from the Installation Server ......................................................................260

Autoinstallation — AutoYaST ........................................................................................261Principles ...................................................................................................................262Mode of Operation ....................................................................................................262The YaST Autoinstallation Module ...........................................................................263Using Pre-Install, chroot, and Post-Install Scripts ................................................... 265Further Information ..................................................................................................266

Part III: Using the Command Line in SUSE Linux

Chapter 10: Text Manipulation . . . . . . . . . . . . . . . . . . . . . . 269Reading Lines from Files ................................................................................................270

cat ..............................................................................................................................270tac ..............................................................................................................................272zcat .............................................................................................................................272head ...........................................................................................................................272tail ..............................................................................................................................272expand .......................................................................................................................273nl ................................................................................................................................273uniq ............................................................................................................................274sort .............................................................................................................................274

Extracting Lines from Files ............................................................................................275grep ............................................................................................................................275zgrep ..........................................................................................................................278grepmail .....................................................................................................................278sgrep .......................................................................................................................... 279split ............................................................................................................................280csplit ..........................................................................................................................280

Working with Fields from Text Files ............................................................................281cut ..............................................................................................................................282paste ...........................................................................................................................282

xviii

Page 21: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xix

Contents

join .............................................................................................................................283awk ............................................................................................................................ 283wc ..............................................................................................................................285

Replacing Text ..................................................................................................................285sed ..............................................................................................................................286tr ................................................................................................................................287dos2unix and unix2dos ............................................................................................288

Formatting Text Files for Viewing and Printing .........................................................289pr ...............................................................................................................................289fold .............................................................................................................................289fmt .............................................................................................................................290groff-Tascii .................................................................................................................290a2ps ............................................................................................................................290enscript ......................................................................................................................291

Comparing Files ...............................................................................................................291cmp ............................................................................................................................291diff and patch ............................................................................................................292

Getting Text Out of Other File Formats ......................................................................293antiword .................................................................................................................... 294ps2ascii ......................................................................................................................294pdftotext ....................................................................................................................294ps2pdf ........................................................................................................................295dvi2tty ........................................................................................................................295detex .......................................................................................................................... 295acroread and xpdf .....................................................................................................296html2text ...................................................................................................................296strings ........................................................................................................................ 296

Chapter 11: Text Editors . . . . . . . . . . . . . . . . . . . . . . . . . 297

The Politics ........................................................................................................................298vi/vim ..................................................................................................................................298

Using Command Mode .............................................................................................300Moving Around the Text ..........................................................................................300Deleting Text .............................................................................................................302Copying and Pasting .................................................................................................304Inserting and Saving Files .........................................................................................305Searching and Replacing ...........................................................................................305Using the vim Initialization File ...............................................................................306Exiting vim ................................................................................................................307

emacs ..................................................................................................................................307What to Install .......................................................................................................... 308Starting emacs ...........................................................................................................308Controlling emacs .....................................................................................................310

xix

Page 22: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xx

Contents

Using Word Completion ...........................................................................................311Using Command Completion and History ...............................................................312emacs Modes .............................................................................................................312Using the Calendar ....................................................................................................314Customizing emacs ...................................................................................................315More Information ......................................................................................................318

Chapter 12: Working with Packages . . . . . . . . . . . . . . . . . . . 319Binary RPMs .....................................................................................................................320

Installing an RPM ......................................................................................................320Querying RPM Packages ...........................................................................................322Removing Installed Packages ....................................................................................324Verifying an RPM ......................................................................................................325

Creating an RPM ..............................................................................................................327Distribution RPMs .....................................................................................................327Source Code ..............................................................................................................327The RPM Environment ..............................................................................................328The Spec File .............................................................................................................329Compiling an RPM from the Spec File ....................................................................334Checking the Finished RPM .....................................................................................336

Installation Sources .........................................................................................................337YaST’s Installation Sources Module ..........................................................................3381-Click Installation ....................................................................................................340

Command-Line Installation Tools ................................................................................343

Chapter 13: Working with Files . . . . . . . . . . . . . . . . . . . . . . 347Listing, Copying, and Moving Files ...............................................................................347

The Command-Line Tools ........................................................................................347File Managers ............................................................................................................352

Finding Files ..................................................................................................................... 354Using find ..................................................................................................................354Using locate ...............................................................................................................354Using Konqueror to Find Files .................................................................................355Finding Files in GNOME ..........................................................................................356Finding Files in mc ...................................................................................................356Finding Files by Content: Beagle ..............................................................................357

Looking at Files and File Types ....................................................................................358The file Command ....................................................................................................358strings, ghex, khexedit, and antiword ......................................................................359Viewing and Opening Different File Types and Formats ........................................360

Compressing Files ............................................................................................................367Working with Archives ....................................................................................................369

Working with tar Archives .......................................................................................369Working with cpio Archives .....................................................................................371Working with zip Archives .......................................................................................372Unpacking RPM Packages .........................................................................................372

xx

Page 23: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xxi

Contents

Using pax ...................................................................................................................372Using ark ...................................................................................................................373

Files Attributes and ACLs ...............................................................................................374File Attributes ............................................................................................................374File ACLs ...................................................................................................................376

Chapter 14: Working with the System . . . . . . . . . . . . . . . . . . 379System Rescue and Repair ..............................................................................................379

Booting from the Hard Disk with Special Boot Parameters .....................................380Booting into the Rescue System ................................................................................380Booting into YaST System Repair Mode ...................................................................381

Working with Partitions .................................................................................................385Partitioning Examples ...............................................................................................386Making a Filesystem ..................................................................................................391

Working with DVDs, CDs, and Floppies .....................................................................392Creating and Using Images of Existing Disks ..........................................................392Creating and Using New Disk Images ......................................................................393Creating ISO CD and DVD Images ..........................................................................394Burning CDs from the Command Line ....................................................................395Burning CDs and DVDs Using k3b ..........................................................................395

Automating Tasks ............................................................................................................396Shell Aliases ...............................................................................................................397Writing Shell Scripts .................................................................................................397Scripting Languages ...................................................................................................405

Chapter 15: Linux Networking . . . . . . . . . . . . . . . . . . . . . . 411Configuring an IP Network ............................................................................................412

ifconfig .......................................................................................................................412Setting Up Your Routes .............................................................................................416Using iproute2 ...........................................................................................................419

The Wonderful World of ARP ........................................................................................422Taking Part in an IPX Network .....................................................................................423Network Tools ..................................................................................................................424

Using Telnet ..............................................................................................................425Using SSH ..................................................................................................................427rsync .......................................................................................................................... 431wget ........................................................................................................................... 432Tracing Packets on the Network ..............................................................................433

Network Troubleshooting ...............................................................................................435ping ............................................................................................................................435traceroute ...................................................................................................................436

Wireless Networking ....................................................................................................... 436ndiswrapper ...............................................................................................................437Configuring Your Wireless Network ........................................................................439

Bluetooth ...........................................................................................................................441

xxi

Page 24: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xxii

Contents

Part IV: Implementing Network Services in SUSE Linux

Chapter 16: Setting Up a Web Site with the Apache Web Server . . . . . 447Configuring Apache .........................................................................................................448

Apache Packages in SUSE .........................................................................................448Starting Apache for the First Time ...........................................................................448The Apache Configuration Files ...............................................................................450Global Directives .......................................................................................................451Main Server ...............................................................................................................453Virtual Hosts ..............................................................................................................454

Security ..............................................................................................................................456Setting Up User Access .............................................................................................457Setting Up Group Access ..........................................................................................458

The Common Gateway Interface ...................................................................................459Creating Dynamic Content with PHP ...........................................................................462Configuration Using YaST ..............................................................................................464

Chapter 17: Mail Servers — Postfix, Sendmail, Qpopper, and Cyrus . . . 469How Mail Is Sent and Received .....................................................................................470

Testing an MTA from the Command Line ...............................................................470Postfix ................................................................................................................................472

Postfix Configuration ................................................................................................473Postfix Terminology and Use ....................................................................................481Stopping Spam ..........................................................................................................486

sendmail .............................................................................................................................487Installing sendmail ....................................................................................................487Configuring sendmail ................................................................................................488Starting sendmail .......................................................................................................492Getting More Information About sendmail ..............................................................493

Qpopper .............................................................................................................................493Fetchmail ...........................................................................................................................495Cyrus IMAPD ....................................................................................................................496

Configuring the Cyrus User ......................................................................................497Adding Users to Cyrus ..............................................................................................497Creating a Shared Mailbox ........................................................................................498Integrating Cyrus and Postfix ...................................................................................499Setting an Alias for Root’s Mail in Cyrus .................................................................500

Choosing a Mail Client ....................................................................................................500The Command-Line Clients ......................................................................................500The Graphical Mail Clients .......................................................................................501

Mail Systems on Linux ....................................................................................................502

Chapter 18: Setting Up Windows Interoperability with Samba . . . . . . 503The Samba Packages .......................................................................................................504Setting Up and Using a Samba Client ..........................................................................505

Using a Windows Printer from Linux ......................................................................508

xxii

Page 25: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xxiii

Contents

Setting Up a Samba Server Using YaST .......................................................................511Creating and Managing the Samba Password File .....................................................515Working with the Winbind Daemon ............................................................................516The Samba Configuration File .......................................................................................517Using SWAT ......................................................................................................................519

Chapter 19: Setting Up Printing with CUPS . . . . . . . . . . . . . . . . 521Setting Up a Locally Connected Printer .......................................................................523

Printers Not Listed by YaST ......................................................................................526Unsupported Printers ................................................................................................526Printing from Applications ........................................................................................526Printing from the Command Line ............................................................................527Canceling a Print Job from the Command Line ......................................................528Setting Up a Simple Print Server on the Local Network .........................................529Setting Up a Windows Client to Print to the CUPS Server .....................................531Printing from Linux to Other Types of Remote Printers .........................................532Using the CUPS Web Interface .................................................................................533The CUPS Command-Line Tools and Configuration Files ......................................536The CUPS Logs .........................................................................................................538Other Tools ...............................................................................................................539

Documentation .................................................................................................................539CUPS Online Documentation ...................................................................................539The CUPS Book .........................................................................................................539SUSE Printing Documentation ..................................................................................539IPP Documentation ...................................................................................................540

Chapter 20: Configuring and Using DHCP Services . . . . . . . . . . . . 541DHCP: Mode of Operation .............................................................................................541DHCP Packages on SUSE ...............................................................................................542Setting Up a DHCP Server Using YaST ........................................................................542

Using the YaST DHCP Server Wizard ......................................................................543Reconfiguring an Existing DHCP Server in YaST ....................................................546

Manually Configuring a DHCP Server ..........................................................................549IP Address Ranges .....................................................................................................549Assigning a Default Gateway .....................................................................................549Configuring Name Services .......................................................................................550Configuring Fixed Addresses ....................................................................................550Other Options ...........................................................................................................550Defining Host Groups ...............................................................................................551Specifying Leases .......................................................................................................551Other DHCP Options ................................................................................................552

Starting and Stopping DHCP Clients ...........................................................................552Troubleshooting DHCP Clients and Servers ...............................................................553

Troubleshooting DHCP Clients ................................................................................553Troubleshooting DHCP Servers ................................................................................555

xxiii

Page 26: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xxiv

Contents

Chapter 21: Configuring a DNS Server . . . . . . . . . . . . . . . . . . 559Some DNS Theory ............................................................................................................559

Top-Level Domains ...................................................................................................560How Does a DNS Search Work? ..............................................................................560Caching ......................................................................................................................561

Configuring BIND for Caching and Forwarding .........................................................561Using dig ...................................................................................................................562Using host ..................................................................................................................563

Examining Record Types ................................................................................................564Working with Zones ........................................................................................................565

The Start of Authority ...............................................................................................565The NS Entry .............................................................................................................567The Mail Exchanger ..................................................................................................567The Address Record ..................................................................................................567The CNAME Record ..................................................................................................567Adding the Zone to named.conf ...............................................................................568

The Reverse Zone ............................................................................................................. 569Configuring a DNS Server with YaST ...........................................................................570

Chapter 22: Working with NFS . . . . . . . . . . . . . . . . . . . . . . 577Mounting NFS Filesystems .............................................................................................577

Mounting NFS Filesystems at Boot Time .................................................................578Using mount Options ...............................................................................................579rcnfs start and rcnfs stop ..........................................................................................580YaST’s NFS Client Module ........................................................................................580

The NFS Server .................................................................................................................581The exports File ........................................................................................................582The exportfs Command ............................................................................................584The showmount Command ......................................................................................585Problems with Mounting NFS Shares ......................................................................586NFS Security Considerations ....................................................................................587

Chapter 23: Running an FTP Server on SUSE . . . . . . . . . . . . . . . 589vsftpd as an Anonymous FTP Server ............................................................................590Setting Up User FTP with vsftpd ..................................................................................595Allowing Uploads .............................................................................................................596Using pure-ftpd .................................................................................................................598Further Information .........................................................................................................599

Chapter 24: Implementing Firewalls in SUSE Linux . . . . . . . . . . . . 601Why Use a Firewall? ........................................................................................................602Configuring a Firewall with iptables ............................................................................603

Implementing an iptables Firewall ...........................................................................605Setting Your First Rules ............................................................................................607Adding a Rule ............................................................................................................608The Order of Rules ...................................................................................................609

xxiv

Page 27: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xxv

Contents

Network Address Translation ........................................................................................609Source NAT ...............................................................................................................609Allowing the Packets to be Forwarded .....................................................................611Destination NAT ........................................................................................................612

Redirecting Traffic ...........................................................................................................613Allowing ICMP Traffic .....................................................................................................614Allowing Loopback ..........................................................................................................614Stopping ‘‘Too Frequent’’ Connections .........................................................................615Logging Dropped Packets ...............................................................................................615Using SuSEfirewall2 ........................................................................................................616

Chapter 25: Network Information and Directory Services . . . . . . . . 621Using NIS for Authentication .........................................................................................622

Setting Up a NIS Server Using YaST ........................................................................622Setting Up a NIS Server Manually ............................................................................624Configuring Clients for NIS ......................................................................................627

Working with LDAP in SUSE .........................................................................................629What Is LDAP? .................................................................................................................630

LDAP Objects ............................................................................................................631The Hierarchy ............................................................................................................632

Implementing the LDAP Server .....................................................................................633Configuring the Administrator ..................................................................................633Testing the LDAP Server ...........................................................................................634Adding Information ...................................................................................................635Adding User Data to the LDAP Server .....................................................................638

Pluggable Authentication Modules ................................................................................642Integrating LDAP into Linux ..........................................................................................644Setting the ACL on the LDAP Server ............................................................................645How Can LDAP Help You? .............................................................................................646

Chapter 26: Setting Up a Web Proxy with Squid . . . . . . . . . . . . . 647Getting Started with Squid on SUSE ............................................................................648User Authentication .........................................................................................................650Restricting Access by Hardware Address .....................................................................652The Squid Log ...................................................................................................................653Using Squid as a Transparent Proxy ............................................................................654Using Cache Manager ......................................................................................................655Using squidGuard ............................................................................................................656

Part V: SUSE Linux in the Enterprise

Chapter 27: Enterprise Architecture . . . . . . . . . . . . . . . . . . . 659A Typical Organization ...................................................................................................660

Where Can Linux Be Used? ......................................................................................661I Know Where, but How? .........................................................................................662Fulfilling Your Staff Requirements ............................................................................663

xxv

Page 28: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xxvi

Contents

Linux Enterprise Hardware: The Big Players ..............................................................663IBM ............................................................................................................................664Hewlett-Packard ........................................................................................................66564-bit Platforms .........................................................................................................665Blade Technology ......................................................................................................667Hardware and Software Certification and Support ..................................................668

Putting It All Together ....................................................................................................668Where Do I Put the Services? ...................................................................................668Storage Area Networks ..............................................................................................672Virtualize Everything! ................................................................................................677Disaster Recovery ......................................................................................................678High Availability and Failover ..................................................................................682

Chapter 28: Emulation and Virtualization . . . . . . . . . . . . . . . . 685Emulation Versus Virtualization ...................................................................................685DOS Emulation Using dosemu and dosbox ................................................................686

dosemu ......................................................................................................................687dosbox .......................................................................................................................687

Running Microsoft Windows Applications with Wine ..............................................688The bochs PC Emulator ..................................................................................................693Virtual Machines Using QEMU ......................................................................................694

Installing and Running QEMU .................................................................................695VMware Virtual Machines ..............................................................................................697

VMware Server ..........................................................................................................698VirtualBox ......................................................................................................................... 700The Xen Hypervisor .........................................................................................................702

Hardware-Assisted Virtualization ..............................................................................705Configuration Files and Command-Line Tools ........................................................708

Other Emulators ...............................................................................................................711

Chapter 29: The Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . 713Why You Probably Don’t Need This Chapter .............................................................713Why You Might Need This Chapter ..............................................................................714SUSE Kernels and Vanilla Kernels ................................................................................714

Kernel Version Numbers ...........................................................................................714The Binary Kernel Packages ......................................................................................715What Kernel Am I Running? ....................................................................................716

Upgrading a Kernel Package ..........................................................................................716Kernel Configuration .......................................................................................................717Building the Kernel ..........................................................................................................722Kernel Module Packages and Third-Party Software ..................................................724

Tainting the Kernel ...................................................................................................725Loading Kernel Modules ...........................................................................................726

Kernel Parameters at Boot Time ...................................................................................727The Initial Ramdisk .........................................................................................................728

xxvi

Page 29: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xxvii

Contents

Chapter 30: Business Desktop Linux: SLED . . . . . . . . . . . . . . . . 729The Technical Background .............................................................................................731The Stubborn Applications .............................................................................................731Other Commercial Desktop Distributions ...................................................................732Other Approaches ............................................................................................................733SLD, NLD, and SLED ......................................................................................................734The Future of SLED and the Linux Desktop ...............................................................734For More Information ......................................................................................................735

Appendix A: What’s on the DVD . . . . . . . . . . . . . . . . . . . . . 737

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739

xxvii

Page 30: OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible€¦ · OpenSUSE 11.0 and SUSE Linux enterprise server bible / Roger Whittaker, Justin Davies. p. cm. Includes index ... Running

Whittaker ftoc.tex V2 - 06/18/2008 7:13pm Page xxviii