Openvz User's Guide
Total Page:16
File Type:pdf, Size:1020Kb
OpenVZ User’s Guide December 20, 2016 Parallels IP Holdings GmbH Vordergasse 59 8200 Schaffhausen Switzerland Tel: + 41 52 632 0411 Fax: + 41 52 672 2010 http://www.virtuozzo.com Copyright © 1999-2016 Parallels IP Holdings GmbH and its affiliates. All rights reserved. This product is protected by United States and international copyright laws. The product’s underlying technology, patents, and trademarks are listed at http://www.virtuozzo.com/legal/. Microsoft, Windows, Windows Server, Windows NT, Windows Vista, and MS-DOS are registered trademarks of Microsoft Corporation. Apple, Mac, the Mac logo, Mac OS, iPad, iPhone, iPod touch, FaceTime HD camera and iSight are trademarks of Apple Inc., registered in the US and other countries. Linux is a registered trademark of Linus Torvalds. All other marks and names mentioned herein may be trademarks of their respective owners. Table of Contents 1. Learning OpenVZ Basics ..................................................................................................................... 8 1.1. OpenVZ Overview ..................................................................................................................... 8 1.2. OS Virtualization Layer .............................................................................................................. 8 1.2.1. Basics of OS Virtualization ............................................................................................. 8 1.2.2. OpenVZ Containers ........................................................................................................ 9 1.2.2.1. OpenVZ Container Hardware ............................................................................ 10 1.2.3. Templates ..................................................................................................................... 10 1.3. Hardware Virtualization Layer ................................................................................................. 10 1.3.1. Hardware Virtualization Basics ..................................................................................... 11 1.3.2. OpenVZ Virtual Machines ............................................................................................. 11 1.3.2.1. Intel and AMD Virtualization Technology Support ............................................. 12 1.3.3. Virtual Machine Hardware ............................................................................................ 12 1.3.4. Virtual Machine Files .................................................................................................... 13 1.3.5. Support of Virtual and Real Media ............................................................................... 13 1.3.5.1. Supported Types of Hard Disks ........................................................................ 13 1.3.5.2. Virtual Hard Disks .............................................................................................. 13 1.3.5.3. Split disks ........................................................................................................... 13 1.3.5.4. CD/DVD Discs and Images ............................................................................... 14 1.4. OpenVZ Configuration ............................................................................................................. 14 1.5. Resource Management ........................................................................................................... 14 1.6. Physical Server Availability Considerations ............................................................................ 14 2. Managing Virtual Machines and Containers ...................................................................................... 16 2.1. Creating Virtual Machines and Containers .............................................................................. 16 2.1.1. Choosing OS EZ Templates for Containers ................................................................. 16 2.1.2. Creating Containers ...................................................................................................... 16 2.1.3. Creating Virtual Machines ............................................................................................ 17 2.1.4. Supported Guest Operating Systems ........................................................................... 17 2.1.4.1. Virtual Machines ................................................................................................ 17 2.1.4.2. Containers .......................................................................................................... 18 2.2. Performing Initial Configuration of Virtual Machines and Containers ...................................... 18 2.2.1. Using cloud-init for Virtual Machine Guest Initialization ................................................ 18 2.2.2. Installing OpenVZ Guest Tools .................................................................................... 19 2.2.3. Configuring Network Settings ....................................................................................... 19 2.2.4. Setting Passwords for Virtual Machines and Containers .............................................. 20 2.2.5. Setting Startup Parameters .......................................................................................... 20 2.3. Starting, Stopping, Restarting, and Querying Status of Virtual Machines and Containers ....... 21 2.3.1. Starting Virtual Machines and Containers .................................................................... 21 2.3.2. Stopping Virtual Machines and Containers .................................................................. 21 2.3.3. Restarting Virtual Machines and Containers ................................................................ 21 2.3.4. Checking Status of Virtual Machines and Containers .................................................. 22 2.4. Listing Virtual Machines and Containers ................................................................................. 22 2.5. Cloning Virtual Machines and Containers ............................................................................... 22 2.5.1. Configuring Default Directories ..................................................................................... 23 2.6. Suspending Virtual Machines and Containers ........................................................................ 23 2.7. Running Commands in Virtual Machines and Containers ....................................................... 24 2.8. Deleting Virtual Machines and Containers .............................................................................. 25 2.9. Viewing Detailed Information About Virtual Machines and Containers ................................... 25 2.10. Managing Templates ............................................................................................................. 26 2.10.1. Creating Templates .................................................................................................... 26 2.10.2. Listing Templates ........................................................................................................ 27 2.10.3. Deploying Templates .................................................................................................. 27 2.11. Managing Snapshots ............................................................................................................. 27 2.11.1. Creating Snapshots .................................................................................................... 28 2.11.1.1. Creating Virtual Machine Snapshots ............................................................... 28 2.11.1.2. Creating Container Snapshots ......................................................................... 28 2.11.1.3. Snapshot Branching ......................................................................................... 29 2.11.1.4. Restrictions and Recommendations ................................................................ 29 2.11.2. Listing Snapshots ....................................................................................................... 29 2.11.3. Reverting to Snapshots .............................................................................................. 30 2.11.4. Deleting Snapshots ..................................................................................................... 31 2.12. Migrating Virtual Machines and Containers .......................................................................... 31 2.12.1. Migrating Virtual Machines and Containers Between OpenVZ Servers ...................... 31 2.12.1.1. Offline Migration of Virtual Machines and Containers ...................................... 32 2.12.1.2. Live Migration of Virtual Machines and Containers ......................................... 32 2.13. Performing Container-specific Operations ............................................................................. 33 2.13.1. Reinstalling Containers ............................................................................................... 33 2.13.1.1. Customizing Container Reinstallation .............................................................. 33 2.13.2. Enabling VPN for Containers ..................................................................................... 34 2.13.3. Setting Up NFS Server in Containers ........................................................................ 35 2.13.4. Mounting NFS Shares on Container Start .................................................................