If you’re running RHEL without a subscription or working in an isolated environment, creating a local offline repository from your RHEL ISO is the cleanest and most reliable solution. This guide walks you through mounting the ISO, configuring BaseOS and AppStream repositories, refreshing DNF, and installing essential build tools like gcc, kernel-devel, kernel-headers, and make. You’ll also learn how to install VirtualBox Guest Additions and mount shared folders seamlessly inside your VM. This step‑by‑step tutorial is perfect for developers, sysadmins, and DevOps engineers who need a fully offline setup for VirtualBox, MongoDB labs, or custom Linux environments. With clear instructions and practical verification steps, you’ll have a fully functional offline repo, working Guest Additions, and shared folder access — all without needing Red Hat subscription or internet connectivity.
For more blogs related to Linux, please click on the LINK
🌟 STEP 1 — Mount the RHEL ISO inside the VM
In VirtualBox:
Devices → Optical Drives → Choose a disk file…
Select your RHEL ISO.
Then inside the VM:
sudo mkdir -p /mnt/rhel
sudo mount /dev/cdrom /mnt/rhel
Check:
ls /mnt/rhel
You should see BaseOS, AppStream, repodata, etc.
🌟 STEP 2 — Create a local repo file
Create a repo file pointing to the ISO:
sudo nano /etc/yum.repos.d/local.repo
Paste this:
[BaseOS]
name=BaseOS
baseurl=file:///mnt/rhel/BaseOS
enabled=1
gpgcheck=0
[AppStream]
name=AppStream
baseurl=file:///mnt/rhel/AppStream
enabled=1
gpgcheck=0
Save → exit.
🌟 STEP 3 — Clean and refresh DNF
sudo dnf clean all
sudo dnf repolist
You should now see:
- BaseOS
- AppStream
from your ISO.
🌟 STEP 4 — Install the required packages
Now this will work:
sudo dnf install -y gcc kernel-devel kernel-headers make perl
If it asks for dependencies, they will all come from the ISO.
🌟 STEP 5 — Install VirtualBox Guest Additions
Insert Guest Additions:
Devices → Insert Guest Additions CD Image
Then run:
sudo /run/media/$USER/VBox_GAs_*/VBoxLinuxAdditions.run
Reboot:
sudo reboot
🌟 STEP 6 — Mount your shared folder
Assuming your shared folder name is shared:
sudo mkdir -p /mnt/shared
sudo mount -t vboxsf mongodb_software /mnt/shared
Check:
ls /mnt/shared
You should now see your Windows files.
🌟 STEP 7 — (Optional) Auto‑mount on boot
Edit fstab:
sudo nano /etc/fstab
Add:
shared /mnt/shared vboxsf defaults 0 0
🎉 You’re done
You now have:
- Offline RHEL repo
- All build tools installed
- Guest Additions working
- Shared folder mounted