Reprint: Start a VirtualBox virtual machine using the command line

Source: Internet
Author: User
Tags virtualbox download rdesktop

To start a VirtualBox virtual machine using the command line

Install the VirtualBox to figure out how to turn it on automatically, or you can start the specified virtual machine directly from the command line.

Looking at the official documents of VirtualBox, I found a command to meet my needs, namely vboxmanage.

Vboxmanage provides a series of virtual machine management commands, including create/delete/start/modify and so on, not listed here. A bit like the Xen XM command.

But here is only the command to start the virtual machine: Vboxmanage STARTVM. Vboxmanage's complete list of commands can be found here.

The vboxmanage STARTVM subcommand can turn on a virtual machine that has a status of shut down or saved. The syntax for this command is:
Vboxmanage STARTVM Uuid>|name ... [--type gui|sdl|headless]

You can specify a virtual machine by the UUID or name of the virtual machine, and you can list the virtual machines that are already in the system by using a different sub-command list:

$ vboxmanage List VMS

"XP" {8842d793-228c-458e-a880-8051193fd2db}

I have installed a virtual machine called XP on my system, and the inside of the parentheses is its UUID.

The vboxmanage STARTVM subcommand can specify how to start with the –type parameter, where the GUI is the graphical interface, which is the same way we normally start.

SDL is also a graphical interface, but there are fewer features, such as no menus and so on, which are generally used in the debugging process. Finally headless is run in the background, and the VRDP service is turned on by default and can be accessed through Remote Desktop tools.

The introduction to these three start-up methods can be seen in this article in the manual. So we usually start with a GUI or headless type.

To start a virtual machine using the GUI type:
$ vboxmanage STARTVM XP--type GUI

When execution is complete, the specified virtual machine is started and is almost indistinguishable from normal.

To start a virtual machine using the Headless type:


$ vboxmanage STARTVM "XP"--type headless

Or

$ vboxheadless--STARTVM "XP"

Results returned:


$ rdesktop-a 16-n-G 1280x800 127.0.0.1:3389


autoselected keyboard map en-US


ERROR:connect:Connection refused



Turned down the manual, the results found to get VRDP support also need to install additional expansion packs, detailed instructions can refer to here.

Select the appropriate version to download the extension package from the VirtualBox download page. When the download is complete, double-click to complete the installation, or file-preference-extensions in the menu to install and view the installed expansion packs.

Install again to execute the above remote command, this can see the virtual machine interface.

You can toggle fullscreen through Ctrl+alt+enter. But I use rdesktop here full screen, the screen will be black, only the point of the place will be restored.

I do not know what the reason, I simply use TIGERVNC, while starting headless with the-n parameter {$ vboxheadless-n-s WinXP (vboxheadless-s winxp--vnc--vncport 5900--v Ncpass password)}, connect remotely using the following command:

$ vncviewer localhost:5900

Pressing F8 will show a menu with the ability to toggle fullscreen.

All the relevant commands:
$ vboxmanage List Runningvms # List of running virtual machines


$ vboxmanage CONTROLVM XP Acpipowerbutton # shutdown virtual machine, equivalent to click the System Close button, normal shutdown


$ vboxmanage CONTROLVM XP Poweroff # shutdown virtual machine, equivalent to direct power off, non-normal shutdown


$ vboxmanage CONTROLVM XP Pause # Pauses the running of a virtual machine


$ vboxmanage CONTROLVM XP Resume # to resume a paused virtual machine


$ vboxmanage CONTROLVM XP SaveState # Save the current virtual machine's running state

Reprint: Start a VirtualBox virtual machine using the command line

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.