Is here is the guide.
FIrst of all go to Virtualbox site. Click downloads and download
.deb. (as you know Elementary OS is ubuntu based system).
Next step is open terminal and install virtual box as follows
cd Downloads sudo apt install ./virtualbox-6.1_6.1.26-145957\~Ubuntu\~eoan_amd64.deb # use filename of your downloaded deb file
Done? No. I go into errors about that the my OS was not configured to build headers so i had to installed them manually:
sudo apt search linux-headers-$(uname -r)
vboxconfig to configure your virtualbox.
One more step is needed. Install guest extensions. so:
Install extension pack from Virtualbox downloads. I have got USB 2.0 errors until installed.
Thats all. You can now download virtual machine or install your own from ISO file.
Have a nice day!