virtinst
existing disk image$ virt-install \
--connect=qemu:///system \
-n centos64 \
-r 1024 \
--description="CentOS 6.4" \
--os-type=linux \
--disk path=./centos64.qcow2,format=qcow2,bus=virtio \
--import \
--nographics \
--cpu=host
# virt-edit centos64 /boot/grub/grub.conf
add
console=ttyS0
How to connect:
another way !
The debian way
with the above in place, uncomment also this:
T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
qemu syslinux serial
syslinux
LABEL arch
MENU LABEL ArchLinux
LINUX ../vmlinuz-linux
APPEND root=/dev/vda1 rw nomodeset
INITRD ../initramfs-linux.img
serial 0
systemd
systemctl start serial-getty@ttyS0.service && cp /usr/lib/systemd/system/serial-getty\@.service getty\@ttyS0.service
qemu
qemu-system-x86_64 -drive file=archlinux.qed,if=virtio -serial stdio -display none
Centos 7
Add serial console device
$ virsh -c qemu:///system edit centos7
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
Edit grub.conf
console=ttyS0,115200
(if you have libguestfs)
$ virt-edit centos7 /boot/grub2/grub.cfg
eg.
linux16 /boot/vmlinuz-3.10.0-514.el7.x86_64 root=UUID=63bda94a-8c1d-4d66-95c5-1525b7cdb8da ro rhgb quiet LANG=en_US.UTF-8 console=ttyS0,115200
Connect to Console
$ virsh --connect qemu:///system console centos7