KVM: Difference between revisions

From Q
Jump to navigation Jump to search
Tgurr (talk | contribs)
No edit summary
Tgurr (talk | contribs)
Line 156: Line 156:
{{Root|# chmod -R g+w /mnt/kvm}}
{{Root|# chmod -R g+w /mnt/kvm}}


{{Command|# kvm-img create -f qcow2 /mnt/kvm/linux-test.img 15G}}
{{Command|# qemu-img create -f qcow2 /mnt/kvm/linux-test.img 15G}}


{{Command|<nowiki># vdeq kvm /mnt/kvm/linux-test.img -cdrom /dev/cdrom -soundhw es1370 -usb -m 1024 -k de -smp 1 -vga std -localtime -net nic,vlan=0,macaddr=DE:AD:BE:FF:15:33 -net vde,vlan=0,sock=/var/run/vde.ctl</nowiki>}}
{{Command|<nowiki># vdeq qemu /mnt/kvm/linux-test.img -cdrom /dev/cdrom -soundhw es1370 -usb -m 1024 -k de -smp 1 -vga std -localtime -net nic,vlan=0,macaddr=DE:AD:BE:FF:15:33 -net vde,vlan=0,sock=/var/run/vde.ctl</nowiki>}}




{{Command|# kvm-img create -f qcow2 /mnt/kvm/windows-test.img 15G}}
{{Command|# qemu-img create -f qcow2 /mnt/kvm/windows-test.img 15G}}


{{Command|<nowiki># vdeq kvm /mnt/kvm/windows-test.img -cdrom /dev/cdrom -soundhw es1370 -usb -m 1024 -k de -smp 1 -vga std -localtime -net nic,vlan=0,macaddr=DE:AD:BE:EF:14:32 -net vde,vlan=0,sock=/var/run/vde.ctl</nowiki>}}
{{Command|<nowiki># vdeq qemu /mnt/kvm/windows-test.img -cdrom /dev/cdrom -soundhw es1370 -usb -m 1024 -k de -smp 1 -vga std -localtime -net nic,vlan=0,macaddr=DE:AD:BE:EF:14:32 -net vde,vlan=0,sock=/var/run/vde.ctl</nowiki>}}


Once done installing and after enabling the remote desktop access in Windows you can add the -nographic switch and start the kvm machine via a login script for example.
Once done installing and after enabling the remote desktop access in Windows you can add the -nographic switch and start the kvm machine via a login script for example.


{{Command|<nowiki># vdeq kvm /mnt/kvm/windows-test.img -nographic -soundhw es1370 -usb -m 1024 -k de -smp 1 -vga std -localtime -net nic,vlan=0,macaddr=DE:AD:BE:EF:14:32 -net vde,vlan=0,sock=/var/run/vde.ctl</nowiki>}}
{{Command|<nowiki># vdeq qemu /mnt/kvm/windows-test.img -nographic -soundhw es1370 -usb -m 1024 -k de -smp 1 -vga std -localtime -net nic,vlan=0,macaddr=DE:AD:BE:EF:14:32 -net vde,vlan=0,sock=/var/run/vde.ctl</nowiki>}}


You really want to use an RDP session to connect to your Windows Boxes since the mouse movement is horrible slow and laggy when using the SDL client.
You really want to use an RDP session to connect to your Windows Boxes since the mouse movement is horrible slow and laggy when using the SDL client.

Revision as of 15:51, 25 November 2009

Description

Setting up the Kernel-based Virtual Machine including network configuration and being able to create and run new machines as a normal user without requiring root privileges.

Packages

Template:Box Code

Template:Box Code

USE-Flags

Template:Box File

Installation

# # paludis --install qemu-kvm

Kernel Configuration

Template:Box Kernel

Network configuration

Template:Box File

# # /etc/init.d/
# # ln -s net.lo net.br0
# # ln -s net.lo net.tap0
# # rc-update add net.br0 default
# # rc-update add net.tap0 default

Template:Box File

# # rc-update add vde default


Add existing user to the necessary groups

# # usermod -a -G kvm,qemu username

Usage

Generate random MAC adresses

$ # echo -n DE:AD:BE:EF ; for i in `seq 1 2` ; do echo -n `echo ":$RANDOM$RANDOM" | cut -n -c -3` ;done


You can always setup new machines in your home directory, but here we assume we have a separate mount-point/partition which we mount at /mnt/kvm.


$ # mkdir -p /mnt/kvm


Template:Box File


# # chown -R root:kvm /mnt/kvm
# # chmod -R g+w /mnt/kvm
$ # qemu-img create -f qcow2 /mnt/kvm/linux-test.img 15G
$ # vdeq qemu /mnt/kvm/linux-test.img -cdrom /dev/cdrom -soundhw es1370 -usb -m 1024 -k de -smp 1 -vga std -localtime -net nic,vlan=0,macaddr=DE:AD:BE:FF:15:33 -net vde,vlan=0,sock=/var/run/vde.ctl


$ # qemu-img create -f qcow2 /mnt/kvm/windows-test.img 15G
$ # vdeq qemu /mnt/kvm/windows-test.img -cdrom /dev/cdrom -soundhw es1370 -usb -m 1024 -k de -smp 1 -vga std -localtime -net nic,vlan=0,macaddr=DE:AD:BE:EF:14:32 -net vde,vlan=0,sock=/var/run/vde.ctl

Once done installing and after enabling the remote desktop access in Windows you can add the -nographic switch and start the kvm machine via a login script for example.

$ # vdeq qemu /mnt/kvm/windows-test.img -nographic -soundhw es1370 -usb -m 1024 -k de -smp 1 -vga std -localtime -net nic,vlan=0,macaddr=DE:AD:BE:EF:14:32 -net vde,vlan=0,sock=/var/run/vde.ctl

You really want to use an RDP session to connect to your Windows Boxes since the mouse movement is horrible slow and laggy when using the SDL client.