Skip to content

Instantly share code, notes, and snippets.

@vpnwall-services
Created August 5, 2023 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpnwall-services/9e4578083e0bff7b25e62303673aa285 to your computer and use it in GitHub Desktop.
Save vpnwall-services/9e4578083e0bff7b25e62303673aa285 to your computer and use it in GitHub Desktop.
[PROXMOX 101] Proxmox 101 #debian #linux #virutalization #proxmox #pve

PROXMOX 101

  • Create template
#!/bin/bash
qm create 900 --name debian-10-openstack-amd64 --net0 virtio,bridge=vmbr0
qm importdisk 900 debian-10-openstack-amd64.qcow2 local-lvm
qm set 900 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-900-disk-0
qm set 900 --ide2 local-lvm:cloudinit
qm set 900 --boot c --bootdisk scsi0
qm set 900 --serial0 socket --vga serial0
qm set 900 -sshkey /etc/pve/pub_keys/fbachelet_lablocal.pub
qm template 900
  • Bootstrap
#!/bin/bash
# Attach the disk to the virtual machine
qm set 9000 -scsihw virtio-scsi-pci -virtio0 local-lvm:vm-9000-disk-0

# Add a serial output
qm set 9000 -serial0 socket

# Set the bootdisk to the imported Openstack disk
qm set 9000 -boot c -bootdisk virtio0

# Enable the Qemu agent
qm set 9000 -agent 1

# Allow hotplugging of network, USB and disks
qm set 9000 -hotplug disk,network,usb

# Add a single vCPU (for now)
qm set 9000 -vcpus 1

# Add a video output
qm set 9000 -vga qxl

# Set a second hard drive, using the inbuilt cloudinit drive
qm set 9000 -ide2 local-lvm:cloudinit

# Resize the primary boot disk (otherwise it will be around 2G by default)
# This step adds another 8G of disk space, but change this as you need to
qm resize 9000 virtio0 +8G

# Convert the VM to the template
qm template 9000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment