Home Cloud & Networking OpenVZ Essentials

OpenVZ Essentials

By Mark Furman
books-svg-icon Book
eBook $15.99 $10.99
Print $24.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $15.99 $10.99
Print $24.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
About this book
Publication date:
November 2014
Publisher
Packt
Pages
110
ISBN
9781782167327

 

Chapter 1. Installing OpenVZ

In this chapter, we are going to explain what OpenVZ is and the system requirements we need to install OpenVZ on our system. Then we are going to walk through configuring yum to use the OpenVZ repo and install the vzkernel.

Finally, we are going to talk about installing additional packages to help manage containers on the node—vzctl to create, configure, and remove containers and vzquota to manage quotas.

 

What is OS-level virtualization?


OS-level virtualization is a type of virtualization that is kernel-based. It depends on a host OS to manage, create, and configure containers on the host server through a specialized kernel.

Another type of virtualization is bare bones virtualization; this type of virtualization differs from the OS-level virtualization by providing a small OS that is booted instead of a host OS such as Windows or Linux. This type of virtualization is used to reduce the resource overhead on the host OS.

 

What is OpenVZ?


OpenVZ is a OS-level virtualization software that allows you to run isolated, secured containers that use a modified version of the Linux kernel to split the physical server to allow you to run multiple isolated containers, sometimes also called virtual private servers, that act as their own independent servers and have their own properties that are:

  • Root account

  • Users

  • Filesystem and quotas

  • Processes

  • Memory limits

  • CPU quotas

  • Network configuration

Each of the containers shares the same hardware and resources from a single physical server called a node.

The operating systems on the server cannot be mixed; they must run the same operating system as the physical server. Since you are using Linux for OpenVZ, you can only install Linux containers, although you can use different distributions of Linux for each of your containers.

 

System requirements


For this book, you are going to use CentOS 6.5 as the distribution OS in all the examples. You can also follow RHEL6.5, Scientific Linux, or Debian 7 along with this book. At the time of this writing, the OpenVZ kernel version that is available is vzkernel 2.6.32 and will be the OpenVZ kernel that is used throughout the rest of this book.

For hardware specifications, the following are recommended:

  • IBM PC compatible computer

  • Intel Core i7, Xeon E7, and AMD Opteron

  • A minimum of 128 MB of RAM; 2 GB or more is recommended

  • A hard drive with at least 80 GB of space

  • A 10/100/1000 network card

For network specifications, the following are recommended:

  • A local area network for the server

  • A valid Internet connection

  • A valid IP address for the server

  • A valid IP address for each container

Note

Please note that the previously listed requirements are recommended to get you started with learning how to use OpenVZ. On a live server, you will want to increase the RAM and CPU as the number of your containers grows on the server. It is not unusual to see a server with three to four CPUs with two or more cores at 3.4 GHz per core and 90 GB of RAM.

 

The disk partition scheme


You will create a / partition for Centos 6.5 and a swap partition to manage the virtual memory on the server and a /vz partition to store the containers that are created on the server.

When installing your Linux distribution, you will want to configure your disk partition scheme to the following:

Partition

Size

/

4-12 GB

Swap

Twice the amount of RAM

/vz

Rest of the space on the drive

 

The yum configuration


First, we will start by adding the OpenVZ repo to the repos.d directory under /etc/yum/; you can do this by running the following command:

wget -P /etc/yum.repos.d/ http://ftp.openvz.org/openvz.repo

In the previous example, we use the wget command to download the openvz.repo file from ftp.openvz.org to install openvz.repo on your server.

Then, import the OpenVZ GPG key used to sign the packages by running the following command:

rpm --import http://ftp.openvz.org/RPM-GPG-Key-OpenVZ

In the previous example, we use the rpm command to import the GPG key for openvz.repo to validate the package as a signed package.

 

Installing vzkernel


Vzkernel is the core of OpenVZ; it is essentially a modified version of the Linux kernel that allows you to run containers on your server.

To install vzkernel, you will want to run the following command:

yum install vzkernel

In the previous example, we use the yum command with the install option to install vzkernel on our server.

 

Installing vzctl and vzquota


In this section, we are going to go over the additional tools that are needed to install the vzkernel. The tools are as follows:

  • vzctl: This is an OpenVZ utility tool that allows you to directly interface with the containers. You can use this utility to start, stop, suspend, destroy, and create containers. We will go over this utility and it's usage in more detail in a future chapter.

  • vzquota: This is an OpenVZ utility that allows you to configure disk quotas on your server. You can use this utility to initialize, turn quotas on, turn quotas off, set limits, and show quota stats. We will go over this utility and it's usage in more detail in a following chapter.

To install the utilities, you will need to run the following command:

yum install vzctl vzquota

In the previous example, we use the yum command to install the packages for vzctl, vzquota, and ploop on the server.

 

Restarting the server


The last step you need to perform is rebooting your server by executing the following command. When the server comes back up, your OpenVZ installation will be complete and you will have a running OpenVZ server.

shutdown -r now
 

Summary


In this chapter, we discussed what OpenVZ is and walked through the system requirements to install OpenVZ, including hardware and networking requirements. Finally, we walked through the steps needed to install OpenVZ—configuring yum, and installing the vzkernel and additional utilities: vzctl and vzquota.

In the next chapter, you are going to learn how to download and use OS templates to create containers on the server as well as how to create a container and set up the hostname, IP address, and DNS for it.

About the Author
  • Mark Furman

    Mark Furman is currently working as a systems engineer for Info-Link Technologies. He has been in the IT field for over 10 years and specializes in Linux and open source technologies. In the past, he has worked as an independent IT contractor providing consulting services for small- to medium-sized businesses and as a Linux administrator for HostGator. He has also been managing his own IT company for several years. Mark can be reached at m.furman@live.com. He can also be found at www.linkedin.com/in/markfurman and www.twitter.com/mfurman.

    Browse publications by this author
OpenVZ Essentials
Unlock this book and the full library FREE for 7 days
Start now