Here is how i installed Virtual Box guest additions to my Debian Virtual Machine. This is in a bigger project so i can produce my own Vagrant boxes with any operating system i want. Also this is a good practice when a new Virtual Machine is installed.
First of all start you Vm from the Virtualbox GUI.
Once the Vm has sarted, click on the menu “devices” present on the running Vm window, and select “Install Guest Additions…”.
You have to be root in order to mount a device. To mount the new cdrom image type:
# mount /media/cdrom
And if you navigate to the directory :
As you can see, several files are present, but one is the right one to be installed. In my case the file is VBoxLinuxAdditions.run.
But if you try to run it using its filename, it will fail because of the permission (root cannot execute). So to workaround this, you just lauch the shell first and then feed it with this file, like the following example:
This commad should work.
During the install process, some modules must be built and for this reason there are some prerequisites you should satisfy before proceed.
For this reason we need to install the packages present in the following command:
sudo apt-get install linux-headers-$(uname -r) build-essential
And after installing these packages, is possible to run the VBoxLinuxAddition installer with the following commands:
# mount /dev/cdrom /media/cdrom # sh /media/cdrom/VBoxLinuxAdditions.run
One of the errors you can face with is the complains about missing Xorg. If you are running a headless server, of course there is no xorg.