PVE Proxmox is Linux + KVM (or LXC) virtualization. It is freely available from: https://www.proxmox.com/en/downloads

Tested version:

pveversion
   pve-manager/5.1-41/0b958203 (running kernel: 4.13.13-2-pve)

Notable highlights:

  • HTML5/js web client – works from both Linux and Windows. The only exception is SPICE console (requires native binary virt-viewer). However you can always use VNC as fallback
  • KVM/QEMU supports memory overcommit well – see Hypervisor Memory overcommit tests. The only comparable hypervisor (in this respect) is ESXi from VMware.
  • also supports LXC containers (no HW virtualization needed – least possible overhead)
  • also supports Software QEMU mode (slow, but useful when you have no HW virtualization – for example when running as nested VM on older CPU).

Putty SSH ciphers error

If you get SSH connection error like Couldn't agree a client-to-server cipher ... then you need to upgrade your Putty client (had success with putty-64bit-0.70-installer.msi from https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)

List and download PVE LXC appliances

To use Linux containers (LXC based) you need to download appliance filesystem archive

Use this command to list LXC appliances:

pveam available

Use this command to download specific appliance:

pveam download local debian-9.0-standard_9.3-1_amd64.tar.gz

NOTE:

The local argument is your storage name. You can list available storages using command:

pvesm status

You can then create new LXC container using this template. Example using Web UI:

  • logon to your Proxmox Web UI at https://IP_ADDRESS:8006
  • click on “Create CT” (blue button at right-top corner of webpage)
  • on “General” tab fill:
    • “Password”
    • “Confirm Password”
  • on “Template” tab fill:
    • “Storage” – keep “local” if possible
    • “Template” – there should be only option – previously downloaded debian-9.0-standard_9.3-1_amd64.tar.gz
  • keep defaults on “Root Disk” (lvm-thin), “CPU” and “Memory” tabs
  • on “Network” tab remember to either fill IPv4 (or IPv6) address or choice DHCP (if you have DHCP server on your network)
  • “DNS” – I have available “use host settings” only so it is easy
  • click on “Confirm” tab and then click on “Finish” button
  • wait for creation to complete:
    • on “Status” tab you should see “stopped: OK”

Now you can expand in tree

  • “Data Center” -> “pve” -> “100 (CT100)”
  • click on “Start” button
  • you can click on “Console” (or “Console JS”) to login to your container
  • in case or our Debian you can query container ip address using command: ip addr

NOTE: above Debian 9 image does not allow root to log via SSH – so you need to either create non-root user to login, or PermitRootLogin yes in /etc/ssh/sshd_config of your LXC

Getting container info from Proxmox SSH connection:

  • list LXC containers: lxc-ls 100
  • list information about container 100: lxc-info –name 100

NOTE: grep IP: column to get IP address of container.

Quick Download of ISO vm

To have new VM you typically need installation ISO. You can use either web UI to upload ISO this way:

  • logon to your Proxmox Web UI at https://IP_ADDRESS:8006
  • expand/click on “Datacenter” -> “pve” -> “local”
  • clock on “Upload” on right-pane to Upload your ISO

Or you can download ISO image directly to your proxmox storage:

  • SSH to your Proxmox
  • cd to ISO directory and download installation ISO image, for example:
cd /var/lib/vz/template/iso
wget http://ftp.linux.cz/pub/linux/debian-cd/9.4.0/amd64/iso-cd/debian-9.4.0-amd64-netinst.iso

NOTE: If your download fail you can continue it (without need to download whole file again) using -c argument for example:

wget -c http://ftp.linux.cz/pub/linux/debian-cd/9.4.0/amd64/iso-cd/debian-9.4.0-amd64-netinst.iso

Now you can create your first VM using this ISO, for example:

  • logon to your Proxmox Web UI at https://IP_ADDRESS:8006
  • click on “Create VM” blue button at the right-top of web page
  • click on “OS” tab
    • select your “Iso image:” – debian-9.4.0-amd64-netinst.iso
  • click on “Hard Disk”, “CPU”, “Memory”, “Network”, “Confirm” tabs and on “Finish” button.
  • expand “Data Center” -> “pve” -> “101 (VM 101)”
  • click on “Start”
  • click on “Console” and follow standard Debian installation

PVE SSH commands to get basic info about VMs:

qm list

# 101 is VMID from "qm list"
qm config 101

Listing available templates

Use this command to list installed LXC and ISO templates:

# note: "local" is storage name
pvesm list local

Install QEMU Agent

QEMU Agent is used to run commands (for example shutdown…) in guest from Host.

Please see https://pve.proxmox.com/wiki/Qemu-guest-agent for guide.

You can then run Agent commands from Proxmox SSH, for example:

qm agent 101 network-get-interfaces

Enable backups for local storage

It is two step operation:

  • enable backup for local storage: pvesm set local –content rootdir,images,backup,iso
  • set maximum number of backups to 99 (should be more than enough): pvesm set local –maxfiles 99

Set of misc. scripts

WARNING! Always customize and/or double-check these scripts before running them !!!

Script batch_create.sh to create multiple VMs from single backup (“full clone” from backup):

#!/bin/bash
set -e
for i in `seq 2 15`
do
vmid=$((100 + $i))
set -x
qm create $vmid \
    --archive /var/lib/vz/dump/vzdump-qemu-101-2018_05_09-17_07_13.vma.lzo \
    --unique 1
# --name can't be specify with --archive option...
qm set $vmid --name "CentOS7.4MariaBench-$i"
set +x
done
echo "ALL Done"
exit 0

Script batch_remove.sh to quickly remove VMs from 102 to 112(!):

#!/bin/bash
set -e
for i in `seq 2 12`
do
vmid=$((100 + $i))
set -x
qm destroy $vmid
set +x
done
echo "ALL DONE"
exit 0

Script batch_start_and_wait.sh to start and wait (till QEMU agent responds) sequence of VMs:

#!/bin/bash
t1=`mktemp`
set -e
for i in `seq 106 110`
do
        echo -n "Starting $i: "
        qm start $i
        while true
        do
                if qm agent $i ping 2> $t1
                then
                        echo
                        break
                fi
                fgrep -q timeout $t1
                echo -n "."
                sleep 1
        done
done
echo "All done"
exit 0

Script shutdown_all_running.sh to shutdown all running VMs using QEMU Guest Agent’s Shutdown command:

#!/bin/bash
set -e
for i in `qm list | grep ' running ' | awk '{print $1}'`
do
set -x
qm agent $i shutdown
set +x
done
echo "All running VMs were shut down"
exit 0

Leave a Reply

Your email address will not be published. Required fields are marked *