Editing
KVM
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Installatie domU = == Prepareer een logical volume == Maak een (voorbeeld) logical partition aan op de gecreeerde volume group root@sauron:~# lvcreate -L 16G -n support dev-kvm Zie [[Kvm_test#kvm_volume | kvm test]] voor testuitvoer. == Installatie console == De installatie verloopt middels vncviewer. Maak contact met de fysieke machine als de installatie op de fysieke machine is gestart. Let op: de -Y optie dient om grafisch weer te geven en het poortnummer is de poort waarop vnc voor de te installeren machines luistert. <pre> martin@udell:~$ ssh -Y 192.168.1.201 Enter passphrase for key '/home/martin/.ssh/id_dsa': martin@sauron:~$ xvncviewer localhost:5901 VNC Viewer Free Edition 4.1.1 for X - built Apr 9 2010 18:41:55 Copyright (C) 2002-2005 RealVNC Ltd. See http://www.realvnc.com for information on VNC. </pre> Er verschijnt een grafisch venster, dat dienst doet als console. De installatie gaat hiervandaan verder. Soms verschijnt de volgende melding: VNC:Rect too big Start dan xvncviewer als volgt op: xvnc4viewer -Autoselect=0 localhost:5900 & == Installatie Debian domU == De installatie van een virtuele machine verloopt op de Debian manier via een netinstall. virt-install haalt alle code, inclusief de netboot van de debian repository, in geval van Webhuis via een apt-cacher proxy vanwege de installatie van meerdere machines. * netinstall * generatie xml van de virtuele machine install * start van de install van de virtuele machine * voortzetting van de installatie via een vnc-console * generatie xml van de virtuele machine * start van de virtuele machine Eerst zoekt virt-install de netinstall: De Mirror van Webhuis bevat de voor de netboot benodigde bestanden. De MANIFEST file staat in: http:mirror.webhuis.nl/debian/dists/squeeze/main/installer-amd64/current/images. De installatie bestanden initrd.gz en linux staan in: http:mirror.webhuis.nl/debian/dists/squeeze/main/installer-amd64/current/images/netboot/debian-installer/amd64 Verversen van deze bestanden gaat met: wget http://mirrors.nl.kernel.org/debian/dists/squeeze/main/installer-amd64/current/images/MANIFEST wget http://mirrors.nl.kernel.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux wget http://mirrors.nl.kernel.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz <pre> root@dom0-123:~# virt-install --connect qemu:///system -n cfengine3 -r 256 --vcpus=2 --disk path=/dev/dev-kvm/cfengine3 \ -l http://ftp.nl.debian.org/debian/dists/squeeze/main/installer-amd64 os-type linux \ --os-variant debiansqueeze --accelerate --network=bridge:br1 --hvm --vnc --force --debug </pre> De installatie met virt-install is vrij intelligent. Het draait om het vinden van de informatie om de installatie te starten. Na enige meldingen van de software die zijn weg zoekt in het archief vindt virt-install de voor de installatie belangrijke bestanden, het is zelfs een netinstall: <pre> Wed, 26 Jan 2011 08:55:50 DEBUG Fetching URI: http://ftp.nl.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/MANIFEST Wed, 26 Jan 2011 08:55:50 DEBUG Saved file to /var/lib/libvirt/boot/virtinst-MANIFEST.gBEjKl Retrieving file MANIFEST... | 3.3 kB 00:00 ... Wed, 26 Jan 2011 08:55:50 DEBUG Detected a Debian distro Wed, 26 Jan 2011 08:55:50 DEBUG Fetching URI: http://ftp.nl.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux Wed, 26 Jan 2011 08:56:02 DEBUG Saved file to /var/lib/libvirt/boot/virtinst-linux.aW2jsK=======================- ] 176 kB/s | 2.2 MB 00:00 ETA Retrieving file linux... | 4.6 MB 00:11 ... Wed, 26 Jan 2011 08:56:02 DEBUG Fetching URI: http://ftp.nl.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz Wed, 26 Jan 2011 08:56:34 DEBUG Saved file to /var/lib/libvirt/boot/virtinst-initrd.gz.724oyj=====================-] 210 kB/s | 6.4 MB 00:00 ETA Retrieving file initrd.gz... | 13 MB 00:31 ... </pre> === De xml van de virtuele machine install === <pre> Wed, 26 Jan 2011 08:56:34 DEBUG Generated install XML: <domain type='kvm'> <name>cfengine3</name> <currentMemory>262144</currentMemory> <memory>262144</memory> <uuid>8c6c8c04-de68-eab9-fe18-e77b4b69b543</uuid> <os> <type arch='x86_64'>hvm</type> <kernel>/var/lib/libvirt/boot/virtinst-linux.aW2jsK</kernel> <initrd>/var/lib/libvirt/boot/virtinst-initrd.gz.724oyj</initrd> <cmdline>method=http://ftp.nl.debian.org/debian/dists/squeeze/main/installer-amd64</cmdline> </os> <features> <acpi/><apic/><pae/> </features> <clock offset="utc"/> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <vcpu>2</vcpu> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='block' device='disk'> <driver name='qemu'/> <source dev='/dev/dev-kvm/cfengine3'/> <target dev='vda' bus='virtio'/> </disk> <interface type='bridge'> <source bridge='br1'/> <mac address='52:54:00:48:30:e6'/> <model type='virtio'/> </interface> <input type='tablet' bus='usb'/> <graphics type='vnc' port='-1' keymap='en-us'/> <console type='pty'/> <video> <model type='cirrus'/> </video> </devices> </domain> </pre> === De xml van de virtuele machine=== <pre> Creating domain... | 0 B 00:00 Wed, 26 Jan 2011 08:56:34 DEBUG Started guest, looking to see if it is running Wed, 26 Jan 2011 08:56:34 DEBUG Launching console callback Wed, 26 Jan 2011 08:56:34 DEBUG Generated boot XML: <domain type='kvm'> <name>cfengine3</name> <currentMemory>262144</currentMemory> <memory>262144</memory> <uuid>8c6549c04-de48-e5b9-fe12-e7596869b543</uuid> <os> <type arch='x86_64'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/><apic/><pae/> </features> <clock offset="utc"/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <vcpu>2</vcpu> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='block' device='disk'> <driver name='qemu'/> <source dev='/dev/dev-kvm/cfengine3'/> <target dev='vda' bus='virtio'/> </disk> <interface type='bridge'> <source bridge='br1'/> <mac address='52:54:00:23:40:6e'/> <model type='virtio'/> </interface> <input type='tablet' bus='usb'/> <graphics type='vnc' port='-1' keymap='en-us'/> <console type='pty'/> <video> <model type='cirrus'/> </video> </devices> </domain> </pre> De installatie is gestart en virt-install heeft de melding het console niet te kunnen openen. virt-install geeft aan dat de rest van de installatie via een console. <pre> Cannot open display: Run 'virt-viewer --help' to see a full list of available command line options Wed, 26 Jan 2011 08:56:35 DEBUG Removing /var/lib/libvirt/boot/virtinst-linux.aW2jsK Wed, 26 Jan 2011 08:56:35 DEBUG Removing /var/lib/libvirt/boot/virtinst-initrd.gz.724oyj Wed, 26 Jan 2011 08:56:37 DEBUG Domain state after install: 1 Domain installation still in progress. You can reconnect to the console to complete the installation process. root@dom0-148:~# </pre> === Openen van een console === Het openen van het console verloop via twee stappen. * Met de grafische optie inloggen op de host * vnc starten op de console <pre> martin@dell:~$ ssh -Y 10.99.99.99 Enter passphrase for key '/home/martin/.ssh/key': Linux dom0-123 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64 Last login: Wed Jan 26 13:46:08 2011 from 10.68.71.149 martin@dom0-123:~$ xvnc4viewer localhost:5900 </pre> De vnc console is verre van ideaal, maar wel werkbaar en is tenslotte maar een enkele keer nodig. De machine funcitoneert pas na een handmatige start. == Installatie Ubuntu-server domU == De installatie van een virtuele Ubuntu-server domU verloopt middels een iso-image. <pre> root@sauron:~# virt-install --connect qemu:///system -n test01 -r 128 --vcpus=2 --disk path=/dev/dev-kvm/support \ -c /var/lib/ubuntu-server-10.4.20100612.iso os-type linux --os-variant ubuntulucid --accelerate \ --network=bridge:br0 --hvm --vnc --force --debug </pre> Het nadeel van deze methode is dat het noodzakelijk is om onmiddelijk nadat de host is opgebracht een uprade uit te voeren. root@sauron:~# apt-get update && apt-get upgrade == console virtuele machine == Een console vanaf de dom0 op een virtuele machine vereist op elke host configuratie instellingen en een eenmalig herstart of start van de geconfigureerde console.<br/> Maak in de virtuele machine het bestand /etc/init/ttyS0.conf aan en voorzie het van de volgende inhoud: <pre> # ttyS0 - getty # # This service maintains a getty on ttyS0 from the point the system is # started until it is shut down again. start on stopped rc RUNLEVEL=[2345] stop on runlevel [!2345] respawn exec /sbin/getty -L 115200 ttyS0 xterm </pre> Herstart de virtuele machine, of geef het volgende commando: root@sauron:~# start ttyS0 Verbind daarna vanf de dom0 met: root@sauron:~# virsh console <virtuele machine> Geef nog een <enter> voor een login prompt als de virtuele console zonder login verschijnt.<br/> Documentatie van Ubuntu: https://help.ubuntu.com/community/KVM/Access<br/> Zie ook [[kvm_test#virtueel_console | kvm test]].<br/> === Reset root password === Het gebeurt iedereen wel eens een keer, root wachtwoord vergeten. Stel eerst de display port van de vm vast. <pre> Start de kvm machine Grub: esc om het boot proces te onderbreken e voor edit van de machine voeg aan het eind toe aan de linux regel init=/bin/bash crtl x in de machine mount -o remount,rw / passwd voor een nieuw password exec /sbin/init of /sbin/reboot </pre> * Een beschrijving: http://linoxide.com/linux-how-to/reset-forgotten-root-password-rhel-centos-7/ == Weeggooien domU == Een domU verdwijnt met het commando: root@sauron:~# virsh undefine <domU> == Verhuizen domU == root@hostA:~# dd if=/dev/vg/domU | gzip -1 - | ssh -i /home/jan/.ssh/id_rsa jan@hostB.webhuis.nl dd of=/media/migratie/domU.tgz gunzip -c svn-disk.tgz | dd of=/mnt/groot/svn-disk.tar
Summary:
Please note that all contributions to Webhuis wiki are considered to be released under the GNU Free Documentation License 1.3 or later (see
Project:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Voorpagina
Cobol and PostgreSQL
PostgreSQL
CFEngine
Proxmox
Webhuis Kennisbank
Basale infra
Webhuis bouwstenen
Webhuis configuratie
Webhuis Infra
Webhuis Support
Webhuis Raspberry
Opzet Applicaties
Business Applicaties
Community portal
Current events
Recent changes
Random page
Help
sitesupport
Tools
What links here
Related changes
Special pages
Page information