
How To Install LXD on Debian 10 Buster Fast Guide
- 3 minsInstall LXD on Debian 10
- Install updates on Debian box using the apt command.
$ sudo apt update
$ sudo apt upgrade
Installing snap on Debian 10
- 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.
- Snaps are availables packages all distros
- The app store for Linux -> https://snapcraft.io/
$ sudo apt install snapd
$ sudo snap install core
- You can use snap command It should be under /snap/bin, You can add the path your $PATH or .bashrc
- snap is working like apt so you can download and install packages.
Installing LXD snap on Debian 10
- 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
- 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
- Using LXC requires initiliaze to LXD for running the firdt container.
$ sudo -i
$ lxd init
$ exit
$ lxc list
- You can use default settings.
- 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:
- You can see list of images and use one of them.
Creating your first Linux container
- 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
- After running command you can list ypur containers with lxc list command.
-
Here you can see container is running and below lxc list, container info.
-
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
- Some other commands
- lxc stop
- lxc delete
- lxc start
- lxc delete
- lxc info
- lxc list –fast
-
lxc list grep RUNNING - lxc exec containerName – command
- lxc exec
{shell-name} -
lxc exec
bash - Desktop running (GUI): Make sure remote-viewer installed to see desktop console on Debian 10 desktop:
sudo apt install virt-viewer
- Here is how launce Arch Linux GNOME desktop using LXD with 4 vCPU and 4GiB RAM:
lxc launch images:archlinux/desktop-gnome archlinuxdesktop \
--vm \
-c security.secureboot=false \
-c limits.cpu=4 \
-c limits.memory=4GiB \
--console=vga
- lxc –help
- lxc {command} –help
- lxc list –help
Never stop learning, beacuse life never stops teaching.
Thanks for reading.
Guneycan Sanli.