virsh console使用方法

How to use virsh console

virsh 是libvirt 开源函数库中的一个命令行工具,用来在命令行下通过libvirt发布管理虚拟机的各种命令,现在介绍一下其中一个命令的使用方法。

命令:#virsh console 

首先在虚拟机(kvm技术)中的linux操作系统执行如下操作步骤:

1. add below to inittab

echo "T0:123:respawn:/sbin/agetty -L ttyS0 9600 vt100" >> /etc/inittab

2. add ttyS0 to securetty

echo "ttyS0" >> /etc/securetty

3. reboot system

然后虚拟机重启完毕后,在host上执行如下步骤:

1. run virsh you will see

virsh #

2. virsh # list

1 xxxx               running  //显示哪个虚拟机正在运行

3. login will appear after

virsh # console xxxx or 1  //xxxx是你虚拟机的名字,1是你的虚拟机号,根据你的环境改变

当你输入 console xxx 后你会看到:

Kernel xxxxxxxxxxxxxx on an i686

localhost.localdomain login: 

如果登陆提示没有出现,那么请按一下回车键,你你应该已经看到登陆提示了。



原文地址:https://www.cnblogs.com/super-king/p/3296361.html