I’m basically repeating all of the above for LXD as we speak.
This is what it looks like:
Spawn a new VM on LXD
lxc launch ubuntu:22.04 charm-dev --vm
Get a shell on the vm:
lxc shell charm-dev
Disable ipv4 for apt if you don’t have ipv6.
root@charm-dev:~# sudo echo Acquire::ForceIPv4 "true"; > /etc/apt/apt.conf.d/99force-ipv4
Install juju and charmcraft and initialize lxd
root@charm-dev:~# sudo snap install juju --classic
root@charm-dev:~# sudo snap install charmcraft --classic
root@charm-dev:~# lxd init --auto
Validate that you can see your new lxd cloud named(also called remote in lxd terms)
lxc remote list
Juju has picked this cloud up and named it “localhost”.
root@charm-dev:~# juju clouds --client
Only clouds with registered credentials are shown.
There are more clouds, use --all to see them.
You can bootstrap a new controller using one of these clouds...
Clouds available on the client:
Cloud Regions Default Type Credentials Source Description
localhost 1 localhost lxd 1 built-in LXD Container Hypervisor
Create a controller on the localhost cloud
root@charm-dev:~# juju bootstrap localhost tutorial-controller
Creating Juju controller "tutorial-controller" on localhost/localhost
Looking for packaged Juju agent version 2.9.38 for amd64
Located Juju agent version 2.9.38-ubuntu-amd64 at https://streams.canonical.com/juju/tools/agent/2.9.38/juju-2.9.38-linux-amd64.tgz
To configure your system to better support LXD containers, please see: https://linuxcontainers.org/lxd/docs/master/explanation/performance_tuning/
Launching controller instance(s) on localhost/localhost...
- juju-3a5da3-0 (arch=amd64)
Installing Juju agent on bootstrap instance
Fetching Juju Dashboard 0.8.1
Waiting for address
Attempting to connect to fd42:e802:396b:494a:216:3eff:fe4b:8fc7:22
Attempting to connect to 10.77.114.74:22
Connected to fd42:e802:396b:494a:216:3eff:fe4b:8fc7
Running machine configuration script...
Bootstrap agent now started
Contacting Juju controller at 10.77.114.74 to verify accessibility...
Bootstrap complete, controller "tutorial-controller" is now available
Controller machines are in the "controller" model
Initial model "default" added
Validate that the juju client can talk to your localhost cloud.
root@charm-dev:~# juju status
Model Controller Cloud/Region Version SLA Timestamp
default tutorial-controller localhost/localhost 2.9.38 unsupported 15:26:30Z
Model "admin/default" is empty.
With that, you have a juju-cloud and juju-controller ready for development.