VirtualBox : Create Virtual Machines2024/05/10 |
Create a Virtual Machine. |
|
[1] | Create a Virtual Machine. |
# create a VM root@dlp:~# VBoxManage createvm \ --name Ubuntu_2404 \ --ostype Ubuntu_64 \ --register \ --basefolder /var/vbox Virtual machine 'Ubuntu_2404' is created and registered. UUID: 3c33d3b4-329f-4691-95f5-e05d7f419154 Settings file: '/var/vbox/Ubuntu_2404/Ubuntu_2404.vbox' # modify settings for VM # replace interface name [ens33] to your own environment root@dlp:~# VBoxManage modifyvm Ubuntu_2404 \
--cpus 4 \ --memory 8192 \ --nic1 nat \ --boot1 dvd \ --vrde on \ --vrdeport 5001 # configure storage for VM root@dlp:~# VBoxManage storagectl Ubuntu_2404 --name "Ubuntu_2404_SATA" --add sata root@dlp:~# VBoxManage createhd \ --filename /var/vbox/Ubuntu_2404/Ubuntu_2404.vdi \ --size 20480 \ --format VDI \ --variant Standard 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Medium created. UUID: 229cbe70-62e3-4232-86c7-4406aa58b083 root@dlp:~# VBoxManage storageattach Ubuntu_2404 \
--storagectl Ubuntu_2404_SATA \ --port 1 \ --type hdd \ --medium /var/vbox/Ubuntu_2404/Ubuntu_2404.vdi # configure DVD drive for VM # example below, it specifies an ISO file for installation root@dlp:~# VBoxManage storageattach Ubuntu_2404 \
--storagectl Ubuntu_2404_SATA \ --port 0 \ --type dvddrive \ --medium /home/ubuntu-24.04-live-server-amd64.iso # confirm settings for VM root@dlp:~# VBoxManage showvminfo Ubuntu_2404 Name: Ubuntu_2404 Encryption: disabled Groups: / Guest OS: Ubuntu (64-bit) UUID: 3c33d3b4-329f-4691-95f5-e05d7f419154 Config file: /var/vbox/Ubuntu_2404/Ubuntu_2404.vbox Snapshot folder: /var/vbox/Ubuntu_2404/Snapshots Log folder: /var/vbox/Ubuntu_2404/Logs Hardware UUID: 3c33d3b4-329f-4691-95f5-e05d7f419154 Memory size: 8192MB Page Fusion: disabled VRAM size: 8MB CPU exec cap: 100% HPET: disabled CPUProfile: host Chipset: piix3 Firmware: BIOS Number of CPUs: 4 PAE: enabled Long Mode: enabled Triple Fault Reset: disabled APIC: enabled X2APIC: enabled Nested VT-x/AMD-V: disabled CPUID Portability Level: 0 CPUID overrides: None Boot menu mode: message and menu Boot Device 1: DVD Boot Device 2: DVD Boot Device 3: HardDisk Boot Device 4: Not Assigned ACPI: enabled IOAPIC: enabled BIOS APIC mode: APIC ..... ..... # * if detach DVD, run like follows root@dlp:~# VBoxManage storageattach Ubuntu_2404 --storagectl Ubuntu_2404_SATA --port 0 --device 0 --medium none |
[2] | Start a Virtual Machine. |
root@dlp:~#
VBoxManage startvm Ubuntu_2404 --type headless Waiting for VM "Ubuntu_2404" to power on... VM "Ubuntu_2404" has been successfully started. # * if stop VM, run like follows root@dlp:~# VBoxManage controlvm Ubuntu_2404 poweroff # * if remove VM, run like follows root@dlp:~# VBoxManage unregistervm Ubuntu_2404 |
[3] | On enabling VRDP environment by installing VirtualBox extension pack,
it's possible to connect to VM with RDP. The example below is on Windows 11. Run Remote Desktop Client and specify [(VirtualBox Server's Hostname or IP address):(vrdeport set for the VM)] to connect to VM. |
[4] | After connected successfully, VM console is shown. |
[5] | Installation finished and Virtual Machine is running normally. |
Sponsored Link |