VOOZH about

URL: https://www.geeksforgeeks.org/installation-guide/install-ubuntu-server-with-lxd-container/

⇱ How to Install Ubuntu Server Edition with LXD Containers - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Install Ubuntu Server Edition with LXD Containers

Last Updated : 26 Mar, 2026

LXD is a system container manager built on top of LXC (Linux Containers). Unlike traditional hypervisors such as KVM or VMware, LXD uses operating system-level virtualization.

Key Benefits of LXD:

  • Lightweight and fast
  • Near-native performance
  • Full Linux system containers
  • Built-in networking and storage management

Initial Requirements

Before moving forward, users need to follow some system requirements or prerequisites to install the Ubuntu server edition with LXD Containers.

  • Note the server's public IP address and the system or virtual machine with a minimum of 20 GB of disc space and 2 GB of RAM.
  • A downloaded Ubuntu Server Edition ISO image system.
  • Internal connection to the internet for downloading and updating packages as per requirement.

How to Install Ubuntu Server Edition with LXD Containers

LXD can be downloaded as an official snap package as of Ubuntu configuration. There are various types of advantages to this new package in the system. Any Linux distribution process that supports snap packages can be used to install a snap package modification system.

Step 1: Download and Install Ubuntu Server

  • Visit the official Ubuntu website.
  • Download the latest Ubuntu Server LTS ISO.
  • Create a bootable USB drive or mount the ISO in a virtual machine.
  • Install Ubuntu Server.
  • Create a user account during installation.

After installation, reboot and log in.

👁 Download_Ubuntu_Server

Step 2: Update the System

  • Update all packages to ensure stability and security:

sudo apt update

sudo apt upgrade -y

Step 3: Install and Configure LXD

  • On modern Ubuntu versions (20.04+), LXD is distributed as a Snap package.

Install LXD:

sudo snap install lxd

Initialize LXD:

  • After installation, initialize the LXD environment:

sudo lxd init

You can accept default options for a basic setup.

Step 4: Configure User Permissions

Add your user to the lxd group to manage containers without sudo:

sudo usermod -aG lxd $USER

newgrp lxd

Step 5: Launch Your First Container

Create a new Ubuntu container (latest LTS recommended):

lxc launch ubuntu:22.04 my-container

Verify running containers:

lxc list

Access the container shell:

lxc exec my-container -- /bin/bash

Step 6: Manage Containers

Start a container:

lxc start my-container

Stop a container:

lxc stop my-container

Delete a container:

lxc delete my-container

Step 7: Configure Networking (Optional)

LXD automatically creates a default bridge network. To create a custom network:

lxc network create my-network

lxc network attach my-network my-container eth0

This allows you to isolate containers with custom networking configurations.

LXD vs Traditional Virtual Machines

Unlike hypervisor-based virtualization platforms such as KVM or VMware, LXD containers:

  • Share the host system kernel
  • Consume fewer resources
  • Start almost instantly
  • Provide full Linux system environments

For lightweight server deployments and development environments, LXD is often more efficient than traditional VMs.

Also Read

Comment