热门标签 | 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


推荐阅读
  • 本文介绍了如何使用PHP向系统日历中添加事件的方法,通过使用PHP技术可以实现自动添加事件的功能,从而实现全局通知系统和迅速记录工具的自动化。同时还提到了系统exchange自带的日历具有同步感的特点,以及使用web技术实现自动添加事件的优势。 ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • 本文介绍了Python高级网络编程及TCP/IP协议簇的OSI七层模型。首先简单介绍了七层模型的各层及其封装解封装过程。然后讨论了程序开发中涉及到的网络通信内容,主要包括TCP协议、UDP协议和IPV4协议。最后还介绍了socket编程、聊天socket实现、远程执行命令、上传文件、socketserver及其源码分析等相关内容。 ... [详细]
  • 本文介绍了解决Netty拆包粘包问题的一种方法——使用特殊结束符。在通讯过程中,客户端和服务器协商定义一个特殊的分隔符号,只要没有发送分隔符号,就代表一条数据没有结束。文章还提供了服务端的示例代码。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • 本文讨论了使用差分约束系统求解House Man跳跃问题的思路与方法。给定一组不同高度,要求从最低点跳跃到最高点,每次跳跃的距离不超过D,并且不能改变给定的顺序。通过建立差分约束系统,将问题转化为图的建立和查询距离的问题。文章详细介绍了建立约束条件的方法,并使用SPFA算法判环并输出结果。同时还讨论了建边方向和跳跃顺序的关系。 ... [详细]
  • Android Studio Bumblebee | 2021.1.1(大黄蜂版本使用介绍)
    本文介绍了Android Studio Bumblebee | 2021.1.1(大黄蜂版本)的使用方法和相关知识,包括Gradle的介绍、设备管理器的配置、无线调试、新版本问题等内容。同时还提供了更新版本的下载地址和启动页面截图。 ... [详细]
  • 解决Cydia数据库错误:could not open file /var/lib/dpkg/status 的方法
    本文介绍了解决iOS系统中Cydia数据库错误的方法。通过使用苹果电脑上的Impactor工具和NewTerm软件,以及ifunbox工具和终端命令,可以解决该问题。具体步骤包括下载所需工具、连接手机到电脑、安装NewTerm、下载ifunbox并注册Dropbox账号、下载并解压lib.zip文件、将lib文件夹拖入Books文件夹中,并将lib文件夹拷贝到/var/目录下。以上方法适用于已经越狱且出现Cydia数据库错误的iPhone手机。 ... [详细]
  • Linux环境变量$PATH的作用及使用方法
    本文介绍了Linux环境变量$PATH的作用及使用方法。$PATH是一个由多个目录组成的变量,用冒号分隔。当执行一个指令时,系统会按照$PATH定义的目录顺序搜索同名的可执行文件,如果有多个同名指令,则先找到的会被执行。通过设置$PATH变量,可以在任何地方执行指令,无需输入绝对路径。 ... [详细]
  • PHP组合工具以及开发所需的工具
    本文介绍了PHP开发中常用的组合工具和开发所需的工具。对于数据分析软件,包括Excel、hihidata、SPSS、SAS、MARLAB、Eview以及各种BI与报表工具等。同时还介绍了PHP开发所需的PHP MySQL Apache集成环境,包括推荐的AppServ等版本。 ... [详细]
  • 本文介绍了某点评网的搜索策略,包括名称和地址的匹配策略,模糊匹配的方法以及不同口音和拼音的近似发音。同时提供了一些例子来说明这些策略的应用。 ... [详细]
  • 介绍一款好用的内网穿透工具FRP
    本文介绍了一款好用的内网穿透工具FRP,它是一个使用Go语言开发的高性能的反向代理应用。FRP支持多种协议类型,并且可以根据域名进行路由转发。 ... [详细]
  • 概述H.323是由ITU制定的通信控制协议,用于在分组交换网中提供多媒体业务。呼叫控制是其中的重要组成部分,它可用来建立点到点的媒体会话和多点间媒体会议 ... [详细]
  • Linux防火墙配置—允许转发
    nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd ... [详细]
  • Opencv提供了几种分类器,例程里通过字符识别来进行说明的1、支持向量机(SVM):给定训练样本,支持向量机建立一个超平面作为决策平面,使得正例和反例之间的隔离边缘被最大化。函数原型:训练原型cv ... [详细]
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社区 版权所有