如何使用qemu在终端上运行非GUI操作系统?
我想在我部门的高性能计算机(带有8核处理器)上运行一些程序。现在我使用终端通过 ssh 来使用该机器。该机器上安装了 Red Hat linux。但我的程序需要在 Solaris 上运行。我使用适用于 x86 的 Nexenta Solaris。
可以使用 qemu 通过终端在该计算机上运行 Nexenta Solaris。我需要让管理员相信它可以,否则他不会在那台机器上安装 qemu,从而允许我通过虚拟机使用 Solaris。另请注意,我在 Nexenta Solaris 中不使用 GUI,仅使用命令行。在我的机器上,我使用 VMware 来运行它。
I want to run some programs on the High Performance Computer (With 8-core processor) in my department. Now I use that machine with ssh using terminal. The machine has Red Hat linux installed on it. But my programs need to run on Solaris. I use Nexenta Solaris for x86.
Can qemu be used to run Nexenta Solaris on that machine through terminal. I need to convince the administrator that it can, otherwise he won't install qemu on that machine and therefore allow me to use Solaris through a virtual machine. Also note that I don't use GUI with the Nexenta Solaris, just command line. In my machine, I use VMware to run it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以自己编译 qemu 并将其安装到您的主目录中。不会有内核模式的qemu加速器,但qemu会工作并且速度会相当高。
Qemu 有两个非 GUI 启动选项: https://www.qemu.org/docs/master/system/qemu-manpage.html#hxtool-3
它还可以通过 VNC 协议将图形输出发送到另一台机器(
-vnc
选项)You can compile qemu for youself and install it into your home directory. There will be no kernel-mode qemu accelerator, but the qemu will work and the speed will be rather high.
Qemu has two options for non-gui start: https://www.qemu.org/docs/master/system/qemu-manpage.html#hxtool-3
Also it can send graphic output to another machine via VNC protocol (
-vnc
option)Linux:
-append 'console=ttyS0'
除了
-ngraphic
之外,Linux 内核也需要该选项 提到osgx 如评论中:现在您可以执行以下操作:
-append 'console=ttyS0'
使 QEMU 通过console=ttyS0
Linux 的内核命令行选项,它告诉内核使用 串口而不是显示器。串行端口在主机和客户机之间发送字符,而不是显示器上的像素,然后 QEMU 可以在终端上显示这些字符。-serial mon:stdio
在这个最小命令中是可选的,但通常是一个好主意。例如,如果您稍后还想添加方便的-monitor telnet
,它会改善行为:这可以使用 Buildroot 轻松测试
qemu_x86_64_defconfig
。我创建了 这是一个高度独立和自动化的设置,允许您轻松尝试此操作相关但操作系统限制较少:
在 Ubuntu 18.04、QEMU 2.11.1 上测试。
FreeBSD
也能在那里工作:如何在Qemu下启动FreeBSD镜像
Linux:
-append 'console=ttyS0'
That option was also needed for Linux kernel be besides
-nographic
mentioned by osgx as in a comment:Now you can do the following:
-append 'console=ttyS0'
makes QEMU pass theconsole=ttyS0
kernel command line option to Linux, which tells the kernel to use a serial port instead of the display. The serial port sends characters between host and guest, instead of pixels on a display, and then QEMU can display those characters on the terminal.-serial mon:stdio
is optional in this minimal command, but it is generally a good idea to have around. E.g., it improves behaviour if you also want to add a handy-monitor telnet
later on:This can be easily tested with Buildroot
qemu_x86_64_defconfig
. I've created this is a highly self-contained and automated setup that allows you to try this out easilyRelated but with less OS constraints:
Tested on Ubuntu 18.04, QEMU 2.11.1.
FreeBSD
Got it working there too: How to boot FreeBSD image under Qemu
我已经为此苦苦挣扎了一段时间,终于弄清楚如何让它为我工作:
你需要安装 SGABIOS。有趣的是,这个 BIOS 不包含在 debian qemu 软件包中,因此您需要安装它(作为超级用户):
然后,当您运行 qemu 时,使用 -device 选项告诉虚拟机使用 sga 输出
瞧!通过 ssh 完美工作,监视器和文本输出都通过 stdio 发送。您可以使用 Ca c 访问 qemu 监视器。
干杯,本
I've struggled this for a while and finally figured out how to get it to work for me:
You need to have SGABIOS installed. Interestingly this BIOS is not included in the debian qemu package, so you need to install it (as the superuser):
Then when you run qemu use the -device option to tell the virtural machine to use the sga output
Voila! works perfectly over ssh with both the monitor and text output sent through stdio. You can access the qemu monitor with C-a c.
cheers, ben
操作系统终端无法运行 qemu。所以你应该在 Windows 电脑上使用 putty 或者你应该使用 Linux 机器终端。
os terminal will not working qemu. So you should use putty on windows pc or you should use linux machine terminal.