1
2
3
4
5
6
7
Author: Xiaohui Li

WeChat: lxh_chat

Email: 939958092@qq.com

TelegramGroup: https://t.me/itskillshare

🌟 Why CRC?

OpenShift is powerful but traditionally painful to install. CRC (CodeReady Containers) simplifies this by providing a “single‑node OpenShift cluster in a box” that runs locally on Windows, macOS, or Linux. Perfect for developers and testers who want a quick OpenShift environment without complex setup.


🖥️ Environment Used in This Guide

  • OS: Rocky Linux 9.4
  • OpenShift version: 4.18.2
  • Extra disk: 500 GB (for CRC volume group)
  • User: lixiaohui (non‑root with sudo)
  • Hardware: 8 cores, 16 GB RAM
  • Virtualization: Enabled

🔑 Pre‑installation Notes

  • CRC must run as a non‑root user with sudo privileges.
  • Always log in via SSH, not su, to avoid systemd bus errors.
  • Hardware minimums:
    • 4 CPU cores
    • 10.5 GB free RAM
    • 35 GB free disk space
  • Prepare an LVM volume group named crc on a spare disk.

⚙️ OS Requirements

  • Windows: Windows 10/11 Pro or Enterprise (Home not supported).
  • macOS: macOS 13 Ventura or newer.
  • Linux:
    • RHEL (latest two minor versions, registered with Red Hat).
    • CentOS 8/9, Fedora (latest two stable versions).
    • Ubuntu ≥18.04, Debian ≥10.
    • Must install libvirt and NetworkManager.

Example (RHEL/CentOS/Fedora/Rocky):

1
sudo dnf install libvirt NetworkManager

Example (Ubuntu/Debian):

1
sudo apt install qemu-kvm libvirt-daemon libvirt-daemon-system network-manager

👤User Requirements

CRC installation must be performed with a non‑root account that has sudo privileges.
Let’s create a lixiaohui user and assign it to the wheel group for sudo access:

1
useradd -G wheel lixiaohui

Then set the password:

1
2
3
4
5
6
[root@lxh-host1 ~]# passwd lixiaohui
Changing password for user lixiaohui.
New password:
BAD PASSWORD: The password is a palindrome
Retype new password:
passwd: all authentication tokens updated successfully.

⚠️ Important: You must log in via SSH with this user.
Do not use su to switch users, otherwise you may encounter the following error:

1
Executing systemctl action failed:  exit status 1: Failed to connect to bus: No medium found

🖥️Hardware Requirements

If your resources are insufficient, CRC simply won’t run.
To use CRC for running the OpenShift Container Platform, prepare the following:

  • CPU: At least 4 physical CPU cores. Don’t worry—most modern machines can easily meet this requirement.

  • Memory: At least 10.5 GB of free RAM. If your system doesn’t have enough, you may need to close other memory‑hungry applications.

  • Disk Space: At least 35 GB of free storage.
    Especially note: in the home directory of the non‑root user used for installation, CRC will create a .crc folder to cache the VM image. This folder consumes significant space, mainly for OpenShift images and cluster data. Make sure you allocate enough storage.

  • Extra Disk: Before installation, prepare an LVM volume group named crc. Assign sufficient space to it.

If the crc volume group does not exist, you will see an error like this:

1
Error creating machine: error with pre-create check: Use 'crc setup' to define the machine driver storage pool, Use 'crc setup' to define the storage pool, viMessage='Failed to connect socket to '/var/run/libvirt/virtstoraged-sock': No such file or directory'

Notes

  • Resource Allocation: The above are minimum requirements. If your workloads are more complex (e.g., deploying large applications or running multiple services simultaneously), you may need more CPU and memory.

  • Don’t Starve Your Host: CRC automatically allocates resources to the OpenShift cluster, but remember to leave some for your host system. If you allocate everything to CRC, your computer may become sluggish.

  • Adjust Anytime: If you find resources insufficient during runtime, don’t panic. CRC supports dynamic resource adjustment. For example, you can increase memory allocation with:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
      crc config set memory 16384
    ```
    (This sets memory to 16 GB.)

    ---

    # 📥 Download CRC

    - Download from: [Red Hat Console](https://console.redhat.com/openshift/create/local)
    - Linux direct link:
    ```bash
    wget https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz
  • Also download your pull‑secret.json file.

openshift-crc-download

Extract and install:

1
2
3
4
[root@lxh-host1 ~]# tar xvf crc-linux-amd64.tar.xz
crc-linux-2.49.0-amd64/
crc-linux-2.49.0-amd64/LICENSE
crc-linux-2.49.0-amd64/crc

To make the crc program from the extracted archive available system‑wide, place it in a directory that is already included in the PATH environment variable (such as /usr/local/bin or /usr/bin). This way, you don’t need to type the full path every time.

1
2
3
[root@lxh-host1 ~]# mv crc-linux-2.49.0-amd64/crc /usr/bin
[root@lxh-host1 ~]# chmod +x /usr/bin/crc
[root@lxh-host1 ~]#

make sure crc client is installed:

1
2
3
4
5
[root@lxh-host1 ~]# crc version
CRC version: 2.49.0+e843be
OpenShift version: 4.18.2
MicroShift version: 4.18.2


💾 Prepare LVM Volume Group

Check which empty disk is available, then create a volume group named crc.

1
2
3
[root@lxh-host1 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n7 259:9 0 500G 0 disk

Alright, let’s use my nvme0n7 disk to create a volume group named crc:

1
2
3
4
5
6
[root@lxh-host1 ~]# vgcreate crc /dev/nvme0n7
Physical volume "/dev/nvme0n7" successfully created.
Volume group "crc" successfully created
[root@lxh-host1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
crc 1 0 0 wz--n- <500.00g <500.00g

🔧 Setup CRC

Switch to your non‑root user:

Once again, please make sure to log in with the prepared non‑root user via SSH.

1
[root@lxh-host1 ~]# ssh lixiaohui@localhost

The crc setup command installs and checks all dependencies required for starting the cluster.
If it fails, you can run it with debug mode to output more detailed logs:

1
crc setup --log-level debug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
[lixiaohui@lxh-host1 ~]$ crc setup
INFO Using bundle path /home/lixiaohui/.crc/cache/crc_libvirt_4.18.2_amd64.crcbundle
INFO Checking if running as non-root
INFO Checking if running inside WSL2
INFO Checking if crc-admin-helper executable is cached
INFO Caching crc-admin-helper executable
INFO Using root access: Changing ownership of /home/lixiaohui/.crc/bin/crc-admin-helper-linux-amd64

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for lixiaohui:
INFO Using root access: Setting suid for /home/lixiaohui/.crc/bin/crc-admin-helper-linux-amd64
INFO Checking if running on a supported CPU architecture
INFO Checking if crc executable symlink exists
INFO Creating symlink for crc executable
INFO Checking minimum RAM requirements
INFO Check if Podman binary exists in: /home/lixiaohui/.crc/bin/oc
INFO Checking if Virtualization is enabled
INFO Checking if KVM is enabled
INFO Checking if libvirt is installed
INFO Installing libvirt service and dependencies
INFO Using root access: Installing virtualization packages
INFO Checking if user is part of libvirt group
INFO Adding user to libvirt group
INFO Using root access: Adding user to the libvirt group
INFO Checking if active user/process is currently part of the libvirt group
INFO Checking if libvirt daemon is running
INFO Checking if a supported libvirt version is installed
INFO Checking if crc-driver-libvirt is installed
INFO Installing crc-driver-libvirt
INFO Checking crc daemon systemd service
INFO Setting up crc daemon systemd service
INFO Checking crc daemon systemd socket units
INFO Setting up crc daemon systemd socket units
INFO Checking if vsock is correctly configured
INFO Setting up vsock support
INFO Using root access: Setting CAP_NET_BIND_SERVICE capability for /usr/bin/crc executable
INFO Using root access: Creating udev rule for /dev/vsock
INFO Using root access: Changing permissions for /etc/udev/rules.d/99-crc-vsock.rules to 644
INFO Using root access: Reloading udev rules database
INFO Using root access: Loading vhost_vsock kernel module
INFO Using root access: Creating file /etc/modules-load.d/vhost_vsock.conf
INFO Using root access: Changing permissions for /etc/modules-load.d/vhost_vsock.conf to 644
INFO Checking if CRC bundle is extracted in '$HOME/.crc'
INFO Checking if /home/lixiaohui/.crc/cache/crc_libvirt_4.18.2_amd64.crcbundle exists
INFO Getting bundle for the CRC executable
INFO Downloading bundle: /home/lixiaohui/.crc/cache/crc_libvirt_4.18.2_amd64.crcbundle...
5.74 GiB / 5.74 GiB [---------------------------------------------------------------------------------------------------------------] 100.00% 45.52 MiB/s
INFO Uncompressing /home/lixiaohui/.crc/cache/crc_libvirt_4.18.2_amd64.crcbundle
crc.qcow2: 20.25 GiB / 20.25 GiB [-------------------------------------------------------------------------------------------------------------] 100.00%
oc: 176.52 MiB / 176.52 MiB [------------------------------------------------------------------------------------------------------------------] 100.00%
Your system is correctly setup for using CRC. Use 'crc start' to start the instance
[lixiaohui@lxh-host1 ~]$

▶️ Start the Cluster

1
crc start --pull-secret-file /path/to/pull-secret.txt

This creates the CRC VM, configures kubelet, applies your pull secret, and starts OpenShift 4.18.2.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
[lixiaohui@lxh-host1 ~]$ crc start --pull-secret-file /pull-secret.txt
INFO Using bundle path /home/lixiaohui/.crc/cache/crc_libvirt_4.18.2_amd64.crcbundle
INFO Checking if running as non-root
INFO Checking if running inside WSL2
INFO Checking if crc-admin-helper executable is cached
INFO Checking if running on a supported CPU architecture
INFO Checking if crc executable symlink exists
INFO Checking minimum RAM requirements
INFO Check if Podman binary exists in: /home/lixiaohui/.crc/bin/oc
INFO Checking if Virtualization is enabled
INFO Checking if KVM is enabled
INFO Checking if libvirt is installed
INFO Checking if user is part of libvirt group
INFO Checking if active user/process is currently part of the libvirt group
INFO Checking if libvirt daemon is running
INFO Checking if a supported libvirt version is installed
INFO Checking if crc-driver-libvirt is installed
INFO Checking crc daemon systemd socket units
INFO Checking if vsock is correctly configured
INFO Loading bundle: crc_libvirt_4.18.2_amd64...
INFO Creating CRC VM for OpenShift 4.18.2...
INFO Generating new SSH key pair...
INFO Generating new password for the kubeadmin user
INFO Starting CRC VM for openshift 4.18.2...
INFO CRC instance is running with IP 127.0.0.1
INFO CRC VM is running
INFO Updating authorized keys...
INFO Configuring shared directories
INFO Check internal and public DNS query...
INFO Check DNS query from host...
INFO Verifying validity of the kubelet certificates...
INFO Starting kubelet service
INFO Waiting for kube-apiserver availability... [takes around 2min]
INFO Adding user's pull secret to the cluster...
INFO Updating SSH key to machine config resource...
INFO Waiting until the user's pull secret is written to the instance disk...
INFO Changing the password for the kubeadmin user
INFO Updating cluster ID...
INFO Updating root CA cert to admin-kubeconfig-client-ca configmap...
INFO Starting openshift instance... [waiting for the cluster to stabilize]
INFO 2 operators are progressing: authentication, console
INFO 2 operators are progressing: authentication, console
INFO Operator authentication is progressing
INFO All operators are available. Ensuring stability...
INFO Operators are stable (2/3)...
INFO Operators are stable (3/3)...
INFO Adding crc-admin and crc-developer contexts to kubeconfig...
Started the OpenShift cluster.

The server is accessible via web console at:
https://console-openshift-console.apps-crc.testing

Log in as administrator:
Username: kubeadmin
Password: g38ZF-DP5Qn-aGdVt-obeEa

Log in as user:
Username: developer
Password: developer

Use the 'oc' command line interface:
$ eval $(crc oc-env)
$ oc login -u developer https://api.crc.testing:6443

At the end you’ll see:

  • Web console: https://console-openshift-console.apps-crc.testing
  • Admin login:
    • Username: kubeadmin
    • Password: (auto‑generated, shown in output)
  • Developer login:
    • Username: developer
    • Password: developer

🌐 Access from Another Machine

  • Add CRC hostnames to your local /etc/hosts (Linux/macOS) or C:\Windows\System32\drivers\etc\hosts (Windows). Example:
    1
    192.168.8.201 api.crc.testing console-openshift-console.apps-crc.testing ...
  • Open firewall ports:
    1
    2
    firewall-cmd --add-port=80/tcp --add-port=443/tcp --add-port=6443/tcp --permanent
    firewall-cmd --reload

🖥️ Access OpenShift

  • Web console: Login as kubeadmin.

openshift-web-console

openshift-web-console

  • CLI:
1
2
3
4
eval $(crc oc-env)
oc login -u kubeadmin -p <password> https://api.crc.testing:6443
oc get nodes
oc get co
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[lixiaohui@lxh-host1 ~]$ oc login -u kubeadmin -p dmFMg-REGzo-inM2K-esGmd https://api.crc.testing:6443
Login successful.

You have access to 65 projects, the list has been suppressed. You can list all projects with 'oc projects'

Using project "default".
[lixiaohui@lxh-host1 ~]$ oc get nodes
NAME STATUS ROLES AGE VERSION
crc Ready control-plane,master,worker 63d v1.31.6
[lixiaohui@lxh-host1 ~]$ oc get co
NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE MESSAGE
authentication 4.18.2 True False False 7m50s
config-operator 4.18.2 True False False 63d
console 4.18.2 True False False 8m38s
control-plane-machine-set 4.18.2 True False False 63d
dns 4.18.2 True False False 8m57s
etcd 4.18.2 True False False 63d
image-registry 4.18.2 True False False 8m47s
ingress 4.18.2 True False False 63d
kube-apiserver 4.18.2 True False False 63d
kube-controller-manager 4.18.2 True False False 63d
kube-scheduler 4.18.2 True False False 63d
kube-storage-version-migrator 4.18.2 True False False 9m9s
machine-api 4.18.2 True False False 63d
machine-approver 4.18.2 True False False 63d
machine-config 4.18.2 True False False 63d
marketplace 4.18.2 True False False 63d
network 4.18.2 True False False 63d
openshift-apiserver 4.18.2 True False False 9m5s
openshift-controller-manager 4.18.2 True False False 9m22s
openshift-samples 4.18.2 True False False 63d
operator-lifecycle-manager 4.18.2 True False False 63d
operator-lifecycle-manager-catalog 4.18.2 True False False 63d
operator-lifecycle-manager-packageserver 4.18.2 True False False 9m1s
service-ca 4.18.2 True False False 63d


✅ Verification

  • Node crc should be Ready with roles control-plane,master,worker.
  • All cluster operators (oc get co) should show AVAILABLE=True.

🎉 Conclusion

You now have a fully functional OpenShift 4.18.2 cluster running locally with CRC. This environment is ideal for:

  • Learning OpenShift basics
  • Testing deployments and operators
  • Practicing DO280/RHCA labs
  • Experimenting with CI/CD pipelines