VirtualBox : Create Virtual Machine2021/06/09 |
Create a Virtual Machine.
On this example, create VM to install CentOS Stream 8. |
|
[1] | Create a Virtual Machine. |
# create a VM [root@dlp ~]# VBoxManage createvm \ --name CentOS_ST8 \ --ostype RedHat_64 \ --register \ --basefolder /var/vbox Virtual machine 'CentOS_ST8' is created and registered. UUID: f3f8f308-1f6a-4005-a1a3-9a2a8a0b903f Settings file: '/var/vbox/CentOS_ST8/CentOS_ST8.vbox' # modify settings for VM # replace interface name [enp1s0] to your own environment [root@dlp ~]# VBoxManage modifyvm CentOS_ST8 \
--cpus 4 \ --memory 4096 \ --nic1 bridged \ --bridgeadapter1 enp1s0 \ --boot1 dvd \ --vrde on \ --vrdeport 5001 # configure storage for VM [root@dlp ~]# VBoxManage storagectl CentOS_ST8 --name "CentOS_ST8_SATA" --add sata [root@dlp ~]# VBoxManage createhd \ --filename /var/vbox/CentOS_ST8/CentOS_ST8.vdi \ --size 20480 \ --format VDI \ --variant Standard 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Medium created. UUID: b68f9789-7207-4ade-a926-5258480ce83b
[root@dlp ~]#
VBoxManage storageattach CentOS_ST8 \
--storagectl CentOS_ST8_SATA \ --port 1 \ --type hdd \ --medium /var/vbox/CentOS_ST8/CentOS_ST8.vdi # configure DVD drive for VM # example below, it specifies an ISO file for installation [root@dlp ~]# VBoxManage storageattach CentOS_ST8 \
--storagectl CentOS_ST8_SATA \ --port 0 \ --type dvddrive \ --medium /home/CentOS-Stream-8-x86_64-20201203-dvd1.iso # confirm settings for VM [root@dlp ~]# VBoxManage showvminfo CentOS_ST8 Name: CentOS_ST8 Groups: / Guest OS: Red Hat (64-bit) UUID: f3f8f308-1f6a-4005-a1a3-9a2a8a0b903f Config file: /var/vbox/CentOS_ST8/CentOS_ST8.vbox Snapshot folder: /var/vbox/CentOS_ST8/Snapshots Log folder: /var/vbox/CentOS_ST8/Logs Hardware UUID: f3f8f308-1f6a-4005-a1a3-9a2a8a0b903f 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_ST8 --storagectl CentOS_ST8_SATA --port 0 --device 0 --medium none |
[2] | Start a Virtual Machine. |
[root@dlp ~]#
VBoxManage startvm CentOS_ST8 --type headless Waiting for VM "CentOS_ST8" to power on... VM "CentOS_ST8" has been successfully started. # * if stop VM, run like follows [root@dlp ~]# VBoxManage controlvm CentOS_ST8 poweroff
# * if remove VM, run like follows [root@dlp ~]# VBoxManage unregistervm CentOS_ST8
|
[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 --permanent success [root@dlp ~]# firewall-cmd --reload success |
[4] | On enabled VRDP environment, it's possible to connect with RDP. The example below is on Windows 10. 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 |