-
Notifications
You must be signed in to change notification settings - Fork 108
NEMU with CentOS (Obsolete)
This documentation is obsolete. It is possible to use the CentOS cloud image directly with NEMU and Seabios support: Running NEMU
You cannot use the CentOS cloud images as they do not support EFI. However you can install into a virtual disk using the Q35 machine type and it's fully working serial port and the stock installer. It's not well documented how to do a serial install but i've figured it out and written instructions below:
To use CentOS download the minimal installer:
wget http://mirror.mhd.uk.as44574.net/mirror.centos.org/7.5.1804/isos/x86_64/CentOS-7-x86_64-Minimal-1804.iso
Run NEMU/QEMU with Q35 machine type and a serial console for the install:
dd if=/dev/zero of=diskvm.img bs=8M count=1024
~/build-x86_64/x86_64-softmmu/qemu-system-x86_64 -bios ~/workloads/OVMF.fd -nographic -nodefaults -L . -net none -machine q35,accel=kvm,kernel_irqchip -cpu host -m 4096,slots=4,maxmem=16950M -smp 2 -chardev file,path=/tmp/debug-log,id=debugcon -device virtio-blk-pci,drive=disk -drive if=none,id=disk,file=diskvm.img -serial stdio -netdev user,id=mynet0,hostfwd=tcp::2222-:22,hostname=nemuvm -device virtio-net-pci,netdev=mynet0 -device virtio-blk-pci,drive=iso -drive if=none,id=iso,file=$HOME/Downloads/CentOS-7-x86_64-Minimal-1804.iso
This will drop you into EFI shell. Launch the installer with:
FS1:
cd EFI
cd BOOT
BOOTX64.EFI
On the "Install CentOS" option, press e to edit
Delete quiet
and replace with console=ttyS0 console=hvc0 inst.text
Make sure you put console=hvc0
as the last console option. This will then be copied into the disk image as the grub default.
Press ctrl-x
to boot
Go through text mode installer to install to the disk. After the installer reboots, do not boot with current QEMU command line as you will not get any output as the default console is different. You can then use the virt command line:
~/build-x86_64/x86_64-softmmu/qemu-system-x86_64 -bios ~/workloads/OVMF.fd -nographic -nodefaults -L . -net none -machine virt,accel=kvm,kernel_irqchip -m 4096,slots=4,maxmem=16950M -smp 2 -device sysbus-debugcon,iobase=0x402,chardev=debugcon -chardev file,path=/tmp/debug-log,id=debugcon -device sysbus-debugcon,iobase=0x3f8,chardev=serialcon -chardev file,path=/tmp/serial-log,id=serialcon -device virtio-blk-pci,drive=disk -drive if=none,id=disk,file=diskvm.img -device virtio-serial-pci,id=virtio-serial0 -device virtconsole,chardev=charconsole0,id=console0 -chardev stdio,id=charconsole0 -netdev user,id=mynet0,hostfwd=tcp::2222-:22,hostname=nemuvm -device virtio-net-pci,netdev=mynet0
This will result in a working CentOS image running with NEMU and the "virt" machine type.