How to install LXD container under KVM or Xen virtual machine

How to install LXD container under KVM or Xen virtual machine

To install LXD, the container hypervisor, under a KVM or Xen virtual machine, you will need to follow these steps:

  1. Create a new virtual machine using KVM or Xen, and install a Linux operating system on it. Any Linux distribution that is supported by LXD should work.

  2. Once the virtual machine is up and running, log in and update the package manager's package list:

sudo apt update
Sourc‮w:e‬ww.lautturi.com
  1. Add the LXD PPA to your system's package sources by running the following command:
sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable
  1. Install the lxd package by running the following command:
sudo apt install lxd
  1. Initialize LXD by running the following command:
sudo lxd init

This will guide you through the process of setting up LXD on your system. Follow the prompts to choose your storage backend, network address, and other options.

  1. Once the initialization process is complete, you can start using LXD to manage containers within the virtual machine. To create a new container, run the following command:
lxc launch ubuntu:16.04 my-container

Replace my-container with the desired name for your container. This will create a new container based on the Ubuntu 16.04 image and start it.

  1. To access the container's console, run the following command:
lxc exec my-container bash

Replace my-container with the name of your container. This will open a terminal session within the container, allowing you to run commands and manage the container.

That's it! You now have LXD installed and configured within your KVM or Xen virtual machine, and you can use it to manage containers.

Created Time:2017-10-16 14:38:47  Author:lautturi