28-06-2012 | Remy van Elst
Proxmox VE is a complete virtualization management solution for servers. You can virtualize even the most demanding application workloads running on Linux and Windows Servers. It is based on the leading Kernel-based Virtual Machine (KVM) hypervisor and OpenVZ, the number one solution for container based virtualization.
ProxMox VE is a very nice piece of software to setup a VM host very fast, which also is easy manageable via a webinterface. It supports both OpenVZ and KVM. I use it to manage a few VM's to test stuff on and it works really great.
However, I'm a command line lover, and I thought it would be nice to be able to "Manage" Proxmox VE from a bash shell. And I've written a script to do just that.
proxbash.sh is a bash script to manage your Proxmox VE server.
Check out my other Proxmox/OpenVZ related articles.
If you like this script and want to support my website, use this link to order a Digital Ocean VPS: https://www.digitalocean.com/?refcode=7435ae6b8212
As you can see there is a lot of OpenVZ and not a lot of KVM. Most of the VM's I use are OpenVZ, so for the KVM things you need to use the webinterface.
Or use this:
wget https://raymii.org/s/inc/software/proxbash.sh; chmod +x ./proxbash.sh; ./proxbash.sh
Before you start, edit the script variables:
VAR_PROXMOXHOST="192.168.0.25" #proxmox server IP VAR_PROXMOXSSH="22" #proxmox ssh port VAR_PROXMOXUSER="root" #proxmox ssh user VAR_PROXMOX_NODE="proxmox" #proxmox cluster node name
and set up passwordless key auth to the proxmox node. If you don't do that, you have to enter the proxmox root password every time.
Also edit the case statement for the templates. Default it has ubuntu 10.04 and 12.04 and centos 5 and 6.
Replace $CTID with an openvz ct id. (like 103, 104)
proxbash.sh createct node-hostname node-password node-template node-ram node-disk node-ip proxbash.sh createct prod001 supersecret1 ubuntu12 1024 15 172.20.5.48
proxbash.sh createct node-hostname node-password node-template node-ram node-disk node-ip $CTID
./proxbash.sh startct ./proxbash.sh startct $CTID ./proxbash.sh stopct ./proxbash.sh stopct $CTID
./proxbash.sh deletect ./proxbash.sh deletect $CTID
./proxbash.sh shelldrop $CTID
./proxbash.sh execinct $CTID "commands you -want -to; execute; in the ../ct"
./proxbash.sh listcts ./proxbash.sh listvms
./proxbash.sh ctinfo ./proxbash.sh ctinfo $CTID
If you like it or use it, please leave a comment.