Install Proxmox on Hetzner, create Windows virtual

Boot the server into the Rescue System http://wiki.hetzner.de/index.php/Hetzner_Rescue-System/en
Run install image and select “Debian Wheezy 64bit minimal” http://wiki.hetzner.de/index.php/Installimage/en

Adjust APT sources for Proxmox
$ wget -O- “http://download.proxmox.com/debian/key.asc” | apt-key add
$ aptitude update

$ vim /etc/hosts
Remove domain name from loopback and comment IPv6, it must be like this:

### Hetzner Online AG installimage
# nameserver config
# IPv4
127.0.0.1 localhost.localdomain localhost

143.251.247.69 virt.domaine.com virt
#
## IPv6
## ::1 ip6-localhost ip6-loopback
## fe00::0 ip6-localnet
## ff00::0 ip6-mcastprefix
## ff02::1 ip6-allnodes
## ff02::2 ip6-allrouters
## ff02::3 ip6-allhosts
## 2801:4z8:196:8334::266 virt.domaine.com virt

$ aptitude install pve-firmware
$ aptitude install pve-kernel-2.6.32-29-pve
$ reboot
$ aptitude install pve-headers-2.6.32-29-pve

Check the currently active Kernel:
$ uname -a
Linux 2.6.32-29-pve …

Change grab config option “set default” to load pve-kernel
$ vim /boot/grub/grub.cfg

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
load_env
fi
set default=”0″
if [ “${prev_saved_entry}” ]; then
set saved_entry=”${prev_saved_entry}”
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z “${boot_once}” ]; then
saved_entry=”${chosen}”
save_env saved_entry
fi
}

function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}

insmod raid
insmod mdraid1x
insmod part_msdos
insmod part_msdos
insmod ext2
set root='(mduuid/574b104a2173ebdca96f88be3524526e)’
search –no-floppy –fs-uuid –set=root 967a1bf0-dcf4-4638-b998-0d3b8df15706
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640×480
load_video
insmod gfxterm
insmod raid
insmod mdraid1x
insmod part_msdos
insmod part_msdos
insmod ext2
set root='(mduuid/c91c0a99d7ed5922f67ee23e7f05bc29)’
search –no-floppy –fs-uuid –set=root 566d0fd1-85a6-481e-b92d-9fd6e34e4589
set locale_dir=($root)/grub/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry ‘Debian GNU/Linux, with Linux 2.6.32-29-pve’ –class debian –class gnu-linux –class gnu –class os {
load_video
insmod gzio
insmod raid
insmod mdraid1x
insmod part_msdos
insmod part_msdos
insmod ext2
set root='(mduuid/c91c0a99d7ed5922f67ee23e7f05bc29)’
search –no-floppy –fs-uuid –set=root 566d0fd1-85a6-481e-b92d-9fd6e34e4589
echo    ‘Loading Linux 2.6.32-29-pve …’
linux    /vmlinuz-2.6.32-29-pve root=UUID=967a1bf0-dcf4-4638-b998-0d3b8df15706 ro nomodeset ipv6.disable=1 quiet
echo    ‘Loading initial ramdisk …’
initrd    /initrd.img-2.6.32-29-pve
}
menuentry ‘Debian GNU/Linux, with Linux 2.6.32-29-pve (recovery mode)’ –class debian –class gnu-linux –class gnu –class os {
load_video
insmod gzio
insmod raid
insmod mdraid1x
insmod part_msdos
insmod part_msdos
insmod ext2
set root='(mduuid/c91c0a99d7ed5922f67ee23e7f05bc29)’
search –no-floppy –fs-uuid –set=root 566d0fd1-85a6-481e-b92d-9fd6e34e4589
echo    ‘Loading Linux 2.6.32-29-pve …’
linux    /vmlinuz-2.6.32-29-pve root=UUID=967a1bf0-dcf4-4638-b998-0d3b8df15706 ro single
echo    ‘Loading initial ramdisk …’
initrd    /initrd.img-2.6.32-29-pve
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the ‘exec tail’ line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

$ apt-get remove linux-image-amd64 linux-image-3.2.0-4-amd64
$ update-grub
$ aptitude install proxmox-ve-2.6.32
After installation login to proxmox using root local account through browser https://external.ip:8006
Add new network interface vmbr0 and forwarding rules, comment ipv6
$ vim /etc/network/interfaces
### Hetzner Online AG – installimage
# Loopback device:
auto lo
iface lo inet loopback
# device: eth0
auto  eth0
iface eth0 inet static
address   143.251.247.69
broadcast 143.251.247.95
netmask   255.255.255.224
gateway   143.251.247.65
# default route to access subnet
up route add -net 143.281.267.64 netmask 255.255.255.224 gw 143.281.267.259 eth0
# bridge for internal LAN with private IPs
auto vmbr0
iface vmbr0 inet static
address 192.168.0.1
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
# use only if Shorewall is down
post-up iptables -t nat -A POSTROUTING -s ‘192.168.0.0/24’ -o eth0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s ‘192.168.0.0/24’ -o eth0 -j MASQUERADE
#iface eth0 inet6 static
#  address 20r1:6f8:192:83c4::020
# netmask 64
#  gateway fe80::1

 

Images for installation through proxmox are here /var/lib/vz/template/iso
Images of virtual kvm nodes are hear /var/lib/vz/images/
Config files for VM in Proxmox v2 /etc/pve/
create VM
GENERAL: id – ase you whish, name – ase you whish too;
CD/DVD: iso – use iso to install;
HDD: bus – IDE, cache – write back;
NETWORK: bridged mode – vmbr0, model – virtio;

For windows OS need iso with drivers
Windows 2008 x64 r2 virtio-win-1.1.16.iso
All other Windows virtio-win-0.1-74.iso

After install OS I crete iptables rules for remote desktop port forwarding
$ iptables -t nat -A PREROUTING -d 143.281.267.258/32 -p tcp -m tcp –dport 3332 -j DNAT –to-destination 192.168.0.2:3389
143.251.247.69 – external host ip
3332 – external port
192.168.0.2 – node ip (set manualy, static ip)
3389 – internal remote desktop port on node
$ aptitude install iptables-persistent
when ask for save rules, accept (say yes).
P.S. The KVM image format RAW (the default) is very basic. One feature that might be missed is the ability to Snapshot the entire virtual machine. The Qcow2 format supports snapshots. The following command will convert a KVM image from RAW to Qcow2.
$ qemu-img convert -f raw -O qcow2 ~/image.img ~/image.qcow2

Leave a comment