Skip to main content

Provisioning a Cloud-Init VM

Proxmox allows you to create both Virtual Machines via QEMU, and Containers via LXC. Out of the box, LXC containers are much easier to provision, you download the template, create the CT and specify the username, password & IP address. Virtual machines take longer to provision, but are much more flexible in usage. One big benefit is live migration without downtime. A container must be restarted when migrating to a different node.

Cloud-Init is a feature that will speed up deployment of Linux-based virtual machines, allowing you to provision a VM as quickly as a CT. This guide will assume that you already have a Debian-based Linux guest installed inside a virtual machine, and that you have OpenSSH server installed.

Logging into the virtual machine

IP address

If you are using DHCP, you may need to confirm which IP address has been given to the Virtual machine. To do this, log into the CLI and run the following command:

ip a

This should give an output similar to below. The address we are interested in is the inet address listed below ens18. In this case, the address is 192.168.1.187

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 4a:69:2e:94:d8:56 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.187/24 brd 192.168.1.255 scope global dynamic ens18
       valid_lft 86194sec preferred_lft 86194sec
    inet6 fe80::4869:2eff:fe94:d856/64 scope link 
       valid_lft forever preferred_lft forever
SSH

Then, ssh into your virtual machine:

ssh [email protected]

Enabling root access

During the preparation process, we will need to remove the user created during installation. In order to do this, we will need to log into the virtual machine as the root user.

Setting the root password

Once successfully logged in, you will need to use this command to set a password for the root user:

sudo passwd root

Enabling root ssh access