User:Flow/Gentoo as KVM guest

From Gentoo Wiki
Jump to:navigation Jump to:search


- Using amd64

Preparations

Follow the Linux (AMD64) Handbook. You should have done these steps:

  1. Boot from the Installation Medium
  2. Configure your Network
  3. Preparing the Disks
  4. Installing the Gentoo Installation Files

I recommend to skip all non-mandatory steps (setting the timezone, ...) until you can boot from the local disk and ssh into the machine.

Note
If you have a virtual machine with little RAM, make sure to create a swap space or compilations may fail with an out of memory error.

Kernel sources and and configuration

root #emerge --ask gentoo-sources

Compilation and configuration with genkernel

You can use genkernel in order to have the system running as fast as possible. Kernel tailoring can then be done once the system is able to boot with a genkernel created kernel.

root #emerge --ask genkernel

Compiling the kernel with modules and creating an initramfs can be done with one single command. Note the --virtio switch to enable virito support in the kernel.

root #genkernel --virtio all

Note: genkernel's virtio support is not yet fully supported

Manual kernel configuration

virtio

CODE
CONFIG_PARAVIRT_GUEST=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_BLK=y
CONFIG_SCSI_VIRTIO=y
CONFIG_VIRTIO_NET=y
CONFIG_VHOST_NET=y

Grub2

root #emerge --ask --autounmask-write sys-boot/grub:2
root #dispatch-conf
root #mkdir /boot/grub2
root #grub2-install /dev/vda
root #grub2-mkconfig -o /boot/grub2/grub.cfg