Initial VM Setup for RHCSA

Oct 29, 2025 [Nov 1, 2025]

Swap caps and escape

GNOME graphical environment

gsettings set org.gnome.desktop.input-sources xkb-options "['caps:swapescape']"

Console

dumpkeys | grep '^key./*Caps' >> ~/keymap
dumpkeys | grep '^key./*Escape' >> ~/keymap
# edit ~/keymap to swap keycodes
loadkeys ~/keymap

Essential bashrc additions

echo "set -o vi" >> ~/.bashrc
echo "alias vi=vim" >> ~/.bashrc
echo "alias llz='ll -Za" >> ~/.bashrc
echo "alias llzd='ll -Zd" >> ~/.bashrc
echo "export EDITOR=$(which vim)" >> ~/.bashrc
exec $SHELL

or

cat << EOF >> foo
> export EDITOR=$(which vim)
> set -o vi
> alias vi=vim
> alias llz='ll -Za'
> alias llzd='ll -Zd'
> EOF
exec $SHELL

Nice to have inputrc additions

echo "set editing-mode vi" >> ~/.inputrc
echo '"\e[A": history-search-backward' >> ~/.inputrc
echo '"\e[B": history-search-forward' >> ~/.inputrc
exec $SHELL

or

cat << EOF >> foo
> set editing-mode vi 
> "\e[A": history-search-backward 
> "\e[B": history-search-forward 
> EOF
exec $SHELL

Server Setup

VM Networking Options

For this to work the you’ll either need to map a port from the host to to the virtual machine, or the virtual machine will need to be connected to a bridge device on the host.

Port mapping is the most simple way to proceed. The following qemu option will map port 2222 on the host to port 22 in the virtual machine, which will allow you to use SSH and SCP via port 2222.

-net user,hostfwd=tcp::2222-:22`

The other option is more complicated, but can also be more useful. It involves setting up bridge and tap network devices on the host in order to connect multiple virtual machines. For RHCSA prep in particular, this option is beneficial because one virtual machine can act as your workstation and another as a server that provides access to package repositories and NFS shares. That process is detailed here.

Repository Access

There are two installation images available from Red Hat. A minimal ...boot.iso and a ...dvd.iso. The ...dvd.iso image must be used for this procedure because the minimal RHEL ...boot.iso image does not contain package repositories.

scp -P {PORT} rhel-10.0-x86_64-dvd.iso {VM-USER}@{VM-ADDRESS}:~

On virtual machine as root:

mv /home/{VM-USER}/rhel-10.0-x86_64-dvd.iso /repo.iso
cp /etc/fstab /etc/fstab.bak
echo "/repo.iso /repo iso9660 defaults 0 0" >> /etc/fstab
mount -a

Now the offline repos are available in /repo/BaseOS and /repo/AppStream.

Serve the repos over http

  • Install nginx
  • Symbolic link or mount the repos to /usr/share/nginx/html
  • Add the http firewalld service

Set up nfs-server

  • Install nfs-utils
  • Add the nfs, mountd, and rpc-bind firewalld services
  • Add exports to /etc/exports

- Clint Jordan