Install VirtualBox Guest Addition in Ubuntu

First from virtual machine menu, click Devices and click on Insert Guest Addition CD Image. This process will add guest addition CD inside VM.

Bring terminal and run below,

sudo apt update
sudo apt install build-essential dkms linux-headers-$(uname -r)

Then brows into the CD from GUI interface and right click somewhere in the CD and click open terminal here. This bring Terminal within CD

then simply run,

sudo su

./ --nox11

You will need to reboot VM.