KVM Setup on Debian Jessie

From Wiki

(Difference between revisions)
Jump to: navigation, search
Line 35: Line 35:
  #source: https://wiki.debian.org/KVM
  #source: https://wiki.debian.org/KVM
  apt-get install virtinst
  apt-get install virtinst
 +
 +
virsh list
 +
 +
= Setup VM =
 +
lvcreate -n lin01-boot --size 250m vg0
 +
lvcreate -n lin01-swap --size 1g vg0
 +
lvcreate -n lin01-root --size 5g vg0
 +
 +
mkfs.ext4 /dev/vg0/lin01-root
 +
mkswap /dev/vg0/lin01-swap
 +
 +
virt-install -d --name=lin01 --ram 512 --disk path=/dev/vg0/lin01-boot --disk path=/dev/vg0/lin01-root --disk path=/dev/vg0/lin01-swap --network bridge=br0 --vnc --accelerate --location http://ftp.debian.org/debian/dists/jessie/main/installer-amd64/ --os-type linux --os-variant generic

Revision as of 00:56, 31 December 2016

Setup Base OS

I used hetzner's "installimage" to create RAID + LVM.

installimage
-> Debian
-> Debian-86-jessie-64-minimal
-> Hostname enterservername
-> PART /boot  ext3     512M
-> PART lvm    vg0       all
-> LV vg0   root   /        ext4         10G
-> LV vg0   swap   swap     swap          4G

reboot

Sanity checks

free
lvscan
cat /proc/mdstat
cat /etc/apt/sources.list
apt-get update
apt-get upgrade
mdadm --examine --scan
df -h
cat /proc/cpuinfo

Some strange reason apt didn't work with ipv6 after the initial update. So to force apt to use ipv4

vi /etc/apt/apt.conf.d/99hetzner
#add in the line
Acquire::ForceIPv4 "true";
apt-get install fail2ban

Install KVM

aptitude install qemu-kvm libvirt-bin
#source: https://wiki.debian.org/KVM
apt-get install virtinst

virsh list

Setup VM

lvcreate -n lin01-boot --size 250m vg0
lvcreate -n lin01-swap --size 1g vg0
lvcreate -n lin01-root --size 5g vg0

mkfs.ext4 /dev/vg0/lin01-root
mkswap /dev/vg0/lin01-swap 

virt-install -d --name=lin01 --ram 512 --disk path=/dev/vg0/lin01-boot --disk path=/dev/vg0/lin01-root --disk path=/dev/vg0/lin01-swap --network bridge=br0 --vnc --accelerate --location http://ftp.debian.org/debian/dists/jessie/main/installer-amd64/ --os-type linux --os-variant generic
Personal tools