VirtualBox install guest additions ubuntu command line guideCodeTryout provides version specific articles to install VirtualBox guest additions installation steps. vbox guest additions Ubuntu 22.04 and vbox guest additions Ubuntu 20.04. Please choose the article according to your Ubuntu version.
This is a quick installation guide for installing VirtualBox Guest Addition ( Oracle VirtualBox extension pack ) on Ubuntu 22.04 VirtualBox VM.
What are VirtualBox Guest addition packages?
VirtualBox guest additions are software tools installed in the guest VM after the OS has been installed. They consist of device drivers and system applications that improve the guest VM performance and usability. They enable features such as drag and drop, shared folders, changing screen resolutions, copy-paste clipboards, automated logins, and so on. Please refer to the complete guide here: https://www.virtualbox.org/manual/ch04.html
Step #1: Preparing your Ubuntu VM with the required packages
Firstly, you would need to install some dependency packages:
Install all those pre-requisites using the single command below,
sudo apt-get install gcc make perl
Enter your user password and give y when prompted for confirmation to continue.
Step #2: Insert the guest addition CD image
You can do this virtually from your VirtualBox VM window. Go to Devices Menu and Click on Insert the guest addition CD image (.iso). This will mount the VirtualBox guest addition Virtual CD Disk to your Ubuntu Guest OS.
Step #3 Running the installer
- Open a command-line terminal
- Run the command sudo su –
- Enter the password when prompted
- Run the command: bash /media/YOUR-USERNAME/VBox_*/VBoxLinuxAdditions.run (given below)
- After installation, reboot the system.
# Run it as root user # # sudo su - # # Replace YOUR-USERNAME with your ubuntu login name # bash /media/YOUR-USERNAME/VBox_*/VBoxLinuxAdditions.run
If you are unsure of the path mentioned above, try the command: df -kh | grep VBox
In this case, your script path would be:
Reboot your system to make these changes in effect.
Step #4 Verifying whether the VBox addition is installed successfully.
As a final step or to troubleshoot, you can verify whether your VBox addition steps were successful by running the following command
lsmod | grep vbox
A successful installation would display the output of the command as shown here:
VirtualBox Guest Addition features
You have successfully installed the guest addition software. With this, you will have some handy features like:
- Enabling Shared-Clipboard – copy-paste between guest and host ( Detailed guide to enable copy paste )
- Enable Drag and Drop – you would be able to drag and drop files between guest and host
- Set custom screen resolution for the Ubuntu Guest (shown in the below image)
This guide has covered the steps to install VirtualBox Guest Addition on your guest machine. Please note that these steps have been tested on Ubuntu 22.04 and should also work for previous Ubuntu distributions.
This guide covered steps to install guest additions in a VirtualBox Virtual Machine running Ubuntu 22.04. Once you have installed the guest addition packages, you will have all of the additional features VirtualBox provides.
FAQ: Installing guest addition on VirtualBox Ubuntu Desktop
All these steps will work on the Ubuntu command line, tested using Ubuntu-22.04-desktop-amd64
FAQ: Installing guest addition on VirtualBox Ubuntu Server
VirtualBox Ubuntu server installation may not require guest additions; if you need them for any specific reason, the steps given above should work.
FAQ: Installing guest additions in older versions of Ubuntu, such as Ubuntu 20.04?
Codetryout has another page explaining the steps required for VirtualBox guest additions on Ubuntu 20.04 VM
FAQ: How to enable Clipboard copy-pastes between Virtualbox Host and guests?
We have an experiment explaining this, please refer to How to enable copy-pastes in Virtualbox Ubuntu VM
FAQ: How do enable files or folders copy-pastes between Virtualbox Host and guests?
Yet again, we have another experiment explaining this. Please refer to the guide: How to enable files to drag and drop in a VirtualBox running Ubuntu Linux?
FAQ: What are the latest changes and features added to VBox Guest addition packages?
You can check this page for the detailed changelog: VirtualBox User Manuel – ChangeLog
Related: How to install Ubuntu 22.04 VM using the VirtualBox 7 unattended method