Incus

Prerequisits (ZFS filesystem)

# ZFS (optional)
sudo apt install -y zfsutils-linux
sudo lvcreate --name storage --size 100G ubuntu-vg
sudo zpool create incus /dev/ubuntu-vg/storage
sudo zpool set autotrim=on incus
sudo zfs create incus/storage
 
# uninstall LXD
snap remove lxd

Incus installation
https://github.com/zabbly/incus
https://linuxcontainers.org/incus/docs/main/installing/

mkdir -p /etc/apt/keyrings/
curl -fsSL https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc
 
sh -c 'cat <<EOF > /etc/apt/sources.list.d/zabbly-incus-stable.sources
Enabled: yes
Types: deb
URIs: https://pkgs.zabbly.com/incus/stable
Suites: $(. /etc/os-release && echo ${VERSION_CODENAME})
Components: main
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/zabbly.asc
EOF'
 
sudo apt update
sudo apt install -y incus bash-completion #incus-tools
 
sudo usermod -aG incus-admin ubuntu
 
# fixme
# incus completion fish

Incus configuration
https://linuxcontainers.org/incus/docs/main/howto/initialize/#configuration-format

cat <<EOF | incus admin init --preseed
config:
  core.https_address: 10.0.1.1:9999
  images.auto_update_interval: 15
 
storage_pools:
- name: data
  driver: zfs
  config:
    source: incus/storage
 
# Network devices
networks:
- name: incusbr0
  type: bridge
  config:
    ipv4.address: auto
    ipv6.address: none
 
# Profiles
profiles:
- name: default
  description: "Default profile"
  config:
    limits.memory: 8GiB
  devices:
    disk:
      path: /
      pool: data
      type: disk
    nic:
      name: eth0
      nictype: bridged
      parent: incusbr0
      type: nic
EOF
 
incus storage list
incus network list
incus profile show default

Create instance

incus launch images:ubuntu/24.04 u2404
incus launch images:ubuntu/24.04/cloud u2404c < config.yaml
incus launch images:alpine/edge alpine1

Enable Incus remote API authentication
https://linuxcontainers.org/incus/docs/main/howto/server_expose/#authenticate-with-the-incus-server

incus config set core.https_address :8443
incus config trust add foo

Terraform
http://www.panticz.de/terraform/incus

Incus under Ubuntu 22.04
https://github.com/zabbly/incus

Migrate LXC to Incus
https://linuxcontainers.org/incus/docs/main/howto/server_migrate_lxd/
https://discussion.scottibyte.com/t/convert-lxd-server-to-incus/357

Terraform provider
https://github.com/lxc/terraform-provider-incus

Ansible
https://discuss.linuxcontainers.org/t/creating-container-with-ansible/20050/7
https://docs.ansible.com/ansible/latest/collections/community/general/lxd_container_module.html
https://github.com/kmpm/ansible-incus

---
- hosts: incus1.example.com
  # vars:
  #   ansible_ssh_user: root
  tasks:
    - name: Create incus container
      community.general.lxd_container:
        url: "unix:/var/lib/incus/unix.socket"
        name: u2404
        source:
          type: image
          mode: pull
          server: https://images.linuxcontainers.org/
          alias: ubuntu/24.04
          protocol: simplestreams
        wait_for_container: true
        wait_for_ipv4_addresses: true

Images
https://images.linuxcontainers.org/

Incus releases videos
https://www.youtube.com/watch?v=XquQnbf6YmQ&list=PLVhiK8li7a-4wy1qHHafpkKUuM8GchDGj

WebUI
https://blog.simos.info/how-to-install-and-setup-the-incus-web-ui/

Demo
https://linuxcontainers.org/incus/try-it/

CLI

incus storage volume create default my_vol size=10Gib --type block
incus config device asdd my_vm my_vol disk pool=default source=my_vol io.bus=nvme
 
incus console v2 --type=vga
 
incus config device add demo etc disk sourdce=/etc path=/mnt/etc readonly=true

Links
https://linuxcontainers.org/incus/