The command that controls a lot of automation that comes with VirtualBox software is called: vboxmanage. This article show how to use it in Centos/RHEL to automatically start your VM on boot.
vboxmanage list vms
This will list the names of all VMs you have.
If you have many VMs and want to list just the one you’re currently running, use:
vboxmanage list runningvms
Capture the name of your VM.
Following is the command to start VM of your choice from the Linux shell, in a headless state:
vboxmanage startvm NAMEOFYOURVM --type headless
Result from the terminal would look something like this:
Now you can create your own SH script to run your VM on boot.
Btw. command to shutdown VM is this:
VBoxManage controlvm NAMEOFYOURVM savestate
This will stop your VM by “hibernating” it. This is a recommended way of turning off the VM machine, as hibernating prevents the data loss.