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
€9.99 €14.99
Paperback
€18.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781782167327
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.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
€189.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
€264.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 96.97
OpenVZ Essentials
€18.99
Mastering Proxmox
€35.99
Learning Docker
€41.99
Total 96.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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.