VirtualBox : Create Virtual Machine2019/12/18 |
Create a Virtual Machine.
On this example, create VM to install CentOS 8. |
|
[1] | Create a Virtual Machine. |
# create a VM [root@dlp ~]# VBoxManage createvm \ --name CentOS_8 \ --ostype RedHat_64 \ --register \ --basefolder /var/vbox Virtual machine 'CentOS_8' is created and registered. UUID: 0f0cd83e-ce0d-4445-904e-70ece8dbdf5a Settings file: '/var/vbox/CentOS_8/CentOS_8.vbox' # modify settings for VM # replace interface name [enp1s0] to your own environment [root@dlp ~]# VBoxManage modifyvm CentOS_8 \
--cpus 4 \ --memory 4096 \ --nic1 bridged \ --bridgeadapter1 enp1s0 \ --boot1 dvd \ --vrde on \ --vrdeport 5001 # configure storage for VM [root@dlp ~]# VBoxManage storagectl CentOS_8 --name "CentOS_8_SATA" --add sata [root@dlp ~]# VBoxManage createhd \ --filename /var/vbox/CentOS_8/CentOS_8.vdi \ --size 20480 \ --format VDI \ --variant Standard 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Medium created. UUID: c19f8675-f169-4eea-8776-4e30925c6a35
[root@dlp ~]#
VBoxManage storageattach CentOS_8 \
--storagectl CentOS_8_SATA \ --port 1 \ --type hdd \ --medium /var/vbox/CentOS_8/CentOS_8.vdi # configure DVD drive for VM # example below, it specifies an ISO file for installation [root@dlp ~]# VBoxManage storageattach CentOS_8 \
--storagectl CentOS_8_SATA \ --port 0 \ --type dvddrive \ --medium /tmp/CentOS-8-x86_64-1905-dvd1.iso # confirm settings for VM [root@dlp ~]# VBoxManage showvminfo CentOS_8 Name: CentOS_8 Groups: / Guest OS: Red Hat (64-bit) UUID: 0f0cd83e-ce0d-4445-904e-70ece8dbdf5a Config file: /var/vbox/CentOS_8/CentOS_8.vbox Snapshot folder: /var/vbox/CentOS_8/Snapshots Log folder: /var/vbox/CentOS_8/Logs Hardware UUID: 0f0cd83e-ce0d-4445-904e-70ece8dbdf5a 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_8 --storagectl CentOS_8_SATA --port 0 --device 0 --medium none |
[2] | Start a Virtual Machine. |
[root@dlp ~]# VBoxManage startvm CentOS_8 --type headless Waiting for VM "CentOS_8" to power on... VM "CentOS_8" has been successfully started. |
[3] | If Firewalld is running, allow ports you set for VRDE port or plan to use for it. (on this example, it's [5001] port) |
[root@dlp ~]# firewall-cmd --add-port=5000-5010/tcp --permanent success [root@dlp ~]# firewall-cmd --reload success |
[4] | On enabling 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 |