Install a RedHat Enterprise Linux 8.10 VM on VirtualBox with vboxmanage
These steps can be used to setup a RHEL 8.10 VirtualBox guest that can be used as the base OS for the other blog posts. The host system in my case is Windows 10.
Table of Contents
Preparation
Download the RHEL 8.10 iso file from RedHat here to the folder c:\sw. If you dont have an RedHat Account you need to create one.
Add the path of vboxmanage to the Windows Path environment variable. This has to be done only once. For example with Win+r and then enter:
rundll32 sysdm.cpl,EditEnvironmentVariables
Add C:\Program Files\Oracle\VirtualBox
to the User variable Path.
A directory c:\vms for the virtual machines on the host system should exist:
mkdir c:\vms
Then open a new command prompt to begin the installation.
Install a new RHEL 8.10 VM
Configure the Virtual Machine
In the command prompt set the name of the new virtual machine:
set /p VHOST=Enter VM name:
Then run these steps to perform the unattended installation. You probably need to adjust the parameter –bridgeadapter1 to the name of your primary interface of the Windows host system (ipconfig /all => see Description)
vboxmanage createvm --name %VHOST% --ostype RedHat8_64 --register
vboxmanage modifyvm %VHOST% --clipboard-mode=bidirectional --drag-and-drop=bidirectional
vboxmanage modifyvm %VHOST% --memory=8192 --cpus=4 --vram=128 --graphicscontroller=vmsvga --usb-ehci=on
vboxmanage setextradata %VHOST% GUI/ScaleFactor 2
vboxmanage storagectl %VHOST% --name "IDE" --add ide
vboxmanage storagectl %VHOST% --name "SATA" --add sata --bootable on
vboxmanage createmedium disk --filename c:\vms\%VHOST%\%VHOST%_1.vdi --size 122880 --variant Standard
vboxmanage storageattach %VHOST% --storagectl "SATA" --port 0 --device 0 --type hdd --medium c:\vms\%VHOST%\%VHOST%_1.vdi
vboxmanage modifyvm %VHOST% --nic1 bridged --bridgeadapter1 "Intel(R) Ethernet Connection (2) I219-LM"
rem if you would like to specify a dedicated mac address:
rem vboxmanage modifyvm %VHOST% --mac-address1=080027EAC935
vboxmanage sharedfolder add %VHOST% --name=sw --hostpath=c:\sw --automount --auto-mount-point=/sw
vboxmanage showvminfo %VHOST%|findstr /C:"NIC 1"
The last command shows the mac address that the VM will use. Add the IP/mac address to your local dns so that the new machine can retrieve the IP address you want to use for the VM. Now start the unattended installation:
Perform the OS installation
vboxmanage unattended install %VHOST% --iso=c:\sw\rhel-8.10-x86_64-dvd.iso --user=user1 --user-password=root --install-additions --additions-iso=c:\sw\VBoxGuestAdditions_7.1.4.iso --locale=en_US --country=DE --time-zone="Europe/Berlin" --hostname=%VHOST%.fritz.box --start-vm=gui
The installation takes about 20 minutes. Now you are able to login to the system with the IP or hostname you specified in the DNS server (username: root password: root). Now perform these steps:
bash -c "
# change password of root and user1:
passwd root && passwd user1
# set the keyboard if needed
localectl set-keymap de
# register the system with RedHat:
subscription-manager register
# install and update packages:
dnf -y update && dnf -y groupinstall 'Server with GUI' && dnf -y install libnsl bc binutils compat-openssl10 elfutils-libelf glibc glibc-devel ksh libaio libXrender libX11 libXau libXi libXtst libgcc libnsl libstdc++ libxcb libibverbs make smartmontools sysstat libnsl2 net-tools nfs-utils libstdc++-devel libaio-devel iotop kernel-devel-$(uname -r)
# Recompile Guest Addition kernel modules:
/sbin/rcvboxadd quicksetup all
# disable screen lock for user root
gsettings set org.gnome.desktop.session idle-delay 0
# disable selinux:
sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
systemctl set-default graphical.target
init 6"
Your system is now ready to use! Have fun.
Further info
If there are errors during the installation you can clean up and do a fresh install with:
set /p VHOST=Enter VM name:
vboxmanage controlvm %VHOST% poweroff
vboxmanage unregistervm %VHOST% --delete-all
rmdir /S/Q c:\vms\%VHOST%
Some useful Links:
- vboxmanage Command Reference
- Red Hat Hybrid Cloud Console to get an overview of your registered systems
Leave a Reply