Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
OpenVZ Essentials
OpenVZ Essentials

OpenVZ Essentials: Create and administer virtualized containers on your server using the robust OpenVZ

eBook
$10.99 $15.99
Paperback
$24.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

OpenVZ Essentials

Chapter 2. OS Templates and Creating Containers

In the previous chapter, we went over how to set up and install OpenVZ. In this chapter, we are going to walk through the download of OS templates that we will be using as default templates for our containers. Then, we will discuss how to create the container itself and add the default configurations necessary to make the container operational.

These are the topics that we are going to cover in this chapter:

  • What are OS templates?
  • How to download templates to your server?
  • How to properly choose a container ID?
  • How to create a container?
  • How to set the hostname, IP address, and DNS server for the container?

Getting started with OS templates

OS templates are packed container files of a Linux distribution that we can use to quickly install a new container on our node. We can use multiple distributions of Linux on the OpenVZ node. We are not confined to use the same distribution that is installed on the server itself.

You cannot, however, use Windows templates because OpenVZ is an OS-level virtualization technology. The packaged files inside the template files contain everything that is needed to run the container, including boot files, libraries, and system utilities.

Downloading OS templates

Two ways to download OS templates are explained in this section—one method is by using vztmpl-dl and the other method is a manual method.

Using vztmpl-dl to download OS templates

OpenVZ comes with a tool named vztmpl-dl that can help you download OS templates easily and effectively. You will use two options with vztmpl-dl, which are explained as follows:

  • vztmpl-dl --list-remote: This command will provide...

Selecting an OS template

After figuring out what CTID you would like to use for your container, the next step is to choose the OS template that you want to use for your container. In the Downloading OS templates section, we chose to use the OS template for CentOS 6 for our example. You can list the available templates by using ls on the /vz/template/cache directory.

Creating a container

After selecting which OS template you are going to use, you need to create a container in the next step. To create the container, you will need to use the vzctl create command. In order to use the vzctl create command, you have to supply the command with arguments for both the container ID that you chose (101) and also the OS template that you chose (centos-6-x86.tar.gz). You will also use the basic configuration file for the installation (ve-basic.conf-sample). We will talk more about this file shortly.

To create the VPS container, perform the following steps:

  1. Firstly, execute the following command:
    vzctl create...

Container configuration

The final steps that we need to take are to configure our new container to start up on boot. So, when we reset the server, the containers will automatically boot. We also need to configure the network settings for the container: hostname, IP address, and name server information. Finally, we will need to provide the container with a root password.

To configure these settings, we will use the vzctl set command. This command will allow you to add, remove, and modify configuration settings inside the container's conf file, which is located at /etc/vz/conf/ and named 101.conf.

Configuring a container to start on boot

We will use vzctl set to modify the onboot option inside the container's config file which will be set to yes using the --onboot flag. This will allow the container to automatically boot when the node is restarted. We will also use the --save flag to tell the command to save the changes to the configuration file.

To set the onboot option to yes, use...

Summary

In this chapter, we learned how to download an OS template that we can use to quickly create a VPS container that is using CentOS, Fedora, Scientific Linux, SUSE, Debian, or Ubuntu. We also learned how to use the vzctl create command to create a VPS container on the node.

Finally, we learned about the vzlist command that can list the VPS containers that are created on the server and also learned about the vzctl command that we use to change settings from the containers configuration file, including starting the container on node boot; how to set the hostname, IP address, name server; and changing the root password.

In the next chapter, we will learn how to start, stop, suspend, and resume containers. We will also learn how to destroy, mount, and unmount containers; set file and disk quotas for containers; and create snapshots of containers in order to back up, restore, or migrate a container to another server.

Left arrow icon Right arrow icon

Description

If you are a system administrator or Linux professional who wants to learn to set up, install, and manage OpenVZ containers on a server to implement OS-level virtualization, then this book is for you. Along with elementary knowledge of Linux programming, you need to have a conceptual understanding of system components and functions.

What you will learn

  • Set up OpenVZ for your server infrastructure
  • Download and configure OS templates for containers
  • Understand how to use Vzctl for container administration
  • Create and configure containers as per their utilization
  • Manage resources on your server
  • Install and manage webbased management software on the server
  • Manage multipleserver infrastructure with OpenVZ
  • Discover how to configure your containers effectively

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 11, 2014
Length: 110 pages
Edition : 1st
Language : English
ISBN-13 : 9781782167334
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want

Product Details

Publication date : Nov 11, 2014
Length: 110 pages
Edition : 1st
Language : English
ISBN-13 : 9781782167334
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 127.97
OpenVZ Essentials
$24.99
Mastering Proxmox
$47.99
Learning Docker
$54.99
Total $ 127.97 Stars icon

Table of Contents

7 Chapters
1. Installing OpenVZ Chevron down icon Chevron up icon
2. OS Templates and Creating Containers Chevron down icon Chevron up icon
3. OpenVZ Container Administration Chevron down icon Chevron up icon
4. Server Administration Using OpenVZ Chevron down icon Chevron up icon
5. Using OpenVZ Web Panel – Part One Chevron down icon Chevron up icon
6. Using OpenVZ Web Panel – Part Two Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(4 Ratings)
5 star 50%
4 star 50%
3 star 0%
2 star 0%
1 star 0%
MoneyPit Mar 31, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
If your use to Virtual Machines on Windows and Mac, such as VM Workstation or VMWare and you want to do something similar on the Linux side, then this book is for you. It helps your learn and create containers which are very similar to virtual machines. It covers the details of the free OpenVZ with tons of command line references. It also dedicates two chapters to a graphical user interface for managing these OpenVZ containers, or VPS's. Highly recommend this book if your interested in VPS for Linux.
Amazon Verified review Amazon
BT INC. Apr 09, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Prior to reading this book I had no knowledge whatsoever of OpenVZ and after reading the book, I feel very comfortable with how OpenVZ works and with what it can do. As a book for beginners it really does a nice job of starting at zero and building from there. Some books will assume certain knowledge on the user's part and leave out important details that are needed to configure something or get something running. This book doesn't do that at all. Having said that, if you are somewhat familiar with OpenVZ or are comfortable as a system admin then you might feel like some of the information is redundant and unnecessary. Those parts are obvious and easy to jump past without missing anything.As a book written for beginners to intermediate users it is a great starting point and it is very well written. It is organised well enough to be used as reference later on as well. Overall, if you're looking for a good introductory book to OpenVZ I recommend this book.
Amazon Verified review Amazon
Unimon Sep 30, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
The publish date of this book is 2014. If you're an OpenVZ user, and apparently there aren't many these days despite the usefulness of the system, this book can serve as a handy reference, or if you want to nominate your spouse or kids as the control ops for your operation. OpenVZ is the open source that Virtuozzo is built on (the pay-for version that supports scaling and clustering). OpenVZ is still in Version 7 (10/2021) so surprisingly, this book is still very relevant.Seriously, OpenVZ is a very slick and comfortable-to-user container virtualization system. Some VPS vendors still use it. It is super light-weight, allowing you to get many Linux instances running on your hardware, which can be quite humble and still make use of OVZ.The book does not have information about installing OpenVZ, which is a good thing because if it did, it would already be totally obsolete.Instead, the book focuses on operations on a Virtual Machine in the course of it's life cycle. In this regard, there have been no significant changes over the past 7 years.What has changed drastically is how you obtain and install the software. Currently it comes in three major forms:(1) An instance you can buy in the AWS Marketplace. Spin it up, and you've got your own full-fledged virtualizer in the cloud.(2) OpenVZ version 7 - not your version 7 from 2014 when the book was written, the current release supports its' own distro of Linux: VzLinux.org (!!) When you download OpenVZ, it's already set up for you as a Linux system running OpenVZ v7 under VzLinux. Burn it onto bare metal, virtualize it under VirtualBox, boot it from a USB. There are crazy cool things you can do with this.(3) Virtuozzo is the pay-for version that can be clustered, and the storage scaled.This book will not teach you to do any of the things I've mentioned. It's an operator manual. But, if you're an advanced Linux hacker, you will find this a handy reference for the lightweight powerful tool that OpenVZ is. Think of it as LXC/LXD light.(3)
Amazon Verified review Amazon
Amazon Kunde Jun 16, 2016
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
It is a good book to begin with OpenVZ as a system administrator. It shows all the commands you need to create and configure a machine.Said that, what you are not going to find here is a deeper understading, for exemple:Why OpenVZ uses their own kernel?Who is involved in the development and how often would you find updates?How the UBC Parameters relate to each other?Am I able to change the UBC Parameter is real time?How that affects the machine?Can I use other filesystems or just ploop?vzdump.....Once you have learn the basic, you can use the book as a quick reference if you do not remember the exact parameter.p.s.: The "quota" command does not exist in the last version.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.