How To Install LXD on Debian 10 Buster Fast Guide

How To Install LXD on Debian 10 Buster Fast Guide

- 3 mins

Install LXD on Debian 10

  1. Install updates on Debian box using the apt command.
$ sudo apt update
$ sudo apt upgrade

Installing snap on Debian 10

  1. Snaps are a secure and scalable way to embed applications on Linux devices. A snap is an application containerised with all its dependencies. A snap can be installed using a single command on any device running Linux. With snaps, software updates are automatic and resilient.
  2. Snaps are availables packages all distros
  3. The app store for Linux -> https://snapcraft.io/
$ sudo apt install snapd
$ sudo snap install core
  1. You can use snap command It should be under /snap/bin, You can add the path your $PATH or .bashrc
  2. snap is working like apt so you can download and install packages.

Installing LXD snap on Debian 10

  1. LCD and LXC are different but I am not going to explain it today, basiclly LXD engine or managament layer, lxc is worker side that allows You some container base processes (launch, stop, exec, attach…)
sudo snap install lxd
  1. The output should be displayed as lxd 5.12-c63881f from Canonical✓ installed

Add user to the LXD group ?

sudo adduser {USER-Name-Here} lxd

Configure LXD

  1. Using LXC requires initiliaze to LXD for running the firdt container.
$ sudo -i
$ lxd init
$ exit
$ lxc list
  1. You can use default settings.
  2. Press enter or use different configs your LXD

Listing built-in LXD image for various Linux distros

 lxc image list images: | grep -i debian
 lxc image list images: | grep -i -E 'centos|ubuntu|opensuse'
 lxc image list images: alpine

Outputs from the 1. command: lxc

Creating your first Linux container

  1. Image running or launching syntax should be below:
lxc launch images:{distro}/{version}/{arch} {container-name-here}

Example : lxc launch -t t2.micro images:debian/11/amd64 aws-dev-t2-micro-debian

  1. After running command you can list ypur containers with lxc list command.

lxc

  1. Here you can see container is running and below lxc list, container info.

  2. We can send command to container with:

lxc exec aws-dev-t2-micro-debian -- pwd
lxc exec aws-dev-t2-micro-debian -- ls -la
lxc exec aws-dev-t2-micro-debian -- top
lxc exec aws-dev-t2-micro-debian -- w

lxc

  1. Some other commands
sudo apt install virt-viewer
lxc launch images:archlinux/desktop-gnome archlinuxdesktop \
--vm \
-c security.secureboot=false \
-c limits.cpu=4 \
-c limits.memory=4GiB \
--console=vga

:bulb: Never stop learning, beacuse life never stops teaching.

:memo: Thanks for reading.

Guneycan Sanli.


Guneycan Sanli

Guneycan Sanli

A person who like learning, music, travelling and sports.

comments powered by Disqus