LXD on Bitfolk: Difference between revisions

From BitFolk
Jump to navigation Jump to search
(Created page with "This shows how to say 'Hello Linuxcontainer' on Bitflok. = VPS Setup = xen-shell> install debian_bullseye Divide xvda into xvda1 (500MB, ext4, boot) and xvda2 (rest, btrfs,...")
 
Line 34: Line 34:
  Create subvolume '/mnt/xvda2/@lxd'
  Create subvolume '/mnt/xvda2/@lxd'
  root@myhost:~# umount /mnt/xvda2= LXD Initialisation =
  root@myhost:~# umount /mnt/xvda2= LXD Initialisation =
= Install LXD
= Install LXD =
  root@myhost:~# mkdir /var/snap/lxd
  root@myhost:~# mkdir /var/snap/lxd
  root@myhost:~# apt install snapd
  root@myhost:~# apt install snapd

Revision as of 22:19, 20 July 2022

This shows how to say 'Hello Linuxcontainer' on Bitflok.

VPS Setup

xen-shell> install debian_bullseye

Divide xvda into xvda1 (500MB, ext4, boot) and xvda2 (rest, btrfs, /). xvda1:

 xvda1:           Ext4 journaling file system
 
 Mount point:      /boot
 Mount options:    defaults
 Label:            BOOT
 Reserved blocks:  5%
 Typical usage:    standard
 Bootable flag:    on
 xvda2:                btrfs journaling file system
 
 Format the partition:  yes, format it
 Mount point:           /
 Mount options:         defaults
 Label:                 ROOT
 Bootable flag:         on
 
 The following partitions are going to be formatted:
   partition #1 of Virtual disk 1 (xvda) as ext4
   partition #2 of Virtual disk 1 (xvda) as btrfs
   partition #1 of Virtual disk 2 (xvdb) as swap

I only installed SSH server.

BTRFS Layout

root@myhost:~# mkdir /mnt/xvda2
root@myhost:~# mount -o subvolid=5 /dev/xvda2 /mnt/xvda2/
root@myhost:~# btrfs subvolume create /mnt/xvda2/@lxd
Create subvolume '/mnt/xvda2/@lxd'
root@myhost:~# umount /mnt/xvda2= LXD Initialisation =

Install LXD

root@myhost:~# mkdir /var/snap/lxd
root@myhost:~# apt install snapd
LABEL=ROOT /var/snap/lxd btrfs defaults,subvol=@lxd 0 0

My First Container

root@myhost:~# lxd init
Would you like to use LXD clustering? (yes/no) [default=no]: 
Do you want to configure a new storage pool? (yes/no) [default=yes]: 
Name of the new storage pool [default=default]: lxdstoragepool
Name of the storage backend to use (dir, lvm, ceph, btrfs) [default=btrfs]: 
Would you like to create a new btrfs subvolume under /var/snap/lxd/common/lxd? (yes/no) [default=yes]: 
Would you like to connect to a MAAS server? (yes/no) [default=no]: 
Would you like to create a new local network bridge? (yes/no) [default=yes]: 
What should the new bridge be called? [default=lxdbr0]: 
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
Would you like the LXD server to be available over the network? (yes/no) [default=no]: 
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]: 
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:
root@myhost:~# btrfs subvolume list /
ID 256 gen 3874 top level 5 path @rootfs
ID 259 gen 3874 top level 5 path @lxd
ID 261 gen 3873 top level 259 path @lxd/common/lxd/storage-pools/lxdstoragepool
root@myhost:~# lxc launch ubuntu:22.04 my-ubuntu-lxc
Creating my-ubuntu-lxc
Starting my-ubuntu-lxc
root@myhost:~# lxc exec my-ubuntu-lxc bash
root@my-ubuntu-lxc:~# echo "Boris Becker: Ich bin drin!"
Boris Becker: Ich bin drin!