1. Install extension pack
Check the version number:
1 | vboxmanage |more |
For example, I am 6.1.38-153438
, just in
http://download.virtualbox.org/virtualbox/
Find the corresponding version, download, install, and enable:
1 | cd ~ mkdir virtualbox cd virtualbox wget http://download.virtualbox.org/virtualbox/6.1.38/Oracle_VM_VirtualBox_Extension_Pack-6.1.38-153438.vbox-extpack vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.38-153438.vbox-extpack vboxmanage list extpacks vboxmanage setproperty vrdeextpack "Oracle VM VirtualBox Extension Pack" |
2, virtual disk
execute first
1 | vboxmanage list ostypes |
Check the code of each operating system, for example, Windows Server 2019
is Windows2019_64
.
Create a Windows Server 2019 virtual machine, create a 40GB virtual disk, and bind the controller:
1 | # create a virtual machine vboxmanage createvm --name win2019 --ostype "Windows2019_64" --register # create disk vboxmanage create medium disk --filename win-1.vdi --size 40960 vboxmanage storagectl win2019 --name "SATA Controller" --add sata --controller IntelAHCI vboxmanage storagectl win2019 --name "IDE Controller" --add ide vboxmanage storageattach win2019 --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium win-1.vdi |
3, ISO image
First download the Windows image:
Windows Server ISO image
https://blog.tsinbei.com/archives/893/
The download speed is very fast, no matter domestic or foreign, the speed is stable at 15MB/s.
Taking Windows Server 2019 Essentials as an example, the image is renamed to 2019_es.iso
:
1 | # Bind to DVD vboxmanage storageattach win2019 --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium "2019_es.iso" # set disk item vboxmanage modifyvm win2019 --boot1 disk --boot2 dvd --boot3 none --boot4 none |
4, boot
Install the graphics card management tool:
1 | yum install pciutils |
View video memory:
1 | lspci | grep -i vga |
Write down the output address in the form 00:0x.0
, execute:
1 | lspci -v -s 00:0x.0 |
You can check the memory size, for example, it is 32M for me.
First set to 4-core CPU, 4GB running memory, 16M video memory, and other settings:
1 | vboxmanage modifyvm win2019 --cpus 4 --memory 4096 --vram 16 --hwvirtex on vboxmanage modifyvm win2019 --ioapic on |
Set the remote connection port to 33389 (the default is 3389, it may be already occupied)
1 | vboxmanage modifyvm win2019 --vrde on --vrdeport 33389 vboxmanage startvm win2019 --type=headless |
Then you can use the remote desktop connection of the computer through IP:33389
, connect to the server, and install the system.
After the system is installed, user extensions can be installed:
1 | wget http://download.virtualbox.org/virtualbox/6.1.38/VBoxGuestAdditions_6.1.38.iso vboxmanage storageattach win2019 --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium "VBoxGuestAdditions_6.1.38.iso" |
After starting, click this DVD in the resource manager, click the corresponding system architecture installation package, restart Windows after the installation is complete, and the problem of two cursors appearing in the (possible) remote desktop connection can be solved.
5, port mapping
After the system is installed, Windows Server enables remote desktop by default, while Windows 7/8/8.1/10/11 needs to enable remote desktop in the control panel/settings.
implement:
1 | VBoxManage modifyvm "win2019" --natpf1 "mstsc, tcp,,23389,,3389" |
Map port 3389 of Windows to port 23389 of the host.
6, other operations
can use
1 | vboxmanage controlvm win2019 poweroff |
Shutdown, but it is recommended to click "Shutdown" in the virtual machine.
After configuring the remote desktop, for safety, you can close VRDE:
1 | VBoxManage modifyvm win2019 --vrde off |
Virtual Box (2) Add and Manage VMs
Comments