Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Containerization with LXC
Containerization with LXC

Containerization with LXC: Build, manage, and configure Linux containers

eBook
AU$41.99 AU$60.99
Paperback
AU$75.99
Subscription
Free Trial
Renews at AU$24.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
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Containerization with LXC

Chapter 2. Installing and Running LXC on Linux Systems

LXC takes advantage of the kernel namespaces and cgroups to create process isolation we call containers, as we saw in the previous chapter. As such, LXC is not a separate software component in the Linux kernel, but rather a set of userspace tools, the liblxc library, and various language bindings.

In this chapter, we'll cover the following topics:

  • Installing LXC on Ubuntu and CentOS using distribution packages
  • Compiling and installing LXC from source code
  • Building and starting containers using the provided templates and configuration files
  • Manually building the root filesystem and configuration files using tools such as debootstrap and yum

Installing LXC

At the time of writing this book, there are two long-term support versions of LXC: 1.0 and 2.0. The userspace tools that they provide have some minor differences in command-line flags and deprecations, which I'll be pointing out as we use them.

Installing LXC on Ubuntu with apt

Let's start by installing LXC 1.0 on Ubuntu 14.04.5 (Trusty Tahr):

  1. Install the main LXC package, tooling, and dependencies:
    root@ubuntu:~# lsb_release -dc
    Description:       Ubuntu 14.04.5 LTS
    Codename:          trusty
    
    root@ubuntu:~# apt-get -y install -y lxc bridge-utils 
          debootstrap libcap-dev 
          cgroup-bin libpam-systemdbridge-utils
    root@ubuntu:~#
    
  2. The package version that Trusty Tahr provides at this time is 1.0.8:
    root@ubuntu:~# dpkg --list | grep lxc | awk '{print $2,$3}'
    liblxc1 1.0.8-0ubuntu0.3
    lxc 1.0.8-0ubuntu0.3
    lxc-templates 1.0.8-0ubuntu0.3
    python3-lxc 1.0.8-0ubuntu0.3
    root@ubuntu:~# 
    

To install LXC 2.0, we'll need the Backports repository:

  1. Add the following...

Building and manipulating LXC containers

Managing the container life cycle with the provided userspace tools is quite convenient compared to manually creating namespaces and applying resource limits with cgroups. In essence, this is exactly what the LXC tools do: creation and manipulation of the namespaces and cgroups we saw in Chapter 1, Introduction to Linux Containers. The LXC tooling implements functions defined in the liblxc API, as we'll see in Chapter 4, LXC Code Integration with Python.

LXC comes packaged with various templates for building root filesystems for different Linux distributions. We can use them to create a variety of container flavors. For example, running a Debian container on a CentOS host. We also have the option of building our own root filesystem with tools such as debootstrap and yum, which we will explore shortly.

Building our first container

We can create our first container using a template. The lxc-download file, like the rest of the templates in the templates...

Summary

LXC provides a toolset that makes it quite easy and convenient to build, start, and manipulate containers. Using the included templates and configuration files further simplifies this process. In this chapter, we saw practical examples on how to install, configure, and start LXC on Ubuntu and CentOS distributions. You learned how to create container root filesystems and how to write simple configuration files.

In the next chapter, we'll have a look at how to configure system resources in LXC and explore alternative ways of working with LXC, by utilizing the libvrit toolkit and libraries.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Get the most practical and up-to-date resource on LXC and take full advantage of what Linux containers can offer in the day-to-day operations of large-scale applications
  • Learn how to deploy and administer various workloads such as web applications inside LXC
  • Save your organization time and money by building robust and secure containers and by speeding the deployment process of your software

Description

In recent years, containers have gained wide adoption by businesses running a variety of application loads. This became possible largely due to the advent of kernel namespaces and better resource management with control groups (cgroups). Linux containers (LXC) are a direct implementation of those kernel features that provide operating system level virtualization without the overhead of a hypervisor layer. This book starts by introducing the foundational concepts behind the implementation of LXC, then moves into the practical aspects of installing and configuring LXC containers. Moving on, you will explore container networking, security, and backups. You will also learn how to deploy LXC with technologies like Open Stack and Vagrant. By the end of the book, you will have a solid grasp of how LXC is implemented and how to run production applications in a highly available and scalable way.

Who is this book for?

This book is for Linux engineers and software developers who are looking to deploy applications in a fast, secure, and scalable way for use in testing and production.

What you will learn

  • Deep dive into the foundations of Linux containers with kernel namespaces and cgroups
  • Install, configure, and administer Linux containers with LXC and libvirt
  • Begin writing applications using Python libvirt bindings
  • Take an in-depth look at container networking
  • Set up monitoring and security with LXC
  • Build and deploy a highly available application with LXC in the cloud

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 28, 2017
Length: 352 pages
Edition : 1st
Language : English
ISBN-13 : 9781783985685
Vendor :
Linux Foundation
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
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Feb 28, 2017
Length: 352 pages
Edition : 1st
Language : English
ISBN-13 : 9781783985685
Vendor :
Linux Foundation
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
AU$24.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
AU$249.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 AU$5 each
Feature tick icon Exclusive print discounts
AU$349.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 AU$5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total AU$ 243.97
Mastering KVM Virtualization
AU$83.99
Containerization with LXC
AU$75.99
KVM Virtualization Cookbook
AU$83.99
Total AU$ 243.97 Stars icon

Table of Contents

9 Chapters
1. Introduction to Linux Containers Chevron down icon Chevron up icon
2. Installing and Running LXC on Linux Systems Chevron down icon Chevron up icon
3. Command-Line Operations Using Native and Libvirt Tools Chevron down icon Chevron up icon
4. LXC Code Integration with Python Chevron down icon Chevron up icon
5. Networking in LXC with the Linux Bridge and Open vSwitch Chevron down icon Chevron up icon
6. Clustering and Horizontal Scaling with LXC Chevron down icon Chevron up icon
7. Monitoring and Backups in a Containerized World Chevron down icon Chevron up icon
8. Using LXC with OpenStack Chevron down icon Chevron up icon
A. LXC Alternatives to Docker and OpenVZ Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(2 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Mirko Longa Soto Sep 27, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
El autor me sorprende con un libro cargado de ejemplos, pasando desde los fundamentos hasta ejemplos concretos de poner en servicio sistemas completos de nodos redundantes con balanceadores de carga incluido y todo con LXC, un buen libro para tener en cuenta.
Amazon Verified review Amazon
Sean Embry May 15, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
If you need to know containerization, this is the go to source for you. Konstantin knows his stuff and with a clear and incisive writing style, makes sure you know it to.
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.