×

About the OpenShift CLI

With the OpenShift CLI (oc), you can create applications and manage OKD projects from a terminal. The OpenShift CLI is ideal in the following situations:

  • Working directly with project source code.

  • Scripting OKD operations

  • Managing projects while restricted by bandwidth resources and the web console is unavailable.

Installing the OpenShift CLI

You can install the OpenShift CLI (oc) either by downloading the binary or by using an RPM.

Installing the OpenShift CLI on Linux

To manage your cluster and deploy applications from the command line, install the OpenShift CLI (oc) binary on Linux.

If you installed an earlier version of oc, you cannot use it to complete all of the commands in OKD.

Download and install the new version of oc.

Procedure
  1. Navigate to https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/ and choose the folder for your operating system and architecture.

  2. Download oc.tar.gz.

  3. Unpack the archive:

    $ tar xvf <file>
  4. Place the oc binary in a directory that is on your PATH.

    To check your PATH, execute the following command:

    $ echo $PATH
Verification
  • After you install the OpenShift CLI, it is available using the oc command:

    $ oc <command>

Installing the OpenShift CLI on Windows

To manage your cluster and deploy applications from the command line, install OpenShift CLI (oc) binary on Windows.

If you installed an earlier version of oc, you cannot use it to complete all of the commands in OKD.

Download and install the new version of oc.

Procedure
  1. Navigate to https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/ and choose the folder for your operating system and architecture.

  2. Download oc.zip.

  3. Extract the archive with a ZIP program.

  4. Move the oc binary to a directory that is on your PATH variable.

    To check your PATH variable, open the command prompt and execute the following command:

    C:\> path
Verification
  • After you install the OpenShift CLI, it is available using the oc command:

    C:\> oc <command>

Installing the OpenShift CLI on macOS

To manage your cluster and deploy applications from the command line, install the OpenShift CLI (oc) binary on macOS.

If you installed an earlier version of oc, you cannot use it to complete all of the commands in OKD.

Download and install the new version of oc.

Procedure
  1. Navigate to https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/ and choose the folder for your operating system and architecture.

  2. Download oc.tar.gz.

  3. Unpack and unzip the archive.

  4. Move the oc binary to a directory on your PATH variable.

    To check your PATH variable, open a terminal and execute the following command:

    $ echo $PATH
Verification
  • Verify your installation by using an oc command:

    $ oc <command>

Installing the OpenShift CLI by using the web console

You can install the OpenShift CLI (oc) to interact with OKD clusters from a web console. You can install oc on Linux, Windows, or macOS.

If you installed an earlier version of oc, you cannot use it to complete all of the commands in OKD 4. Download and install the new version of oc.

Installing the OpenShift CLI on Linux using the web console

You can install the OpenShift CLI (oc) binary on Linux by using the following procedure.

Procedure
  1. From the web console, click ?.