Virtualbox workshop settings

Source: Internet
Author: User

Virtualbox has a problem, that is, if the user sessions are different, different startup results will still be seen, and virtual machines (via) started by different sessions cannot be managed for each other ). This is a cup of cake. Sometimes, several virtual machines are started, but one of them is dead. How do I know which one should end the process from the task manager of the host ???
Another problem is that the network is NAT by default, which is flexible and convenient, and port forwarding is very practical. However, there is a fatal injury, that is, memory overflow, virtual machine disconnection, and even process crash in the case of heavy traffic and multiple connections.
I have seen several recent updates of changelog to improve NAT, So I uninstalled the original Virualbox, restarted it, installed the new version, and restarted it. Then open the VM, uninstall Virtualbox Guest Addtion, restart, install the new version, and restart. So far, update from external to internal is complete.
Then, start the formal configuration.
Synchronize global Virtualbox settings
We know that the default Virtualbox Settings vary with users and are generally stored in the "C: \ Documents ents and Settings \ USERNAME \. Virtualbox" folder. You can set the setting file to be stored in a unified manner: create the "VBOX_USER_HOME" variable and enter the setting directory.
Virtual machines are started as services ()
Download srvstart and save the following content as srvstart. ini. For example, save it in the root directory of drive D:
Env = VBOXHEADLESS = "C: \ Program Files \ Oracle \ VirtualBox \ vboxheadless.exe"
Env = VBOXMANAGE = "C: \ Program Files \ Oracle \ VirtualBox \ VBoxManage.exe"
Debug = 0
Debug_out => D: \ soft \ vbox \ srvstart. log
Wait_time = 60
[Win2003]
Startup = % VBOXHEADLESS %-startvm Win2003
Shutdown_method = command
Shutdown = % VBOXMANAGE % controlvm Win2003 poweroff
[VMWinXP]
Startup = % VBOXHEADLESS %-startvm WinXP
Shutdown_method = command
Shutdown = % VBOXMANAGE % controlvm WinXP poweroff
Run the following command to install WinXP in the system to serve VMWinXP:
Srvstart install_desktop VMWinXP-c d: \ srvstart. ini
Similarly, the Win2003 in the installation is for system services:
Srvstart install_desktop Win2003-c d: \ srvstart. ini
Of course, you can use the system command SC to create a system service, but pay attention to two points:
In SC, there must be a space after the equal sign of the parameter, such as "binPath =", followed by a space. It hurts a lot.
You must enable desktop interaction for Virtualbox services. Otherwise, an error occurs.
WEB management Virtualbox:
Different sessions of the same user may cause the status of the virtual machine to be not synchronized, and the desktop interaction must be enabled for starting the Service. Therefore, we can only start the Service using the default Local Service Identity. The default authentication method for Virtualbox web service is user authentication, so we need to cancel the verification first:
VBoxManage setproperty websrvauthlibrary null
Set the Virtualbox web api as a service or use the srvstart tool. Edit the srvstart. ini file and add the following content at the end:
[VboxWebSrv]
Startup = % VBOX_INSTALL_PATH % \ VboxWebSrv-threads = 20
Shutdown_method = kill
And install it as the "VboxWebSrv" service:
Srvstart install_desktop VboxWebSrv-c d: \ srvstart. ini
Go to the source code of the SVN "phpvirtualbox" project, which is the web gui of Virtualbox. Install it like installing a PHP program. Pay attention to the SOAP extension and leave the username and password of config. php empty.
Start the "VboxWebSrv" service and access the "phpvirtualbox" you just installed. You should see the normal Virtualbox simulation panel. You can use web control. Most importantly, it solves the problem that virtual machines with different sessions have different statuses.
Pay attention to the following two points:
VboxWebSrv uses port 18083 of 127.0.0.1 by default. Ensure that the firewall is allowed. Because verification is canceled, we recommend that you only listen to the local 127.0.0.1 (default)
Phpvirtualbox itself does not have a verification mechanism, that is to say, the web control side of Virtualbox can be publicly accessed, so it is necessary to add web-based authentication. Apache can be solved with. htpasswd. See http://blog.creke.net/273.html.
Port ing and port forwarding (via) in NAT)
VBoxManage modifyvm "VM name"-natpf1 "guestssh, tcp, host ip, 2222, guest ip, 22"
Command explanation:
As before, we can see the familiar VBoxManage. Next to it is the modifyvm, which is different from the commands of previous versions. Then, replace the Virtual Machine NAME with the corresponding virtual machine NAME. Next, we will focus on the NAT port ing parameters.
1. natpf1 we can easily understand this parameter. natpf is short for nat port forwarding. Followed by the number of the corresponding Nic In the virtual machine settings. If your Nic is the first, it is 1.
2. parameters after natpf
(1) guestssh is the name of the port ing. You can change it to a name that is easy to understand. If this parameter is set, it will be automatically generated.
(2) tcp (or udp) is the ing protocol.
(3) The host ip address is the ip address of your host. If this parameter is left blank, the host ip address is mapped to the corresponding port on all the ip addresses of the host.
(4) host port 2222 (host port.
(5) The ip address in the guest ip Virtual Machine. Obviously, if this parameter is left blank, the ip address is mapped to the corresponding port on all ip addresses in the virtual machine.
(6) 22 (guest port) Virtual Machine port, select + 1.
To delete a port ing, enter the following command:
VBoxManage modifyvm "VM name"-natpf1 delete "guestssh"
Clear and compress Virtualbox Disk Images
You can use the modifyhd compact parameter in the VBoxManage command. Windows virtual machines can use Microsoft's official SDelete tool to clear disks.
For detailed steps and principles, see Vboxmanage-modifyvdi in the official User Guide of Virtualbox.

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.