VirtualBox : Create Virtual Machine2022/12/09 |
Create a Virtual Machine.
On this example, create VM to install CentOS Stream 9. |
|
[1] | Create a Virtual Machine. |
# create a VM [root@dlp ~]# VBoxManage createvm \ --name CentOS_ST9 \ --ostype RedHat9_64 \ --register \ --basefolder /var/vbox Virtual machine 'CentOS_ST9' is created and registered. UUID: a8220e2f-6ff1-4983-bcea-58fba92c06be Settings file: '/var/vbox/CentOS_ST9/CentOS_ST9.vbox' # modify settings for VM [root@dlp ~]# VBoxManage modifyvm CentOS_ST9 \
--cpus 4 \ --memory 4096 \ --nic1 nat \ --boot1 dvd \ --vrde on \ --vrdeport 5001 # configure graphics controller for VM [root@dlp ~]# VBoxManage modifyvm CentOS_ST9 --graphicscontroller vmsvga # configure storage for VM [root@dlp ~]# VBoxManage storagectl CentOS_ST9 --name "CentOS_ST9_SATA" --add sata [root@dlp ~]# VBoxManage createhd \ --filename /var/vbox/CentOS_ST9/CentOS_ST9.vdi \ --size 20480 \ --format VDI \ --variant Standard 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Medium created. UUID: b5b255e1-94d7-4f40-8d89-768b60746975
[root@dlp ~]#
VBoxManage storageattach CentOS_ST9 \
--storagectl CentOS_ST9_SATA \ --port 1 \ --type hdd \ --medium /var/vbox/CentOS_ST9/CentOS_ST9.vdi # configure DVD drive for VM # example below, it specifies an ISO file for installation [root@dlp ~]# VBoxManage storageattach CentOS_ST9 \
--storagectl CentOS_ST9_SATA \ --port 0 \ --type dvddrive \ --medium /home/CentOS-Stream-9-latest-x86_64-dvd1.iso # confirm settings for VM [root@dlp ~]# VBoxManage showvminfo CentOS_ST9 Name: CentOS_ST9 Encryption: disabled Groups: / Guest OS: Red Hat 9.x (64-bit) UUID: a8220e2f-6ff1-4983-bcea-58fba92c06be Config file: /var/vbox/CentOS_ST9/CentOS_ST9.vbox Snapshot folder: /var/vbox/CentOS_ST9/Snapshots Log folder: /var/vbox/CentOS_ST9/Logs Hardware UUID: a8220e2f-6ff1-4983-bcea-58fba92c06be Memory size: 4096MB 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 ..... ..... # * if dettach DVD, run like follows [root@dlp ~]# VBoxManage storageattach CentOS_ST9 --storagectl CentOS_ST9_SATA --port 0 --device 0 --medium none |
[2] | Start a Virtual Machine. |
[root@dlp ~]#
VBoxManage startvm CentOS_ST9 --type headless Waiting for VM "CentOS_ST9" to power on... VM "CentOS_ST9" has been successfully started. # * if stop VM, run like follows [root@dlp ~]# VBoxManage controlvm CentOS_ST9 poweroff
# * if remove VM, run like follows [root@dlp ~]# VBoxManage unregistervm CentOS_ST9
|
[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 |
|