virtualbox后台静默运行虚拟机

介绍


安装好VirtualBox后,配置完成后发现不能后台运行 每次启动都会有界面,对于想要模拟集群的我来说很麻烦

启动 VirtualBox 虚拟机


我们查看一下正常启动的虚拟机进程

leenhem@leenhem-Thinkpad-T440P:~$ ps -ef |grep vir
leenhem     2395    1627  0 08:25 ?        00:00:11 /usr/lib/virtualbox/VBoxXPCOMIPCD
leenhem     2401    1627  0 08:25 ?        00:00:34 /usr/lib/virtualbox/VBoxSVC --auto-shutdown
leenhem     4443    2401 53 08:35 ?        00:34:53 /usr/lib/virtualbox/VirtualBoxVM --comment win10 --startvm 01ba9392-82bc-4a14-ac00-481f206675a4 --no-startvm-errormsgbox
leenhem     4719    2401  0 08:36 ?        00:00:00 /usr/lib/virtualbox/VBoxNetDHCP --comment HostInterfaceNetworking-vboxnet0 --config /home/leenhem/.config/VirtualBox/HostInterfaceNetworking-vboxnet0-Dhcpd.config --log /home/leenhem/.config/VirtualBox/HostInterfaceNetworking-vboxnet0-Dhcpd.log
leenhem     8067    2401  0 09:37 ?        00:00:01 /usr/lib/virtualbox/VirtualBoxVM --comment CentOS7-01 --startvm ff9818a6-ad1a-48dd-91c9-676bf932a0e9 --no-startvm-errormsgbox --separate
leenhem     8193    4101  0 09:41 pts/0    00:00:00 grep --color=auto vir

可以看到正常的虚拟机进程是
VirtualBoxVM --comment CentOS7-01 --startvm ff9818a6-ad1a-48dd-91c9-676bf932a0e9

使用 VirtualBoxVM 后台启动


查看VirtualBoxVM参数没有发现,后台启动的参数

leenhem@leenhem-Thinkpad-T440P:~$ VirtualBoxVM --help
Oracle VM VirtualBox VM Runner v6.1.26_Ubuntu
(C) 2005-2021 Oracle Corporation
All rights reserved.

Options:
  --startvm <vmname|UUID>    start a VM by specifying its UUID or name
  --separate                 start a separate VM process
  --normal                   keep normal (windowed) mode during startup
  --fullscreen               switch to fullscreen mode during startup
  --seamless                 switch to seamless mode during startup
  --scale                    switch to scale mode during startup
  --no-startvm-errormsgbox   do not show a message box for VM start errors
  --restore-current          restore the current snapshot before starting
  --no-aggressive-caching    delays caching media info in VM processes
  --fda <image|none>         Mount the specified floppy image
  --dvd <image|none>         Mount the specified DVD image
  --dbg                      enable the GUI debug menu
  --debug                    like --dbg and show debug windows at VM startup
  --debug-command-line       like --dbg and show command line window at VM startup
  --debug-statistics         like --dbg and show statistics window at VM startup
  --no-debug                 disable the GUI debug menu and debug windows
  --start-paused             start the VM in the paused state
  --start-running            start the VM running (for overriding --debug*)

Expert options:
  --disable-patm             disable code patching (ignored by AMD-V/VT-x)
  --disable-csam             disable code scanning (ignored by AMD-V/VT-x)
  --recompile-supervisor     recompiled execution of supervisor code (*)
  --recompile-user           recompiled execution of user code (*)
  --recompile-all            recompiled execution of all code, with disabled
                             code patching and scanning
  --execute-all-in-iem       For debugging the interpreted execution mode.
  --warp-pct <pct>           time warp factor, 100%% (= 1.0) = normal speed
  (*) For AMD-V/VT-x setups the effect is --recompile-all.

The following environment (and extra data) variables are evaluated:
  VBOX_GUI_DBG_ENABLED (GUI/Dbg/Enabled)
                             enable the GUI debug menu if set
  VBOX_GUI_DBG_AUTO_SHOW (GUI/Dbg/AutoShow)
                             show debug windows at VM startup
  VBOX_GUI_NO_DEBUGGER
                             disable the GUI debug menu and debug windows

vboxmanage启动虚拟机

按照百度知道上面的说法 https://jingyan.baidu.com/article/60ccbceb6d042964cab19730.html

应该执行以下命令去启动虚拟机

leenhem@leenhem-Thinkpad-T440P:~$ vboxmanage startvm CentOS7-01 -type headless
Waiting for VM "CentOS7-01" to power on...
VM "CentOS7-01" has been successfully started.

虚拟机正常启动

批量启动虚拟机


把启动命令放到脚本中 startvm.sh

vim startvm.sh
vboxmanage startvm CentOS7-01 -type headless
vboxmanage startvm CentOS7-02 -type headless
vboxmanage startvm CentOS7-03 -type headless
vboxmanage startvm CentOS7-04 -type headless
vboxmanage startvm CentOS7-05 -type headless

查看启动后的虚拟机


在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
CSDN_码404:virtualbox后台静默运行虚拟机
https://www.code404.icu/1537.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
VirtualBox是一款开源的虚拟软件,可以在计算上创建和运行多个虚拟操作系统。下面是安装Windows 7虚拟的步骤: 1. 首先,你需要下载并安装VirtualBox软件。你可以在VirtualBox官方网站上找到适合你操作系统的安装包,并按照提示进行安装。 2. 安装完成后,打开VirtualBox软件。点击"新建"按钮创建一个新的虚拟。 3. 在弹出的对话框中,输入虚拟的名称,选择操作系统类型为"Microsoft Windows",版本选择为"Windows 7 (64-bit)"或"Windows 7 (32-bit)",根据你的实际情况选择。 4. 接下来,设置虚拟的内存大小。建议分配至少2GB的内存给Windows 7虚拟,但具体大小可以根据你的计算配置进行调整。 5. 创建虚拟硬盘。选择"创建虚拟硬盘"选项,并按照默认设置创建一个新的虚拟硬盘。 6. 设置虚拟硬盘大小。根据你的需求,可以选择固定大小或动态分配大小的虚拟硬盘。建议分配至少20GB的硬盘空间给Windows 7虚拟。 7. 完成虚拟创建后,选择新创建的虚拟并点击"设置"按钮。在设置中,选择"存储"选项卡,并点击"空白"光驱图标旁边的光盘图标。 8. 在弹出的对话框中,选择"虚拟光盘文件",然后浏览并选择Windows 7的ISO镜像文件。 9. 点击"确定"保存设置,并关闭设置窗口。 10. 现在,你可以启动虚拟了。选择新创建的虚拟并点击"启动"按钮。 11. 在虚拟启动时,会自动加载ISO镜像文件并开始安装Windows 7。按照安装向导的提示进行操作,完成Windows 7的安装过程。 12. 安装完成后,你可以在VirtualBox中使用Windows 7虚拟了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值