Ubuntu 21.04
Sponsored Link

VirtualBox : Create Virtual Machines2021/05/21

 
Create a Virtual Machine.
On this example, create a VM to install Ubuntu 21.04.
[1] Create a Virtual Machine.
# create a directory for VM

root@dlp:~#
mkdir /var/vbox
# create a VM

root@dlp:~# VBoxManage createvm \
--name Ubuntu_2104 \
--ostype Ubuntu_64 \
--register \
--basefolder /var/vbox 
Virtual machine 'Ubuntu_2104' is created and registered.
UUID: 77ff8d8e-92e8-4abe-b56e-03eed220d7b8
Settings file: '/var/vbox/Ubuntu_2104/Ubuntu_2104.vbox'

# modify settings for VM
# replace interface name [enp1s0] to your own environment
root@dlp:~# VBoxManage modifyvm Ubuntu_2104 \
--cpus 4 \
--memory 4096 \
--nic1 bridged \
--bridgeadapter1 enp1s0 \
--boot1 dvd \
--vrde on \
--vrdeport 5001 

# configure storage for VM
root@dlp:~# VBoxManage storagectl Ubuntu_2104 --name "Ubuntu_2104_SATA" --add sata 
root@dlp:~# VBoxManage createhd \
--filename /var/vbox/Ubuntu_2104/Ubuntu_2104.vdi \
--size 20480 \
--format VDI \
--variant Standard 
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: 6f496713-0bbb-4b3b-91a3-4c541e6e5322

root@dlp:~# VBoxManage storageattach Ubuntu_2104 \
--storagectl Ubuntu_2104_SATA \
--port 1 \
--type hdd \
--medium /var/vbox/Ubuntu_2104/Ubuntu_2104.vdi 

# configure DVD drive for VM
# example below, it specifies an ISO file for installation
root@dlp:~# VBoxManage storageattach Ubuntu_2104 \
--storagectl Ubuntu_2104_SATA \
--port 0 \
--type dvddrive \
--medium /home/ubuntu-21.04-live-server-amd64.iso 

# confirm settings for VM
root@dlp:~# VBoxManage showvminfo Ubuntu_2104 
Name:                        Ubuntu_2104
Groups:                      /
Guest OS:                    Ubuntu (64-bit)
UUID:                        77ff8d8e-92e8-4abe-b56e-03eed220d7b8
Config file:                 /var/vbox/Ubuntu_2104/Ubuntu_2104.vbox
Snapshot folder:             /var/vbox/Ubuntu_2104/Snapshots
Log folder:                  /var/vbox/Ubuntu_2104/Logs
Hardware UUID:               77ff8d8e-92e8-4abe-b56e-03eed220d7b8
Memory size                  4096MB
Page Fusion:                 disabled
VRAM size:                   8MB
CPU exec cap:                100%
HPET:                        disabled
CPUProfile:                  host
.....
.....


# * if dettach DVD, run like follows
root@dlp:~# VBoxManage storageattach Ubuntu_2104 --storagectl Ubuntu_2104_SATA --port 0 --device 0 --medium none 

# * if shutdown VM, run like follows
root@dlp:~# VBoxManage controlvm Ubuntu_2104 acpipowerbutton 

# * if poweroff VM, run like follows
root@dlp:~# VBoxManage controlvm Ubuntu_2104 poweroff 
[2] Start a Virtual Machine.
root@dlp:~#
VBoxManage startvm Ubuntu_2104 --type headless

Waiting for VM "Ubuntu_2104" to power on...
VM "Ubuntu_2104" has been successfully started.
[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 10.
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.
Matched Content