Installing the OpenShift CLI by using an RPM

For Red Hat Enterprise Linux (RHEL), you can install the OpenShift CLI (oc) as an RPM if you have an active {product-title} subscription on your Red Hat account.

Important

You must install oc for RHEL 9 by downloading the binary. Installing oc by using an RPM package is not supported on Red Hat Enterprise Linux (RHEL) 9.

Prerequisites
  • You must have root or sudo privileges.

Procedure
  1. Register with Red Hat Subscription Manager:

    # subscription-manager register
  2. Pull the latest subscription data:

    # subscription-manager refresh
  3. List the available subscriptions:

    # subscription-manager list --available --matches '*OpenShift*'
  4. In the output for the previous command, find the pool ID for an {product-title} subscription and attach the subscription to the registered system:

    # subscription-manager attach --pool=<pool_id>
  5. Enable the repositories required by {product-title} 4.20.

    # subscription-manager repos --enable="rhocp-4.20-for-rhel-8-x86_64-rpms"
  6. Install the openshift-clients package:

    # yum install openshift-clients
Verification
  • Verify your installation by using an oc command:

    $ oc <command>