VirtualBox Red Hat Guest on Windows Host
“In the early days of the personal computer, there were many choices of operating system; today, there are many solutions available to choose from for a virtualization strategy.”
― Matthew Portnoy, Virtualization Essentials
Recently at my job I have been dragged back re-entered the world of Red Hat Enterprise Linux. They do things different than in alternative operating systems like Debian, which is different from OpenBSD, and the variations continue in Slackware, which was my very first Linux flavor. Although I have used Red Hat before, it has been about 15 or so years since I have done so seriously and things have changed significantly. I’ll be installing RHEL version 8.6 inside a VirtualBox host machine running Windows 10. For this post I’ve taken inspiration from: https://developers.redhat.com/rhel8/install-rhel8-vbox
Snapshots
BEFORE you change something major in a VirtualBox virtual machine you should take a snapshot of it! This can avoid getting the VM into an unbootable state. It’s among the first things covered in the VirtualBox documentation.
A few videos that should help to get started:
https://www.youtube.com/watch?v=Kl-Qc6N9znw
https://onlinecomputertips.com/support-categories/software/775-virtualbox-snapshots/
· Ubuntu 22.04 build and dev configuration
Regarding Snapshots
I used to recommend doing snapshots for virtual machines, but now I no longer do. You are much better served by regular backups. What works best for me is once a day or once a week backup (depending on the size of the disk image), but that’s not the only way to do it.
Disadvantages of Virtual Machine Snapshots:
Not a Full Backup
Snapshots are not a substitute for full backups. They are designed for short-term use, and relying solely on them for backup can lead to data loss.
Storage Usage
Although snapshots are storage-efficient initially, as changes accumulate, they can grow in size and consume significant storage resources.
Snapshot Chain Complexity and Sprawl
Managing multiple snapshots over time can become complex. Long chains of snapshots (when taken frequently) can make the system unstable and harder to manage.
If not carefully managed, snapshots can proliferate, resulting in "snapshot sprawl," which consumes storage and makes it hard to track which snapshot is needed for recovery.
Dependent on Host System
Snapshots are tightly coupled to the host system. If there is a failure on the host, restoring from snapshots may not be possible.
That said, there are some advantages:
Advantages of Virtual Machine Snapshots:
Quick Backup and Recovery
Snapshots allow for fast creation of a backup image of the virtual machine (VM) at a specific point in time. If something goes wrong, the VM can quickly be reverted to that snapshot.
Non-Disruptive
Creating snapshots typically doesn't interrupt the VM's operation, so it can be done without causing downtime for users or services.
Fast Cloning
A snapshot can be used to quickly create a clone of a VM for testing or production purposes.
But be advised even in these cases that it is wise to quickly migrate to a full backup system!
RH Developer Subscription
(no cost)
Something that has changed since I last used Red Hat is if you want access to anything other than the most basic tools you will have to sign up for a subscription to the Red Hat Developer network. Fortunately, this doesn’t cost anything except your data, which you may or may not be concerned about. As for me, I figure FAANG already has all my data anyway so I am not bothered (well apparently I am bothered a little or I wouldn’t have mentioned it).
Sign up for a subscription here https://developers.redhat.com/products/rhel/download
After one year you will need to renew your subscription. Instructions are here https://developers.redhat.com/articles/renew-your-red-hat-developer-program-subscription
Machine Requirements
You will also need a machine that meets the following requirements:
Has VirtualBox installed.
A 64-bit x86 machine with hardware virtualization assistance (Intel VT-X or AMD-V).
At least 4 GB of RAM.
At least 28 GB of available disk space for the VM and the .iso file.
Notes:
Hardware virtualization needs to be enabled in the BIOS/UEFI setup for your system.
On Windows it may be necessary to disable Hyper-V in order to avoid conflicts with VirtualBox.
Creating and installing the virtual machine is covered in detail in the following links. Note that the yum package manager has been replaced by dnf, so the two commands (yum or dnf) are interchangeable.
https://developers.redhat.com/rhel8/install-rhel8-vbox#create_the_vm
Note that the video memory may need to be increased to keep the mouse from bouncing around.
https://developers.redhat.com/rhel8/install-rhel8-vbox#installation
Pay attention to these instructions in particular!
Choose the Workstation base environment, add Development Tools, Graphical Administration Tools, and Container tools. Note: Do not select Server with a GUI.
Workstation in particular (not server with GUI) will be important when it comes time to install guest additions.
However I WOULD NOT disable kdump to save memory as that article suggests.
https://developers.redhat.com/rhel8/install-rhel8-vbox#system_registration
https://developers.redhat.com/rhel8/install-rhel8-vbox#install_updates
https://developers.redhat.com/rhel8/install-rhel8-vbox#virtualbox_guest_additions
Post Install
The following changes will require you to shut down the virtual machine.
Make clipboard bidirectional:
Up the CPU count:
Perhaps you’ll want to fiddle around with the other settings, but I’d strongly suggest creating a snapshot before changing ANY setting. Failure to do so will risk getting the VM into a state where it can’t be started again. Possible changes include: increasing main and/or video memory, enabling 3D acceleration, setting up shared folders, and many more.
More Packages:
Developers will almost certainly want to install the Extra Packages for Enterprise Linux. To do so enter:
sudo subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
at the terminal prompt. Isn’t it fun how Red Hat packages have gotten strewn all over the place in the past several years?
Install VS Code
Installing VS Code on Red Hat Linux just involves importing a key from Microsoft and then installing the code rpm package:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
dnf check-update
sudo dnf install code
Troubleshooting
I had a co-worker have problems with screen stutter -- having the virtual machine spit out multiple letters per keystroke. Seemed to mostly go away after he changed back to the default window size. It only stutters if he has too many tabs or windows open now. See here: https://forums.virtualbox.org/viewtopic.php?f=8&t=93272