이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 2. Getting started with the OpenShift CLI
To use the OpenShift CLI (oc) tool, you must download and install it separately from your MicroShift installation. You can install oc by downloading the binary or by using Homebrew.
2.1. 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 Red Hat build of MicroShift.
Download and install the new version of oc.
Red Hat build of MicroShift version numbering matches OpenShift Container Platform version numbering. Use the oc binary that matches your MicroShift version and has the appropriate RHEL compatibility.
Procedure
- Navigate to the Download OpenShift Container Platform page on the Red Hat Customer Portal.
- Select the architecture from the Product Variant list.
- Select the appropriate version from the Version list.
- Click Download Now next to the OpenShift v4.21 Linux Clients entry and save the file.
Unpack the archive:
$ tar xvf <file>Place the
ocbinary in a directory that is on yourPATH.To check your
PATH, execute the following command:$ echo $PATH
Verification
After you install the OpenShift CLI, it is available using the
occommand:$ oc <command>
2.2. 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 Red Hat build of MicroShift.
Download and install the new version of oc.
Red Hat build of MicroShift version numbering matches OpenShift Container Platform version numbering. Use the oc binary that matches your MicroShift version and has the appropriate RHEL compatibility.
Procedure
- Navigate to the Download OpenShift Container Platform page on the Red Hat Customer Portal.
- Select the appropriate version from the Version list.
- Click Download Now next to the OpenShift v4.21 Windows Client entry and save the file.
- Extract the archive with a ZIP program.
Move the
ocbinary to a directory that is on yourPATHvariable.To check your
PATHvariable, open the command prompt and execute the following command:C:\> path
Verification
After you install the OpenShift CLI, it is available using the
occommand:C:\> oc <command>
2.3. 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 Red Hat build of MicroShift.
Download and install the new version of oc.
Red Hat build of MicroShift version numbering matches OpenShift Container Platform version numbering. Use the oc binary that matches your MicroShift version and has the appropriate RHEL compatibility.
Procedure
- Navigate to the Download OpenShift Container Platform on the Red Hat Customer Portal.
- Select the appropriate version from the Version drop-down list.
- Click Download Now next to the OpenShift v4.21 macOS Clients entry and save the file.
- Unpack and unzip the archive.
Move the
ocbinary to a directory on yourPATHvariable.To check your
PATHvariable, open a terminal and execute the following command:$ echo $PATH
Verification
Verify your installation by using an
occommand:$ oc <command>
2.4. Installing the OpenShift CLI by using Homebrew 링크 복사링크가 클립보드에 복사되었습니다!
For macOS, you can install the OpenShift CLI (oc) by using the Homebrew package manager.
Prerequisites
-
You must have Homebrew (
brew) installed.
Procedure
Install the openshift-cli package by running the following command:
$ brew install openshift-cli
Verification
-
Verify your installation by using an
occommand:
$ oc <command>
2.5. 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 Red Hat build of MicroShift subscription on your Red Hat account.
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
Register with Red Hat Subscription Manager:
# subscription-manager registerPull the latest subscription data:
# subscription-manager refreshList the available subscriptions:
# subscription-manager list --available --matches '*OpenShift*'In the output for the previous command, find the pool ID for an Red Hat build of MicroShift subscription and attach the subscription to the registered system:
# subscription-manager attach --pool=<pool_id>Enable the repositories required by Red Hat build of MicroShift 4.21.
# subscription-manager repos --enable="rhocp-4.21-for-rhel-8-x86_64-rpms"Install the
openshift-clientspackage:# yum install openshift-clients
Verification
Verify your installation by using an
occommand:$ oc <command>