VirtualBox : Create Virtual Machine2025/08/07 |
|
Create a Virtual Machine. |
|
| [1] | Create a Virtual Machine. |
# create a VM # for [ostype], you can see the list with [VBoxManage list ostypes] [root@dlp ~]# VBoxManage createvm \ --name CentOS_10 \ --ostype RedHat_64 \ --register \ --basefolder /var/vbox Virtual machine 'CentOS_10' is created and registered. UUID: 3111eb19-c0df-43be-94bb-84f617b6e4d4 Settings file: '/var/vbox/CentOS_10/CentOS_10.vbox' # modify settings for VM # change the NIC name [enp1s0] to yours [root@dlp ~]# VBoxManage modifyvm CentOS_10 \ --cpus 4 \ --memory 4096 \ --nic1 bridged \ --bridgeadapter1 enp1s0 \ --boot1 dvd \ --vrde on \ --vrdeport 5001 # configure graphics controller for VM [root@dlp ~]# VBoxManage modifyvm CentOS_10 --graphicscontroller vmsvga # configure storage for VM [root@dlp ~]# VBoxManage storagectl CentOS_10 --name "CentOS_10_SATA" --add sata [root@dlp ~]# VBoxManage createhd \ --filename /var/vbox/CentOS_10/CentOS_10.vdi \ --size 20480 \ --format VDI \ --variant Standard 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Medium created. UUID: 51cbb2e0-a486-4241-b382-dee5645869de [root@dlp ~]# VBoxManage storageattach CentOS_10 \ --storagectl CentOS_10_SATA \ --port 1 \ --type hdd \ --medium /var/vbox/CentOS_10/CentOS_10.vdi # configure DVD drive for VM # example below, it specifies an ISO file for installation [root@dlp ~]# VBoxManage storageattach CentOS_10 \ --storagectl CentOS_10_SATA \ --port 0 \ --type dvddrive \ --medium /home/CentOS-Stream-10-latest-x86_64-dvd1.iso # confirm settings for VM [root@dlp ~]# VBoxManage showvminfo CentOS_10 Name: CentOS_10 Encryption: disabled Groups: / Platform Architecture: x86 Guest OS: Red Hat (64-bit) UUID: 3111eb19-c0df-43be-94bb-84f617b6e4d4 Config file: /var/vbox/CentOS_10/CentOS_10.vbox Snapshot folder: /var/vbox/CentOS_10/Snapshots Log folder: /var/vbox/CentOS_10/Logs Hardware UUID: 3111eb19-c0df-43be-94bb-84f617b6e4d4 Memory size: 4096MB Page Fusion: disabled VRAM size: 8MB CPU exec cap: 100% CPUProfile: host Chipset: piix3 Firmware: BIOS Number of CPUs: 4 HPET: disabled PAE: enabled Long Mode: enabled Triple Fault Reset: disabled APIC: enabled X2APIC: enabled Nested VT-x/AMD-V: disabled CPUID overrides: None Hardware Virtualization: enabled Nested Paging: enabled Large Pages: disabled VT-x VPID: enabled VT-x Unrestricted Exec.: enabled AMD-V Virt. Vmsave/Vmload: enabled CPUID Portability Level: 0 ..... ..... # * if dettach DVD, run like follows [root@dlp ~]# VBoxManage storageattach CentOS_10 --storagectl CentOS_10_SATA --port 0 --device 0 --medium none |
| [2] | Start a Virtual Machine. |
|
[root@dlp ~]#
VBoxManage startvm CentOS_10 --type headless Waiting for VM "CentOS_10" to power on... VM "CentOS_10" has been successfully started. # * if stop VM, run like follows [root@dlp ~]# VBoxManage controlvm CentOS_10 poweroff
# * if remove VM, run like follows [root@dlp ~]# VBoxManage unregistervm CentOS_10
|
| [3] | If Firewalld is running, allow ports you set for VRDE port or plan to use for it. (it's [5001] port on this example) |
|
[root@dlp ~]# firewall-cmd --add-port=5000-5010/tcp success [root@dlp ~]# firewall-cmd --runtime-to-permanent success |
| [4] | On VRDP enabled VRDP Virtual Machine, it's possible to connect 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. |
|
| [5] | After connected successfully, VM console is shown. |
|
| [6] | Installation finished and Virtual Machine is running normally. |
|
| Sponsored Link |
|
|