我试图在virtualbox中模拟一个intel,一个NUC网关。我正在亚马逊EC2实例中运行这个虚拟盒。由于连接性差,我无法查看桌面的GUI。因此,开始使用命令行创建虚拟机。以下是我的步骤:
发布于 2016-09-01 15:18:27
(见下文编辑!)
看起来这在AWS EC2中是不可能的。他们有很好的基本信息和详细的分步指南来导入虚拟机映像,但是resin.io映像不适合他们的操作系统的前提:基本上,运行在EC2之上的OS映像必须是列出的OS类型之一(Ubuntu、Red、SUSE等),但是resin.io映像是一个定制的Linux系统,EC2平台不接受它。我试着运行他们的进口程序,所有不同的尝试都被拒绝了。
建议尝试不同的方式运行虚拟机。如果您只是尝试一个虚拟设备(我猜是基于这个博客的),并且您不需要NUC映像,只需要任何虚拟设备就可以了,那么现在resin.io上也有可用的QEMU-based映像,这些映像也可以在本地机器上运行(由于同样的原因,这些映像也不能在EC2上运行)。
编辑:
重读你的问题,这不是关于EC2本身,更多是关于VirtualBox,我很抱歉。VBoxManage有丰富的文档。在本例中,下面是一个脚本,用于在命令行的resin.io上设置和启动VirtualBox上的NUC映像。
所需:从resin.io仪表板下载NUC映像,并转换为VMDK映像。在主机上安装VirtualBox,在那里复制VMDK,然后修改下面文件中的设置(根据需要调整可用内存、磁盘存储和文件名)。
剧本将:
然后你的机器就可以运行了。
#!/bin/bash
## Fill in these Variables
# the virtualmachine's name
MACHINE=MyMachine2
# memory in MB
MEMORY=2048
# storage in MB
STORAGE=8096
# resin installation media path & filename
RESIN_DISK="resin-MyApplication-1.8.0-1.13.0-eb7236d1bd7e.vmdk"
# Storage disk, by defalt created in the current working directory!
DISKFILE="./${MACHINE}.vdi"
###
## Convert the original image to a Virtualbox image as:
# VBoxManage convertdd resin.img resin.vmdk --format vmdk
# and then use RESIN_DISK="resin.vmdk" above
echo "Createing Machine" && \
VBoxManage createvm --name "$MACHINE" \
--ostype Linux_64 \
--register && \
\
echo "Setting up Machine" && \
VBoxManage modifyvm "$MACHINE" \
--memory $MEMORY \
--ioapic off \
--firmware efi64 \
--rtcuseutc on && \
\
echo "Createing Storage Controller" && \
VBoxManage storagectl "$MACHINE" \
--name SATA \
--add sata && \
\
echo "Creating Main Disk" && \
VBoxManage createmedium disk \
--filename "$DISKFILE" \
--size $STORAGE && \
\
echo "Attaching Main Disk" && \
VBoxManage storageattach "$MACHINE" \
--storagectl SATA \
--port 0 --device 0 --type hdd --medium "$DISKFILE" && \
\
echo "Attaching Resin Install Media" && \
VBoxManage storageattach "$MACHINE" \
--storagectl SATA \
--port 1 --device 0 --type hdd --medium "$RESIN_DISK" && \
\
echo "Starting machine for first time setup" && \
VBoxHeadless --startvm "$MACHINE" && \
\
echo "Removing install media" && \
VBoxManage storageattach "$MACHINE" \
--storagectl SATA \
--port 1 --device 0 --type hdd --medium none && \
\
echo -e "You now can start machine for future use as: \nVBoxHeadless --startvm \"$MACHINE\""额外:
另外,如果您正在使用命令行,您也可以在命令行上获得所需的resin.io映像!
将树脂-cli安装到您的主机上,并使用resin login登录(例如使用resin.io上Dashboard / Preferences部分的API键),
下载NUC的裸操作系统映像,例如:
resin os download intel-nuc -o intel-nuc.img为您的应用程序创建一个配置,假设您的应用程序名为MyApp:
resin config generate --app MyApp -o config-MyApp.json然后将此配置添加到映像中:
sudo resin config inject config-MyApp.json --type intel-nuc --drive intel-nuc.img(为此,您可能必须运行sudo resin login,以便能够正确地使用sudo和树脂命令。)
在此之后,您可以将intel-nuc.img转换为VMDK格式,并像上面提到的那样设置您的虚拟机。
https://stackoverflow.com/questions/39252133
复制相似问题