Install proxmox with LXD in a VM

1. Introduction

Proxmox VE should be best installed directly on a physical machine or a dedicated server. However, for testing purposes I have installed it in VM that is managed by LXD, in a VDS.

2. Install LXD

On the server (ubuntu:20.04) I have installed LXD with snap, like this:

apt install snap
snap install lxd --channel=latest/stable
snap list
lxc list
lxd init
I have used a btrfs storage backend, but an lvm one might be good as well.

3. Launch a standard debian:11 VM

lxc init images:debian/11/cloud PROXMOX \
    --vm -c limits.memory=12GB -c limits.cpu=4
lxc config device override PROXMOX root size=60GB
lxc start PROXMOX
lxc ls
lxc exec PROXMOX -- bash

If we used the image debian/11 instead of debian/11/cloud, then we would have to resize the partition and the filesystem in order to use all the (virtual) disk that is available:

apt install cloud-utils fdisk
fdisk -l
growpart /dev/sda 2
resize2fs /dev/sda2

However the image debian/11/cloud has cloud-init inside, which does this automatically for us.

4. Fix the configuration of the server

We need to setup properly the hostname etc. because proxmox is quite sensitive to this. Let’s say that our hostname is Then we can set the hostname like this:

echo > /etc/hostname

We should also edit /etc/hosts to look like this: pm    (1)
#      proxmox              (2)       localhost
1 Here is the IP of the server, which can be found with: ip address
2 We have commented the line with IP

5. Install proxmox

Now let’s add the DEB repos of proxmox and install its packages:

echo "deb [arch=amd64] bullseye pve-no-subscription" \
    > /etc/apt/sources.list.d/pve-install-repo.list

apt install wget
wget \
    -O /etc/apt/trusted.gpg.d/proxmox-release-bullseye.gpg

apt update
apt full-upgrade
apt install proxmox-ve postfix open-iscsi

apt remove os-prober
If you don’t know what option to select for the Postfix configuration, then choose Local only. Since this is just a test installation, being able to send notification emails is not important.

Because these packages install also a customized kernel, we need to make a reboot. But we also need to turn of the setting security.secureboot of the VM:

lxc stop PROXMOX
lxc config set PROXMOX security.secureboot=false
lxc start PROXMOX
lxc exec PROXMOX -- dhclient

6. Access its web interface

Proxmox by default makes available its web interface on the port 8006, so we need to forward this port to the VM:

firewall-cmd --permanent --zone=public \
firewall-cmd --reload
firewall-cmd --zone=public --list-forward-ports

Here is the IP of the VM.

As described on the docs, we also need to know the password of the root in order to login to the web interface. So, let’s set a password for the root:

lxc exec PROXMOX -- passwd

Now we can login as root on the web interface, using the realm Linux PAM standard authentication, create a Linux bridge (as described in the docs), etc.

For the Linux Bridge we need to know the IPv4/CIDR, Gateway(IPv4), etc., which we can find like this:

lxc exec PROXMOX -- bash
ip addr
ip ro

7. Bonus: Install MAAS

Let’s also see how to install MAAS, which is very easy.

7.1. Create a VM for it

lxc init images:ubuntu/20.04/cloud MAAS \
    --vm -c limits.memory=8GB -c limits.cpu=2
lxc config device override MAAS root size=50GB
lxc start MAAS
lxc ls

Wait a bit until it starts and enlarges its filesystem.

7.2. Install it and create an admin user

lxc exec MAAS -- bash
apt-add-repository ppa:maas/3.0
apt install maas
maas createadmin --username=admin

7.3. Forward port 5240

lxc ls MAAS    # get its IP
firewall-cmd --permanent --zone=public \
firewall-cmd --reload

Now we can access its web interface on the port 5240.

7.4. Optionally, install LXD inside it

lxc exec MAAS -- bash
apt install qemu-system-x86
apt install lxd
snap list
lxd init

8. Bonus: Try OpenNebula

We can also install OpenNebula for testing.

8.1. Create a VM for it

lxc init images:ubuntu/20.04/cloud OpenNebula \
    --vm -c limits.memory=2GB -c limits.cpu=1
lxc config device override OpenNebula root size=30GB
lxc start OpenNebula
lxc ls

Wait a bit until it starts and enlarges its filesystem.

8.2. Install its frontend

lxc exec OpenNebula -- bash
apt install wget
wget ''
bash minione --help
bash minione --frontend

In the end you will see something like this:

OpenNebula 6.2 was installed
Sunstone is running on:
FireEdge is running on:
Use following to login:
  user: oneadmin
  password: lCmPUb5Gwk

8.3. Forward ports

We will forward the port 8080 of the host to the port 80 of the VM, and the port 2616 to 2616.

lxc ls OpenNebula    # get its IP
firewall-cmd --permanent --zone=public \
firewall-cmd --permanent --zone=public \
firewall-cmd --reload

Now we can access its web interface on the port 8080.