热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Linux下VirtualBox虚拟机的命令行启动/关闭方法和开机自动启动

SUNVirtualBox的命令行启动/关闭方法简介VirtualBox详细命令linux开机自动启动虚拟机系统当你安装很多套Virtualbox的虚拟机器系统后,希望能在开机后自动启动虚拟机器的系统。开启记事本,将虚线内文字另存为Virtualbox.bat,将档案存放到[开始]-[程

SUN VirtualBox 的命令行启动/关闭方法简介 VirtualBox 详细命令 linux开机自动启动虚拟机系统

当你安装很多套Virtualbox的虚拟机器系统后,希望能在开机后自动启动虚拟机器的系统。 

开启记事本,将虚线内文字另存为"Virtualbox.bat",将档案存放到[开始]->[程式集]->[启动]内,即可在开机时同时跑3个Virtualbox虚拟机器的系统了。 

这种启动方式,让你不须要点选Virtualbox主程式,再开启你要执行的虚拟机器的OS。它会自动启动在背景执行,如果你有设定OS可以远端遥控的话,你可以在别台电脑以远端连线来控制虚拟机器的OS。

我们可以使用VBxManager 命令行管理工具来查看当前的虚拟基设置 和状态

下面通过实例来说明如何从命令行启动和关闭VirtualBox 虚拟机的两种常用方式。

第一种:使用 VRDP 方式通过命令行启动虚拟机: (虚拟机名为:dcsvr08)
QHo@qhoferrari1k:~$ VBoxManage startvm dcsvr08 -type vrdp

第二种 :使用 Headless 启动无前端图形界面方式: 
QHo@qhoferrari1k:~$ VBoxHeadless -startvm "dcsvr08"

VirtualBox Headless Interface 2.1.4
(C) 2008-2009 Sun Microsystems, Inc.
All rights reserved.

3389是VRDP(远程桌面)监听端口 。 
启用VRDP后,一旦虚拟机启动完毕,我们就可以通过远程桌面/XManage等GUI远程管理工具来登录客户操作系统 。

要确认虚拟机是否在运行 ,可以使用命令VBoxManage list runningvm 来查看。
QHo@qhoferrari1k:~$ VBoxManage list runningvms

从命令行关闭虚拟机 
通过VBoxManage 命令行工具的VBoxManage controlvm   | 子命令可以改变虚拟机的运行状态,
其中常用的几个选项是:

pause resume reset poweroff savestate acpipowerbutton acpisleepbutton
下面示例使用 poweroff 选项关闭虚拟机 dcsvr08 

QHo@qhoferrari1k:~$ VBoxManage controlvm dcsvr08 poweroff 
VirtualBox Command Line Management Interface Version 2.1.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

QHo@qhoferrari1k:~$ VBoxManage list runningvms 
VirtualBox Command Line Management Interface Version 2.1.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

3ce3fd01-7e17-46b3-8394-be9c1b17ee66
QHo@qhoferrari1k:~$ 
在poweroff 后马上list runningvms ,可以看到dscvr08已经被关闭,现在只有一台虚机处于运行状态。

[root@server ~]# VBoxManage

Oracle VM VirtualBox Command Line Management Interface Version 4.1.2

(C) 2005-2011 Oracle Corporation

All rights reserved.

Usage:

VBoxManage [-v|--version]    print version number and exit

VBoxManage [-q|--nologo] ... suppress the logo

VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|

bridgedifs|hostonlyifs|dhcpservers|hostinfo|

hostcpuids|hddbackends|hdds|dvds|floppies|

usbhost|usbfilters|systemproperties|extpacks

VBoxManage showvminfo       | [--details]

[--machinereadable]

VBoxManage showvminfo       | --log

VBoxManage registervm      

VBoxManage unregistervm     | [--delete]

VBoxManage createvm         --name

[--ostype ]

[--register]

[--basefolder ]

[--uuid ]

VBoxManage modifyvm        

[--name ]

[--ostype ]

[--memory ]

[--pagefusion on|off]

[--vram ]

[--acpi on|off]

[--pciattach 03:04.0]

[--pciattach 03:04.0@02:01.0]

[--pcidetach 03:04.0]

[--ioapic on|off]

[--pae on|off]

[--hpet on|off]

[--hwvirtex on|off]

[--hwvirtexexcl on|off]

[--nestedpaging on|off]

[--largepages on|off]

[--vtxvpid on|off]

[--synthcpu on|off]

[--cpuidset ]

[--cpuidremove ]

[--cpuidremoveall]

[--hardwareuuid ]

[--cpus ]

[--cpuhotplug on|off]

[--plugcpu ]

[--unplugcpu ]

[--cpuexecutioncap <1-100>]

[--rtcuseutc on|off]

[--monitorcount ]

[--accelerate3d on|off]

[--accelerate2dvideo on|off]

[--firmware bios|efi|efi32|efi64]

[--chipset ich9|piix3]

[--bioslogofadein on|off]

[--bioslogofadeout on|off]

[--bioslogodisplaytime ]

[--bioslogoimagepath ]

[--biosbootmenu disabled|menuonly|messageandmenu]

[--biossystemtimeoffset ]

[--biospxedebug on|off]

[--boot<1-4> none|floppy|dvd|disk|net>]

[--nic<1-N> none|null|nat|bridged|intnet|hostonly|

            generic]

[--nictype<1-N> Am79C970A|Am79C973|

                82540EM|82543GC|82545EM|

                virtio]

[--cableconnected<1-N> on|off]

[--nictrace<1-N> on|off]

[--nictracefile<1-N> ]

[--nicproperty<1-N> name=[value]]

[--nicspeed<1-N> ]

[--nicbootprio<1-N> ]

[--nicpromisc<1-N> deny|allow-vms|allow-all]

[--nicbandwidthgroup<1-N> none|]

[--bridgeadapter<1-N> none|]

[--hostonlyadapter<1-N> none|]

[--intnet<1-N> ]

[--natnet<1-N> |default]

[--nicgenericdrv<1-N>

[--natsettings<1-N> [],[],

                    [],[],

                    []]

[--natpf<1-N> [],tcp|udp,[],

              ,[],]

[--natpf<1-N> delete ]

[--nattftpprefix<1-N> ]

[--nattftpfile<1-N> ]

[--nattftpserver<1-N> ]

[--natbindip<1-N>

[--natdnspassdomain<1-N> on|off]

[--natdnsproxy<1-N> on|off]

[--natdnshostresolver<1-N> on|off]

[--nataliasmode<1-N> default|[log],[proxyonly],

 [sameports]]

[--macaddress<1-N> auto|]

[--mouse ps2|usb|usbtablet

[--keyboard ps2|usb

[--uart<1-N> off| ]

[--uartmode<1-N> disconnected|

                 server |

                 client |

                 file |

                 ]

[--guestmemoryballoon ]

[--gueststatisticsinterval ]

[--audio none|null|oss|alsa|pulse]

[--audiocontroller ac97|hda|sb16]

[--clipboard disabled|hosttoguest|guesttohost|

             bidirectional]

[--vrde on|off]

[--vrdeextpack default|

[--vrdeproperty ]

[--vrdeport ]

[--vrdeaddress ]

[--vrdeauthtype null|external|guest]

[--vrdeauthlibrary default|

[--vrdemulticon on|off]

[--vrdereusecon on|off]

[--vrdevideochannel on|off]

[--vrdevideochannelquality ]

[--usb on|off]

[--usbehci on|off]

[--snapshotfolder default|]

[--teleporter on|off]

[--teleporterport ]

[--teleporteraddress

[--teleporterpassword ]

VBoxManage clonevm          |

[--snapshot |]

[--mode machine|machineandchildren|all]

[--options link|keepallmacs|keepnatmacs|

           keepdisknames]

[--name ]

[--basefolder ]

[--uuid ]

[--register]

VBoxManage import          

[--dry-run|-n]

[--options keepallmacs|keepnatmacs]

[more options]

(run with -n to have options displayed

 for a particular OVF)

VBoxManage export           --output|-o

[--legacy09]

[--manifest]

[--vsys ]

        [--product ]

        [--producturl ]

        [--vendor ]

        [--vendorurl ]

        [--version ]

        [--eula ]

        [--eulafile ]

VBoxManage startvm          |...

[--type gui|sdl|headless]

VBoxManage controlvm        |

pause|resume|reset|poweroff|savestate|

acpipowerbutton|acpisleepbutton|

keyboardputscancode [ ...]|

setlinkstate<1-N> on|off |

nic<1-N> null|nat|bridged|intnet|hostonly|generic

         [] |

nictrace<1-N> on|off

nictracefile<1-N>

nicproperty<1-N> name=[value]

natpf<1-N> [],tcp|udp,[],

              ,[],

natpf<1-N> delete

guestmemoryballoon ]

gueststatisticsinterval ]

usbattach |

|

usbdetach |

|

vrde on|off |

vrdeport |

vrdeproperty |

vrdevideochannelquality

setvideomodehint [display] |

screenshotpng [display] |

setcredentials

               [--allowlocallogon ] |

teleport --host --port

       [--maxdowntime ] [--password password]

plugcpu

unplugcpu

cpuexecutioncap <1-100>

VBoxManage discardstate     |

 

VBoxManage adoptstate       |

 

VBoxManage snapshot         |

take [--description ] [--pause] |

delete | |

restore | |

restorecurrent |

edit ||--current

     [--name ]

     [--description ] |

showvminfo |

VBoxManage closemedium      disk|dvd|floppy |

[--delete]

VBoxManage storageattach    

--storagectl

[--port ]

[--device ]

[--type dvddrive|hdd|fdd]

[--medium none|emptydrive|

          ||host:|iscsi]

[--mtype normal|writethrough|immutable|shareable|

         readonly|multiattach]

[--comment ]

[--setuuid ]

[--setparentuuid ]

[--passthrough on|off]

[--tempeject on|off]

[--nonrotational on|off]

[--bandwidthgroup ]

[--forceunmount]

[--server |]

[--target ]

[--tport ]

[--lun ]

[--encodedlun ]

[--username ]

[--password ]

[--intnet]

VBoxManage storagectl      

--name

[--add ide|sata|scsi|floppy|sas]

[--controller LSILogic|LSILogicSAS|BusLogic|

              IntelAHCI|PIIX3|PIIX4|ICH6|I82078]

[--sataideemulation<1-4> <1-30>]

[--sataportcount <1-30>]

[--hostiocache on|off]

[--bootable on|off]

[--remove]

VBoxManage bandwidthctl    

--name

[--add disk|network]

[--limit

[--delete]

VBoxManage showhdinfo       |

 

VBoxManage createhd         --filename

--size |--sizebyte

[--format VDI|VMDK|VHD] (default: VDI)

[--variant Standard,Fixed,Split2G,Stream,ESX]

VBoxManage modifyhd         |

[--type normal|writethrough|immutable|shareable|

        readonly|multiattach]

[--autoreset on|off]

[--compact]

[--resize |--resizebyte ]

VBoxManage clonehd          | |

[--format VDI|VMDK|VHD|RAW|]

[--variant Standard,Fixed,Split2G,Stream,ESX]

[--existing]

VBoxManage convertfromraw  

[--format VDI|VMDK|VHD]

[--variant Standard,Fixed,Split2G,Stream,ESX]

VBoxManage convertfromraw   stdin

[--format VDI|VMDK|VHD]

[--variant Standard,Fixed,Split2G,Stream,ESX]

VBoxManage getextradata     global||

|enumerate

VBoxManage setextradata     global||

[] (no value deletes key)

VBoxManage setproperty      machinefolder default| |

vrdeauthlibrary default| |

websrvauthlibrary default|null| |

vrdeextpack null| |

loghistorycount

VBoxManage usbfilter        add

--target ||global

--name

--action ignore|hold (global filters only)

[--active yes|no] (yes)

[--vendorid ] (null)

[--productid ] (null)

[--revision ] (null)

[--manufacturer ] (null)

[--product ] (null)

[--remote yes|no] (null, VM filters only)

[--serialnumber ] (null)

[--maskedinterfaces ]

VBoxManage usbfilter        modify

--target ||global

[--name ]

[--action ignore|hold] (global filters only)

[--active yes|no]

[--vendorid |""]

[--productid |""]

[--revision |""]

[--manufacturer |""]

[--product |""]

[--remote yes|no] (null, VM filters only)

[--serialnumber |""]

[--maskedinterfaces ]

VBoxManage usbfilter        remove

--target ||global

VBoxManage sharedfolder     add |

--name --hostpath

[--transient] [--readonly] [--automount]

VBoxManage sharedfolder     remove |

--name [--transient]

VBoxManage guestproperty    get |

[--verbose]

VBoxManage guestproperty    set |

[ [--flags ]]

VBoxManage guestproperty    enumerate |

[--patterns ]

VBoxManage guestproperty    wait |

[--timeout ] [--fail-on-timeout]

VBoxManage guestcontrol     |

exec[ute]

--image

--username --password

[--dos2unix]

[--environment "= [=]"]

[--timeout ] [--unix2dos] [--verbose]

[--wait-exit] [--wait-stdout] [--wait-stderr]

[-- [] ... []]

copyfrom

--username --password

[--dryrun] [--follow] [--recursive] [--verbose]

copyto|cp

--username --password

[--dryrun] [--follow] [--recursive] [--verbose]

createdir[ectory]|mkdir|md

--username --password

[--parents] [--mode ] [--verbose]

stat

--username --password

[--verbose]

updateadditions

[--source ] [--verbose]

VBoxManage debugvm          |

dumpguestcore --filename |

info [args] |

injectnmi |

osdetect |

osinfo |

getregisters [--cpu ] |all ... |

setregisters [--cpu ] = ... |

statistics [--reset] [--pattern ]

[--descriptions]

VBoxManage metrics          list [*|host| []]

                     (comma-separated)

VBoxManage metrics          setup

[--period ] (default: 1)

[--samples ] (default: 1)

[--list]

[*|host| []]

VBoxManage metrics          query [*|host| []]

VBoxManage metrics          enable

[--list]

[*|host| []]

VBoxManage metrics          disable

[--list]

[*|host| []]

VBoxManage metrics          collect

[--period ] (default: 1)

[--samples ] (default: 1)

[--list]

[--detach]

[*|host| []]

VBoxManage hostonlyif       ipconfig

[--dhcp |

--ip [--netmask (def: 255.255.255.0)] |

--ipv6 [--netmasklengthv6 (def: 64)]]

create |

remove

VBoxManage dhcpserver       add|modify --netname |

           --ifname

[--ip

--netmask

--lowerip

--upperip ]

[--enable | --disable]

VBoxManage dhcpserver       remove --netname |

       --ifname

VBoxManage extpack          install [--replace] |

uninstall [--force] |

cleanup


推荐阅读
  • 本文将详细介绍多个流行的 Android 视频处理开源框架,包括 ijkplayer、FFmpeg、Vitamio、ExoPlayer 等。每个框架都有其独特的优势和应用场景,帮助开发者更高效地进行视频处理和播放。 ... [详细]
  • 在Linux系统中配置并启动ActiveMQ
    本文详细介绍了如何在Linux环境中安装和配置ActiveMQ,包括端口开放及防火墙设置。通过本文,您可以掌握完整的ActiveMQ部署流程,确保其在网络环境中正常运行。 ... [详细]
  • 本文将介绍如何编写一些有趣的VBScript脚本,这些脚本可以在朋友之间进行无害的恶作剧。通过简单的代码示例,帮助您了解VBScript的基本语法和功能。 ... [详细]
  • 本题探讨了一种字符串变换方法,旨在判断两个给定的字符串是否可以通过特定的字母替换和位置交换操作相互转换。核心在于找到这些变换中的不变量,从而确定转换的可能性。 ... [详细]
  • 在 Windows 10 中,F1 至 F12 键默认设置为快捷功能键。本文将介绍几种有效方法来禁用这些快捷键,并恢复其标准功能键的作用。请注意,部分笔记本电脑的快捷键可能无法完全关闭。 ... [详细]
  • 计算机网络复习:第五章 网络层控制平面
    本文探讨了网络层的控制平面,包括转发和路由选择的基本原理。转发在数据平面上实现,通过配置路由器中的转发表完成;而路由选择则在控制平面上进行,涉及路由器中路由表的配置与更新。此外,文章还介绍了ICMP协议、两种控制平面的实现方法、路由选择算法及其分类等内容。 ... [详细]
  • 本文基于刘洪波老师的《英文词根词缀精讲》,深入探讨了多个重要词根词缀的起源及其相关词汇,帮助读者更好地理解和记忆英语单词。 ... [详细]
  • 题目描述:给定n个半开区间[a, b),要求使用两个互不重叠的记录器,求最多可以记录多少个区间。解决方案采用贪心算法,通过排序和遍历实现最优解。 ... [详细]
  • 如何在PHPcms网站中添加广告
    本文详细介绍了在PHPcms网站后台添加广告的方法,涵盖多种常见的广告形式,如百度广告和Google广告,并提供了相关设置的步骤。同时,文章还探讨了优化网站流量的SEO策略。 ... [详细]
  • 题目Link题目学习link1题目学习link2题目学习link3%%%受益匪浅!-----&# ... [详细]
  • 本文深入分析了 USDC 的稳定性和可能的救援措施,探讨了在硅谷银行破产后 USDC 面临的风险以及行业内的反应。 ... [详细]
  • 1,bat由来:BATCH,一批,成批作业,批处理文件后缀BAT就取的前三个字母。2,Pingsz.tencent.com>a.txt>的作用为, ... [详细]
  • 本文探讨了如何在Classic ASP中实现与PHP的hash_hmac('SHA256', $message, pack('H*', $secret))函数等效的哈希生成方法。通过分析不同实现方式及其产生的差异,提供了一种使用Microsoft .NET Framework的解决方案。 ... [详细]
  • 本文介绍了一个基于 Java SpringMVC 和 SSM 框架的综合系统,涵盖了操作日志记录、文件管理、头像编辑、权限控制、以及多种技术集成如 Shiro、Redis 等,旨在提供一个高效且功能丰富的开发平台。 ... [详细]
  • 优化后的摘要:本文详细分析了当前面临的挑战和机遇,结合具体实例探讨了如何通过创新和改革来推动长期可持续发展。文中还介绍了多种可行的解决方案,并强调了在不同阶段实施这些方案的重要性。 ... [详细]
author-avatar
能豆子314
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有