FUNDAMENTALS A Complete Guide for Beginners
VirtualBox Guest Additions are a set of drivers and utilities that enhance the interaction and integration between the host and guest operating systems. For instance, if you are using CentOS (an open-source Linux distribution built from the same sources as Red Hat Enterprise Linux (RHEL)) as a guest OS on VirtualBox, installing Guest Additions within it will enhance its overall performance. Though installing VirtualBox Guest Additions is optional, improving the virtual machine’s performance and enhancing the user experience within VirtualBox, is recommended.
In particular, while using CentOS on VirtualBox you will notice some issues there. The most common ones are mouse and keyboard integration between the host and the virtual system, fixed virtual machine display resolution, 2-way share of clipboard and shared folders between the host and guest system, etc. In the following image, you can see that the guest CentOS VM is not opening in full screen. Installing VirtualBox guest addition will solve these problems. This guide will dive into the process of installing VirtualBox guest additions on CentOS using the graphical user interface (GUI) and command line interface (CLI).
Note: If you want to know how to install CentOS on VirtualBox follow “How to Install CentOS 7 on VirtualBox”
Method 01: Install VirtualBox Guest Additions Using GUI
To install VirtualBox Guest Additions using the graphical user interface (GUI), follow the below processes:
- First, Start your CentOS virtual machine.
- After that, click on Devices. Then from that menu click on Insert Guest Additions CD image.
- Now, click on Run.
- Provide your sudo user password and click on Authenticate.
- Subsequently, VirtualBox guest additions installation will start. After VirtualBox Guest Additions Installation is Complete, press ENTER.
- You are good to go. Now, you will be able to use VirtualBox guest additions features. For starters, you can resize your VM.
- After installation is complete you can safely remove the VirtualBox guest additions image from your VM. To do that right-click on the VBox_GAs image and click on Eject.
Method 02: Install VirtualBox Guest Additions Using CLI
To install VirtualBox Guest Additions using the command line interface (CLI) follow these step-by-step instructions:
Step 1: Launch CentOS VM
Select your CentOS VM and click on Start.
Step 2: Add “epel-release” Repository
Add EPEL (Extra Packages for Enterprise Linux) repository in CentOS as it provides additional packages not included in the default CentOS repositories.
For CentOS 7 and above:
sudo yum -y install epel-release
For CentOS 6 and earlier:
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Step 3: Update System App Packages
Update system applications by running sudo yum update -y
command. This may take some time.
Step 4: Install Essential App Packages
- After the update is complete install all necessary packages to build kernel modules. To do that run:
sudo yum install -y dkms gcc kernel-devel-$(uname -r) kernel-headers-$(uname -r) make bzip2 elfutils-libelf-devel perl
- Now, set the KERN_DIR as an environment variable, as some applications may check this to reference the kernel source.
export KERN_DIR=/usr/src/kernels/$(uname -r)
Step 5: Mount the Guest Additions CD
- First, click on Devices > Insert Guest Additions CD Image.
- Then, create a new directory and mount the CD image there.
sudo mkdir -p /mnt/cdrom sudo mount /dev/cdrom /mnt/cdrom
Step 6: Install VirtualBox Guest Additions Package
Now run the shell script to install the VirtualBox Guest Additions software package.
sudo sh /mnt/cdrom/VBoxLinuxAdditions.run
Step 7: Restart the CentOS Machine
- After installation is complete VirtualBox guest additions package should take effect. To ensure that restart your system with
sudo shutdown -r now
- Log in with your credentials.
- VirtualBox guest additions package is active now.
Step 8: Verify Guest Addition Installation
To check if the VirtualBox guest additions package is installed properly run lsmod | grep vboxguest
If you do not get any output then the VirtualBox kernel is not installed properly.
Step 9: Eject Guest Addition Installation Image
Finally, right-click on the VBox_GAs image and click on Eject to remove the VirtualBox guest additions image from your VM.
Conclusion
VirtualBox guest additions enhance the functionality and performance of the virtual machine. This comprehensive guide has walked you through the steps of installing VirtualBox guest additions in the CentOS system to ensure a smooth integration of essential drivers and features. I hope this will help you to get a better CentOS experience in the VirtualBox environment.
People Also Ask
What are the requirements for installing VirtualBox Guest Additions on CentOS?
Requirements to Install VirtualBox Guest Additions on CentOS are:
- VirtualBox extension pack should be preinstalled on VirtualBox.
- CentOS virtual machine with CentOS installed in it.
What are the features of VirtualBox Guest Additions?
The main features of VirtualBox guest additions are:
- Enhanced graphics support.
- Mouse and keyboard integration.
- Shared folders for file transfer.
- Clipboard sharing between host and guest system.
- Seamless window integration.
- Automatic time synchronization between host and guest system.
- Auto resize of guest machine display.
- Improved audio support.
What is CentOS?
CentOS is a robust Linux distribution and is renowned for its stability and performance. It is an open-source distribution derived from Red Hat Enterprise Linux and offers a free platform. It is suitable for a wide range of applications and is a preferred choice among users due to its ability to provide a secure and comprehensive environment for various computing requirements.
Can I Install CentOS 7 on VirtualBox on Windows or MacOS?
Yes, VirtualBox is a cross-platform virtualization tool. You can install and run CentOS 7 on VirtualBox on Windows, macOS, or Linux.
How to full-screen CentOS 7 in VirtualBox?
To open CentOS 7 in full-screen mode on VirtualBox you need to have the VirtualBox guest additions installed. Then you can freely resize your guest system display. To install the guest addition CD on your CentOS VM, start the VM > devices > Insert Guest Additions CD image > Run > authenticate with sudo user password > Reboot. This will install VirtualBox guest addition packages on your CentOS VM.
How to install the VirtualBox Extension Pack?
To install the VirtualBox extension pack first download the extension pack from the official VirtualBox download page. Then click on Tools > Install > select the downloaded extension file > Install. The VirtualBox will automatically install the extension pack. If you are prompted to agree with their terms and conditions read that and click on agree.
Related Articles
- How to Install Ubuntu on VirtualBox [A Complete Guide]
- How to Install Arch Linux on VirtualBox [3 Methods]
- How to Install Fedora on VirtualBox [Simple Guide]
- How to Install Debian on VirtualBox [Step-by-Step]
- How to Install VirtualBox Guest Additions on Debian
- How to Install Kali Linux on VirtualBox [Easiest Guide]
- How to Install CentOS 7 on VirtualBox [8 Easy Steps]
<< Go Back to Virtual Machine Installation Guide | Linux OS Installation Guide | Learn Linux Basics
Great Article! thank you very much. it is very helpful and makes world better!
However, there is a small mistake in the “Step 5”:
“`
sudo mkdir -p /mnt/cdromsudo mount /dev/cdrom /mnt/cdrom
“`
should be:
“`
sudo mkdir -p /mnt/cdrom; sudo mount /dev/cdrom /mnt/cdrom
“`
Hello zxnzysj. Thank you so much for your kind words! I’m really glad you found the article helpful, and I appreciate you taking the time to point out the error in Step 5. You’re absolutely right, the command should be:
sudo mkdir -p /mnt/cdrom
sudo mount /dev/cdrom /mnt/cdrom
I’ve updated the article to reflect this correction. Thanks again for your feedback!
Great article! I finally got the VirtualBox additions installed after I installed the VirtualBox update. Before then the installation kept report that something was wrong.
Cheers