Virtualization
Initial Goal: containerized ollama-gpu
LXD / LXC
See Also: media/video/hacking/linux/just_me_and_opensource/lxd_lxc
Chopsticks
Install and Start
sudo apt install lxd lxc lsb_release -dirc sudo systemctl status lxd sudo systemctl start lxd getent group lxd sudo gpasswd -a bob lxd getent group lxd su -l $USER
lxd init
$ lxd init # no clustering needed for this demo Would you like to use LXD clustering? (yes/no) [default=no]: # since this is a new install, there is no existing storage pool, which is where the filesystem gets stored Do you want to configure a new storage pool? (yes/no) [default=yes]: # can be any name, which would probably help with connecting new instances to an existing pool, leaving default for now Name of the new storage pool [default=default]: # btrfs gives you fancy things like snapshots and volume management, but "dir" just uses a local directory for simplicity Name of the storage backend to use (lvm, btrfs, dir) [default=btrfs]: dir # "which is "metal access assess server"?" dunno - he didn't use it Would you like to connect to a MAAS server? (yes/no) [default=no]: # yes, create a bridge, which will allow the new envs to access the network Would you like to create a new local network bridge? (yes/no) [default=yes]: # Name it anything you like, I'm leaving it default What should the new bridge be called? [default=lxdbr0]: # auto address ranges are fine 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]: # It will be available on this machine, but should it be exposed to other machines? Would you like the LXD server to be available over the network? (yes/no) [default=no]: # this will automagically update your image under your feet. choose wisely. Would you like stale cached images to be updated automatically? (yes/no) [default=yes]: # spew this all back to me? Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:
lxc chopsticks
lxc version lxc help lxc help storage lxc storage list
$ lxc remote list +-----------------+------------------------------------------+---------------+-------------+--------+--------+--------+ | NAME | URL | PROTOCOL | AUTH TYPE | PUBLIC | STATIC | GLOBAL | +-----------------+------------------------------------------+---------------+-------------+--------+--------+--------+ | images | https://images.linuxcontainers.org | simplestreams | none | YES | NO | NO | +-----------------+------------------------------------------+---------------+-------------+--------+--------+--------+ | local (current) | unix:// | lxd | file access | NO | YES | NO | +-----------------+------------------------------------------+---------------+-------------+--------+--------+--------+ | ubuntu | https://cloud-images.ubuntu.com/releases | simplestreams | none | YES | YES | NO | +-----------------+------------------------------------------+---------------+-------------+--------+--------+--------+ | ubuntu-daily | https://cloud-images.ubuntu.com/daily | simplestreams | none | YES | YES | NO | +-----------------+------------------------------------------+---------------+-------------+--------+--------+--------+