Installing Openshift into a VM

Share on:
Installing Openshift into a VM

Installing OpenShift on a VirtualBox VM

I keep hearing the word OpenShift at work. I don't know what it means. First instinct is to try and get something up and running. I spent about a week and a half scouring the internet for some good instructions and tried a few things. Here's my findings. (I'll probably do a follow up on getting containers running on it later. All we're doing here is spinning up a cluster)

First our dependencies:

Software Version
Windows 10 Pro (Host) 20H2, 19042.146
VirtualBox 6.1.32
CentOS 8.4
CRC (CodeReady Containers) 1.38.0
Openshift 4.9.17

Couple of quick caveats:

  • I'm not doing a multi VM cluster, (I've tried and couldn't get things running together with instructions I'd found)
  • I'm going to assume, reader, you can create VMs and install CentOS with the defaults into that VM.

Let's start then....

  1. Create a VM 20GB RAM, 6 CPUs, 100GB Dynamic Increasing Disk Space. Make sure in the System > Processor tab, Enable Nested VT-X/AMD-V Is enabled.

(you might get away with less RAM, I've not tried it. This is was my first attempt that worked, and I've noticed on my Windows Host, the cluster seems to be quite resource hungry)

  1. Install CentOS. I downloaded CentOS-8.4.2105-x86_64-dvd1.iso from and attached it to my VM. I didn't customise the install much.

I used CentOS as I wanted something close to RedHat (basically the package managers rpm, yum and dnf to work with), and I know CentOS is a close relation of RedHat.

  1. Install Virtualbox Guest Additions CentOS VM I was running was acting a little odd when it came up, so first thing to do was to try and install the additions which should make VMs run in a VM better. I often find it doesn't make much difference but in this case the mouse not behaving was definitely enough for me to get these installed.

By default the CentOS installation when it tried to autorun the shell scripts to install would display an error (modprobe vboxguest failed):

VirtualBox Additions Installation Failure ...meaning they weren't installed properly.

Looks like we need kernel headers and all of the other compile tools there to be able to build out the additions on this particular OS. Update the repositories, and then do an install of the following packages

1sudo dnf update
2sudo dnf install tar bzip2 kernel-devel-$(uname -r) kernel-headers perl gcc make elfutils-libelf-devel 


"Re-Insert the Guest iso" again, (or just click on the on the CD in the VM and try again). Reboot. You can have a look at the install logs and checking the virtualbox modules have loaded by doing this:

1cat /var/log/vboxadd-setup.log
2lsmod | grep vbox

VirtualBox Additions Installation Success

Now we're going to download (2.9GB) and install it "CRC" (RedHat Code Ready Containers) and install it.

2sudo tar -xpvf crc-linux-amd64.tar.xz 
3sudo mv crc-linux-1.38.0-amd64/crc /usr/local/bin

Now we setup the CodeReady Containers....this will involve a 10GB download (this took 10-20 minutes to do):

1crc setup

To start the cluster, Redhat specifies you need a token (which enables you to evaluate a cluster for 60 days). You get a token by signing up for a developer account at Redhat. Then you can download the pull-secret to your VM and start up the cluster. This takes another 10-20 min to do.

1crc start -p pull-secret

Nearly we need the oc management tool to be able to do stuff on the command line...

2tar xfvz oc-4.9.17-linux.tar.gz 
3sudo cp oc /usr/local/bin
4sudo cp kubectl /usr/local/bin

output of crc start (1) output of crc start (2)

et voila!

browser interface to openshift

...and if I wanted to close down the cluster cleanly...

1crc stop
2sudo shutdown -h now.