01_079886 ffirs.qxp 11/3/06 2:44 PM Page i Professional VMware®Server Eric Hammersley 01_079886 ffirs.qxp 11/3/06 2:44 PM Page i Professional VMware®Server Eric Hammersley 01_079886 ffirs.qxp 11/3/06 2:44 PM Page ii Professional VMware®Server Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2007 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN-13: 978-0-470-07988-1 ISBN-10: 0-470-07988-6 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 1B/SR/RR/QW/IN Library of Congress Cataloging-in-Publication Data: Hammersley, Eric, 1974- Professional VMware server / Eric Hammersley. p. cm. Includes index. ISBN-13: 978-0-470-07988-1 (paper/website) ISBN-10: 0-470-07988-6 (paper/website) 1. VMware. 2. Operating systems (Computers) 3. Virtual computer systems. I. Title. QA76.76.O63H344637 2007 005.4’3--dc22 2006033472 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 ofthe 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright 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, oronline at http://www.wiley.com/go/permissions. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESEN- TATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACYOR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WAR- RANTIES OF FITNESS FOR APARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONALMATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAYNOT BE SUIT- ABLE FOR EVERYSITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF ACOMPETENT PROFESSIONALPERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALLBE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS ACITATION AND/OR A POTENTIALSOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAYPROVIDE OR RECOMMENDATIONS IT MAYMAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. For general information on our other products and services please contact our Customer Care Department within the United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Trademarks:Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trade- marks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. VMware is a registered trademark of VMware, Inc. All other trade- marks 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 may not be available in electronic books. 01_079886 ffirs.qxp 11/3/06 2:44 PM Page iii To Sandy, my wonderful wife, and our two children, Chandler and Renae. Without you this book would never have been possible. Your support and encouragement helped make this book what it is today. I love you all dearly. About the Author Eric Hammersleyhas been a technician, systems engineer, project manager, and developer in the IT industry for more than 15 years. He began his career in networking and support in the early ’90s installing and supporting hundreds of networks during that time. He then moved into the government sector joining the United States Navy where he remained on active duty through the turn of the century. Although he specialized in shipboard weapons and radar systems, his focus did not shy away from the IT field. Taking charge of the shipboard computer systems he later transitioned into the Integrated Shipboard Network System (ISNS) project—a Navy initiative in the late ‘90s to integrate the data sys- tems of units afloat to help improve Command, Control, and Communication across the fleet. It was during the ISNS project, just after VMware first released its Workstation product, that he realized the potential of software virtualization. Having to cram racks of servers into an already overcrowded ship- board environment was a wake-up call. Abetter way had to exist, and VMware was the frontrunner in that technology. From that point forward he became an avid proponent of software virtualization. Throughout the evolution of the VMware product line he has continued his quest to increase the aware- ness and use of software virtualization by the software developer. He is currently the CIO and Lead Software Architect for The SASSI Institute and resides in Bedford, Indiana. You can contact him at [email protected]—a site that focuses on the use of virtualization throughout the software develop- ment cycle. Acknowledgments None of this could have been possible without the wonderful team at Wrox. I would like to thank Chris Webb, who took a chance and gave me a shot at this. I am forever grateful for the opportunity. Aspecial thanks to Kevin Kent. Without your amazing skills this book would be little more than thoughts on a dinner napkin. You are truly a pleasure to work with. To everyone else at Wrox a heartfelt thanks. Each and every one of you involved helped make this book a success. Aspecial thanks to Scott Lowe. Your technical expertise and point of view were important parts of this process. Again, I would like to thank my wonderful family. I would be lost without you. You sacrificed a great deal over the past several months to make this book a reality. Without your love and support this would not have been possible. I would also like to thank my parents, Larry and Sue. You have always been there for me. Without hesi- tation you stepped in and helped over the past several months. I love you both. 01_079886 ffirs.qxp 11/3/06 2:44 PM Page iv Credits Executive Editor Vice President and Executive Publisher Chris Webb Joseph B. Wikert Senior Development Editor Graphics and Production Specialists Kevin Kent Carrie A. Foster Barry Offringa Technical Editor Rashell Smith Scott Lowe Alicia B.South Production Editor Quality Control Technicians Eric Charbonneau John Greenough Christy Pingleton Copy Editor Kim Cofer Project Coordinator Erin Smith Editorial Manager Mary Beth Wakefield Proofreading and Indexing Techbooks Production Manager Tim Tate Anniversary Logo Design Richard Pacifico Vice President and Executive Group Publisher Richard Swadley 02_079886 ftoc.qxp 11/3/06 2:42 PM Page v Contents Acknowledgments iii Introduction xiii Who This Book Is For xiii What This Book Covers xiv How This Book Is Structured xiv What You Need to Use This Book xvi Conventions xvi Source Code xvii Errata xvii p2p.wrox.com xvii Chapter 1: VMware Server: A Brief Introduction 1 What Is Virtualization? 1 Software Virtualization 2 Hosted vs. Hypervisor Architecture 3 Terminology,Host vs. Guest 6 So What Is VMware Server? 6 Rapid Deployment 6 Multiple Platforms Available on a Single Physical Machine 7 The Ability to Move Virtual Machines from One Server to Another 7 Increased Utilization of Your Hardware 8 Life without VMware Server 8 Summary 9 Chapter 2: Installing Your VMware Server 11 Host Hardware Requirements 11 Processor 12 Memory 12 Hard Disk 13 Network Controller 14 Host Operating System Requirements 14 Windows 15 Linux 15 02_079886 ftoc.qxp 11/3/06 2:42 PM Page vi Contents Remote Client Requirements 17 Hardware 17 Operating System 18 Installing VMware Server 18 Installing VMware Server on Windows 19 Installing VMware Server on Linux 24 Install Overview 34 Installing the VMware Server Management Interface on Linux 34 Installing the Remote Client 38 Installing the Remote Client on Windows 38 Installing the Remote Client on Linux 43 Troubleshooting the Install 48 Having to Compile Your Own Kernel Modules 48 Verifying Port 902 Is Free 50 Installing xinetd 50 The Case of the Missing Library: libdb.so.3 51 Launching the Server Console Manually 52 Enabling the MUI and Console Ports in Your Firewall 54 Summary 56 Chapter 3: VMware Configuration Nuts and Bolts 57 Getting to Know the Server Console 57 Host Settings and Console Preferences 62 Host Settings 62 Console Preferences 66 Virtual Machine Settings 72 Virtual Hardware Specifications 73 Virtual Machine Options 75 Virtual Networking 84 Automatic Bridging 86 Host Virtual Network Mapping 87 Host Virtual Adapters 91 DHCP and NAT 92 Virtual Machine Security 92 Options for User Access Levels 92 Configuring User Access Levels 93 Summary 96 Chapter 4: Creating Your First Base Image 97 What Is a Base Image? 97 Creating Your First Virtual Machine 98 vi 02_079886 ftoc.qxp 11/3/06 2:42 PM Page vii Contents Installing a Guest Operating System 109 Troubleshooting Guest Operating System Installation 112 Installing VMware Tools on Windows Guests 113 Installing VMware Tools on Linux Guests 113 Freezing Your Windows Guest with Sysprep 116 Summary 123 Chapter 5: Where Does This Fit into Your Development Environment? 125 Virtual Machines for Software Development 126 Virtual Machines for Software Testing 128 Platform Testing with Snapshots 129 Platform Testing with Persistent and Nonpersistent Disks 130 Virtual Machines for Post-Release Maintenance 131 Creating Base Images for Your Development Environment 131 Planning 132 Collaborating 133 Creating 133 Testing 134 Deploying 135 Summary 136 Chapter 6: Bringing It All Together 137 Organizing Your Image Library 137 Proper Image Naming 137 Archiving Your Images 140 Preparing Base Images for Use 140 Recycling Your Testing Images 143 Creating an ISO Image Library 144 Creating an ISO Image 145 Using an ISO Image 146 Summary 148 Chapter 7: Introduction to the Scripting APIs 151 What Can You Automate? 152 Supported Platforms 153 VmPerl 153 VmCOM 153 Programming API 154 VmPerl vs. VmCOM vs. Vix 154 The vmware-cmd Utility 156 vii