VirtualBox 可以在 Amazon EC2 实例下执行吗?

发布于 2024-12-07 06:48:43 字数 199 浏览 1 评论 0原文

我们有一个测试系统,在每次主要测试之前都会启动 VirtualBox VM 快照。快照包含特定于测试的被测试系统的状态。

这是一个内存密集型测试。

有一个想法是将日常测试运行转移到 Amazon EC2 大型实例(7.5G RAM)中。

但我的理解是 EC2 本身就是一个主管。是否允许另一个VM软件(VirtualBox)在其下启动?

We have a test system where a VirtualBox VM snapshot is started before each major test. The snapshot contains a state of the tested system specific to the test.

This is a memory-intensive testing.

There is an idea to move the daily test run into Amazon EC2 Large instance (7.5G of RAM).

My understanding though is that EC2 is a supervisor itself. Will it allow another VM software (VirtualBox) to get started under it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

烈酒灼喉 2024-12-14 06:48:43

嗯,亚马逊现在允许导入 VirtualBox 和 VMWare 虚拟机。尚未支持所有操作系统,但它们可以使用:

http://aws.amazon.com/ec2/vmimport/< /a>

因此,无需在 Amazon 下运行 VirtualBox,只需导入并克隆虚拟机作为实例即可。

Well, Amazon now allows to import VirtualBox and VMWare VMs. Not all operation systems are supported yet, but they work on it:

http://aws.amazon.com/ec2/vmimport/

So there is no need to run VirtualBox under Amazon, one can just import and clone the VM as an instance.

紅太極 2024-12-14 06:48:43

不,我不相信它会。

我不是 100% 清楚到底为什么,但我的理解是 VirtualBox 主机需要访问 ring 0,但由于您的主机将在虚拟化系统中运行,因此它将无法获得此访问权限。

如果您确实想要在其他虚拟机中运行虚拟机,则可以使用QEMU。因为它是一个处理器模拟器,所以它不依赖于任何底层硬件,因此它可以“在任何地方”工作。但缺点是速度慢得多

No, I don't believe it will.

I'm not 100% clear on exactly why, but my understanding is that the VirtualBox host needs access to ring 0, but since your host will be running in a virtualized system it won't be able to get this access.

If you really want to run virtual machines inside other virtual machines, you can use QEMU. Because it is an a processor emulator it doesn't depend on any of the underlying hardware, so it will work “anywhere”. The downside, though, is that it's much slower.

葬心 2024-12-14 06:48:43

我已在 Windows AMI 下运行 VirtualBox。我试图在 Linux 下运行它,但存在各种依赖性和麻烦。
速度慢得令人痛苦。
所以答案是“是”,但除非你真的绝望,否则你可能不想这样做。

I have run VirtualBox under a Windows AMI. I'm trying to run it under Linux but there are all sorts of dependencies and hassles.
It is painfully slow.
So the answer is "yes" but you probably don't want to do it unless you're really desperate.

迟到的我 2024-12-14 06:48:43

我尝试做一些事情,虽然至少对于 来说没有多大意义,它就像 VM 中的 VM,如果它可以帮助某人

  1. 使用 Amazon EC2 帐户并安装免费层 Windows Server 2012
  2. 远程访问这个所谓的 VM,然后安装虚拟盒子进去。
  3. 在此虚拟框中安装尽可能小的 Linux Headless (Slitaz)。

这是它的样子,

在此处输入图像描述

I tried to do something, although it won't make much sense at least for , it's like VM inside VM, if it helps somebody

  1. Used Amazon EC2 account and installed free tier Windows Server 2012
  2. Took remote access to this so called VM, and install virtual box into it.
  3. Install a smallest possible Linux Headless (Slitaz) in this virtual box.

Here is how it looks,

enter image description here

梦断已成空 2024-12-14 06:48:43

我还没有找到一个极其“权威”的来源(例如明确的 EC2 或 VirtualBox 文档),但答案似乎肯定是:否。

到目前为止我找到的最好的解释是 在 AWS EC2 实例上运行 Hyper-V、VMware 或 Xen?:虚拟化感觉类似于模拟,就好像亚马逊正在运行一个“CPU模拟器应用程序”。但虚拟机管理程序更像是一个内核:它在实际物理 CPU 上主张某些特权​​,且仅属于其自身。就像内核阻止应用程序使用可能干扰其他应用程序的物理 CPU 功能一样,虚拟机管理程序是一种“超级内核”,可以防止内核使用可能干扰其他内核的物理 CPU 功能。

基本上:亚马逊的虚拟化软件已经在使用 VirtualBox 所需的特权指令集。您必须按照 David 建议使用模拟器,或者以某种方式将 VirtualBox 映像转换为 Amazon 支持的格式VM Import 工具 — 本质上是将您的 VM 转换为直接作为其自己的 EC2 实例运行。

I haven't yet found an exceedingly "authoritative" source (e.g. explicit EC2 or VirtualBox documentation) but the answer definitely seems to be: No.

The best explanation I've found so far is in Running Hyper-V, VMware or Xen on an AWS EC2 Instance?: virtualization feels like emulation, as if Amazon is running a "CPU simulator app". But a hypervisor is more like a kernel: it claims certain privileges on the actual physical CPU, exclusively for itself. Just like a kernel prevents apps from using physical CPU features that would interfere with other apps, a hypervisor is something of a "superkernel" that prevents kernels from using physical CPU features that might interfere with other kernels.

Basically: Amazon's virtualization software is already using the privileged instruction sets that VirtualBox would need. You will have to either use an emulator as David suggests, or somehow convert your VirtualBox image into a format supported by Amazon's VM Import tool — essentially convert your VM to run directly as its own EC2 instance.

落在眉间の轻吻 2024-12-14 06:48:43

我今天尝试在 Amazon EC2 中使用 Virtual Box。这是我发现

64 位虚拟机根本无法工作的情况。因此,您必须在 Virtual Box 中仅使用 x86 VM。您还必须将每个虚拟机的 CPU 数量限制为 1。它不适用于 1+ CPU。您可以直接在vm_name.vbox文件中修改它。查找

注意:测试时 Virtual Box 上的主机操作系统是“Ubuntu 14.04 x64”,来宾操作系统是“Ubuntu 14.04 x64/x86”

I tried working with Virtual Box in Amazon EC2 today. Here is what I found

64 Bit VM's doesn't work at all. So you have to use only x86 VM in Virtual Box. You also have to limit CPU count per VM to 1. It doesn't work with 1+ CPU. You can modify it in vm_name.vbox file directly. Look for <CPU count="1" hotplug="false">

Note: Host OS on Virtual Box was "Ubuntu 14.04 x64" and guest OS was "Ubuntu 14.04 x64/x86" while testing

寂寞花火° 2024-12-14 06:48:43

近期有一些新的进展。现在AWS已经裸露了
金属盒子,这不是虚拟机,而是实际的物理盒子。

不幸的是,由于 AWS 硬件非常密集,您可以获得的最小盒子是 m5d.metal,它是 96 核、768GB 的​​怪物,其性能相当价格昂贵。此外,这些产品似乎也没有现货市场。

我只是尝试在 m5d.metal 盒子上启动 Ubuntu 实例,安装 Vagrant 和 VirtualBox 并尝试运行我的 Windows 盒子之一。它按预期工作,没有任何问题。

There were some new developments recently. Now AWS has bare
metal boxes, which are not VMs, but actual physical boxes.

Unfortunately, because AWS hardware is super dense the smallest box you can get is m5d.metal, which is 96 core, 768GB monster which comes quite pricey. Also, it looks like there is no spot market for those either.

I just tried to spin up Ubuntu instance on m5d.metal box, installed Vagrant and VirtualBox and tried to run one of my Windows boxes. It worked as expected without any problems.

月朦胧 2024-12-14 06:48:43

我今天尝试了这个,明确的答案是:不。

您可以安装 GUI,但不会安装内核模块:

sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: failed: Running VirtualBox in a Xen environment is not supported.

I tried this today and definitive answer is: No.

You can install the GUI but kernel module will not install:

sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: failed: Running VirtualBox in a Xen environment is not supported.
世界和平 2024-12-14 06:48:43

所有 AWS 实例(包括裸机实例)都已在虚拟化环境中运行。

在 EC2 实例中运行 VirtualBox 意味着您希望在已存在的虚拟环境中运行另一个虚拟环境(称为嵌套虚拟化)。

AWS 提供了名为裸机(.metal) 实例的特殊实例类型来支持嵌套虚拟化。

因此,对于 VirtualBox、Hyper-V 或 EC2 实例中的任何其他虚拟环境,请使用任何可用的裸机实例。但它们的成本非常高。

All AWS instances including the bare-metal ones already run in a virtualized environment.

Running VirtualBox in an EC2 instance means you want to run another virtual environment inside an already existing virtual environment called nested virtualization.

AWS has provided special instance types named bare-metal(.metal) instances to support nested virtualization.

So, for VirtualBox, Hyper-V, or any other virtual environment in an EC2 instance, use any of the available bare-metal instances. They are very costly though.

贱贱哒 2024-12-14 06:48:43

对于那些有兴趣了解“嵌套虚拟化”如何在裸机 EC2 实例上工作的人:

# curl -w "\n" 169.254.169.254/latest/meta-data/instance-type
c5n.metal

# cat /etc/issue
Ubuntu 20.04.3 LTS \n \l

# dpkg -l virtualbox
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version                       Architecture Description
+++-==============-=============================-============-===========================================
ii  virtualbox     6.1.26-dfsg-3~ubuntu1.20.04.2 amd64        x86 virtualization solution - base binaries

# VBoxManage list vms
"vagrant-project1_vm1_CentOS_1643693775729_39367" {d5043860-dcb6-4d05-a5be-a528b28cddf9}
"vagrant-project1_vm2_Ubuntu_1643693811420_34650" {3534a74d-a52b-4c2f-84bf-404ce524018d}

# vagrant status
Current machine states:

vm1_CentOS                running (virtualbox)
vm2_Ubuntu                running (virtualbox)

# vagrant ssh vm2_Ubuntu --command  "sudo virt-what"
virtualbox

上面的最后一个命令显示嵌套虚拟机的虚拟化类型是“virtualbox”。

For those who are interested in seeing how "nested virtualiztion" works on bare metal EC2 instances:

# curl -w "\n" 169.254.169.254/latest/meta-data/instance-type
c5n.metal

# cat /etc/issue
Ubuntu 20.04.3 LTS \n \l

# dpkg -l virtualbox
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version                       Architecture Description
+++-==============-=============================-============-===========================================
ii  virtualbox     6.1.26-dfsg-3~ubuntu1.20.04.2 amd64        x86 virtualization solution - base binaries

# VBoxManage list vms
"vagrant-project1_vm1_CentOS_1643693775729_39367" {d5043860-dcb6-4d05-a5be-a528b28cddf9}
"vagrant-project1_vm2_Ubuntu_1643693811420_34650" {3534a74d-a52b-4c2f-84bf-404ce524018d}

# vagrant status
Current machine states:

vm1_CentOS                running (virtualbox)
vm2_Ubuntu                running (virtualbox)

# vagrant ssh vm2_Ubuntu --command  "sudo virt-what"
virtualbox

The last command above shows the virtulization type of the nested VM is "virtualbox".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文