Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Installing Containers with LXC

LXC, which stands for Linux Containers, is a containerization solution that takes advantage of existing kernel features (such as namespaces and cgroups) to create container environments that are as close as possible to normal Linux installations, without the overhead of simulating hardware or running multiple kernels. In this learning activity, you are tasked with installing and configuring LXC in order to create multiple Linux containers.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 19, 2025
Duration
1h 0m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Install the LXC package.

    # sudo apt-get install lxc

  2. Challenge

    Set up the network device quota for the unprivileged user, `cloud_user`, to include 10 veth devices.
    1. Edit /etc/lxc/lxc-usernet:

    # sudo vim /etc/lxc/lxc-usernet

    • Add the following line:

    cloud_user veth lxcbr0 10

  3. Challenge

    Copy the LXC configuration file

    Copy the LXC configuration file to the cloud_users’s home directory and append the uid and gid map for the cloud_user to the file. Once completed, be sure to log out of the lab server and log back in to activate the new configuration.

    1. Create .config/lxc in the users home directory:

    # mkdir -p ~/.config/lxc

    • Copy the lxc default.conf file to the newly created directory:

    # cp /etc/lxc/default.conf ~/.config/lxc/default.conf

    • Ensure a uid/gid map exists in /etc/subuid and /etc/subgid for the cloud user.

    • Copy the uid/gid map and add it to the configuration file in the user's home directory:

    # vim ~/.config/lxc/default.conf

    • Append the following (uid/gid map numbers may vary):
    lxc.id_map = u 0 231072 65536
    lxc.id_map = g 0 231072 65536
    
    • Once this step is completed, log out of the lab server and log back in to activate the new configuration file.
  4. Challenge

    Create a container

    Create a container named ubuntu running Ubuntu Xenial and a container named centos running CentOS 7; both should use the amd64 architecture.

    1. Create the ubuntu container using the download template:

    # DOWNLOAD_KEYSERVER="keyserver.ubuntu.com" lxc-create -n ubuntu -t download -- -d ubuntu -r xenial -a amd64

    • Create the centos container using the download template:

    # DOWNLOAD_KEYSERVER="keyserver.ubuntu.com" lxc-create -n centos -t download -- -d centos -r 7 -a amd64

    • Update the permissions on the .local folder:

    chmod +x /home/cloud_user/.local

  5. Challenge

    Start up the newly created servers as daemons running in the background.

    Start up the containers using the -d option:

    # lxc-start -n centos -d

    # lxc-start -n ubuntu -d

    To see that both of the containers are running run lxc-ls -f

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight