1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/cli-installing-cli.adoc
2024-08-30 11:42:39 +00:00

243 lines
9.7 KiB
Plaintext

// Module included in the following assemblies:
//
// * cli_reference/openshift_cli/getting-started.adoc
// * installing/installing_aws/installing-aws-user-infra.adoc
// * installing/installing_aws/installing-aws-customizations.adoc
// * installing/installing_aws/installing-aws-default.adoc
// * installing/installing_aws/installing-aws-china.adoc
// * installing/installing_aws/installing-aws-government-region.adoc
// * installing/installing_aws/installing-aws-secret-region.adoc
// * installing/installing_aws/installing-aws-network-customizations.adoc
// * installing/installing_aws/installing-aws-private.adoc
// * installing/installing_aws/installing-aws-vpc.adoc
// * installing/installing_aws/installing-aws-localzone.adoc
// * installing/installaing_aws/installing-aws-wavelength-zone.adoc
// * installing/installing_aws/installing-restricted-networks-aws-installer-provisioned.adoc
// * installing/installing_aws/installing-aws-outposts-remote-workers.adocs
// * installing/installing_azure/installing-azure-customizations.adoc
// * installing/installing_azure/installing-azure-default.adoc
// * installing/installing_azure/installing-azure-government-region.adoc
// * installing/installing_azure/installing-azure-private.adoc
// * installing/installing_azure/installing-azure-vnet.adoc
// * installing/installing_azure/installing-azure-user-infra.adoc
// * installing/installing_azure_stack_hub/installing-azure-stack-hub-default.adoc
// * installing/installing_azure_stack_hub/installing-azure-stack-hub-user-infra.adoc
// * installing/installing_bare_metal/installing-bare-metal.adoc
// * installing/installing_gcp/installing-gcp-customizations.adoc
// * installing/installing_gcp/installing-gcp-private.adoc
// * installing/installing_gcp/installing-gcp-default.adoc
// * installing/installing_gcp/installing-gcp-vpc.adoc
// * installing/installing_gcp/installing-gcp-user-infra.adoc
// * installing/installing_gcp/installing-restricted-networks-gcp-installer-provisioned.adoc
// * installing/installing_ibm_cloud_public/installing-ibm-cloud-customizations.adoc
// * installing/installing_ibm_cloud_public/installing-ibm-cloud-network-customizations.adoc
// * installing/installing_ibm_cloud_public/installing-ibm-cloud-vpc.adoc
// * installing/installing_ibm_cloud_public/installing-ibm-cloud-private.adoc
// * installing/installing_ibm_cloud_public/installing-ibm-cloud-restricted.adoc
// * installing/install_config/installing-restricted-networks-preparations.adoc
// * installing/installing_ibm_z/installing-ibm-z.adoc
// * openshift_images/samples-operator-alt-registry.adoc
// * updating/updating-restricted-network-cluster/mirroring-image-repository.adoc
// * microshift_cli_ref/microshift-oc-cli-install.adoc
// * updating/updating_a_cluster/updating_disconnected_cluster/mirroring-image-repository.adoc
// * installing/installing-nutanix-installer-provisioned.adoc
// * installing/installing-restricted-networks-nutanix-installer-provisioned.adoc
// * installing/installing_ibm_powervs/installing-ibm-power-vs-private-cluster.adoc
// * installing/installing_ibm_powervs/installing-restricted-networks-ibm-power-vs.adoc
// * installing/installing_ibm_powervs/installing-ibm-powervs-vpc.adoc
// * installing/installing-restricted-networks-azure-installer-provisioned.adoc
// * installing/installing_azure/installing-restricted-networks-azure-user-provisioned.adoc
// * installing/installing_vsphere/ipi/ipi-vsphere-preparing-to-install.adoc
// * installing/installing_vsphere/upi/upi-vsphere-preparing-to-install.adoc
// AMQ docs link to this; do not change anchor
ifeval::["{context}" == "mirroring-ocp-image-repository"]
:restricted:
endif::[]
:_mod-docs-content-type: PROCEDURE
[id="cli-installing-cli_{context}"]
= Installing the OpenShift CLI
You can install the {oc-first} to interact with
ifndef::openshift-rosa[]
{product-title}
endif::openshift-rosa[]
ifdef::openshift-dedicated[]
clusters
endif::openshift-dedicated[]
ifdef::openshift-rosa[]
ROSA
endif::openshift-rosa[]
from a command-line interface. You can install `oc` on Linux, Windows, or macOS.
[IMPORTANT]
====
If you installed an earlier version of `oc`, you cannot use it to complete all of the commands in
ifndef::openshift-rosa[]
{product-title} {product-version}.
endif::openshift-rosa[]
ifdef::openshift-rosa[]
ROSA.
endif::openshift-rosa[]
Download and install the new version of `oc`.
ifdef::restricted[]
If you are updating a cluster in a disconnected environment, install the `oc` version that you plan to update to.
endif::restricted[]
====
[discrete]
== Installing the OpenShift CLI on Linux
You can install the OpenShift CLI (`oc`) binary on Linux by using the following procedure.
ifdef::microshift[]
[NOTE]
====
{product-title} version numbering matches {OCP} version numbering. Use the `oc` binary that matches your {microshift-short} version and has the appropriate RHEL compatibility.
====
endif::microshift[]
.Procedure
ifdef::openshift-origin[]
. Navigate to link:https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/[https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/] and choose the folder for your operating system and architecture.
. Download `oc.tar.gz`.
endif::[]
ifndef::openshift-origin,microshift[]
. Navigate to the link:https://access.redhat.com/downloads/content/290[{product-title} downloads page] on the Red Hat Customer Portal.
. Select the architecture from the *Product Variant* drop-down list.
. Select the appropriate version from the *Version* drop-down list.
. Click *Download Now* next to the *OpenShift v{product-version} Linux Client* entry and save the file.
endif::[]
ifdef::microshift[]
. Navigate to the link:https://access.redhat.com/downloads/content/290[{ocp} downloads page] on the Red Hat Customer Portal.
. Select the architecture from the *Product Variant* drop-down list.
. Select the appropriate version from the *Version* drop-down list.
. Click *Download Now* next to the *OpenShift v{product-version} Linux Client* entry and save the file.
endif::[]
. Unpack the archive:
+
[source,terminal]
----
$ tar xvf <file>
----
. Place the `oc` binary in a directory that is on your `PATH`.
+
To check your `PATH`, execute the following command:
+
[source,terminal]
----
$ echo $PATH
----
.Verification
* After you install the OpenShift CLI, it is available using the `oc` command:
+
[source,terminal]
----
$ oc <command>
----
[discrete]
== Installing the OpenShift CLI on Windows
You can install the OpenShift CLI (`oc`) binary on Windows by using the following procedure.
ifdef::microshift[]
[NOTE]
====
{product-title} version numbering matches {OCP} version numbering. Use the `oc` binary that matches your {microshift-short} version and has the appropriate RHEL compatibility.
====
endif::microshift[]
.Procedure
ifdef::openshift-origin[]
. Navigate to link:https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/[https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/] and choose the folder for your operating system and architecture.
. Download `oc.zip`.
endif::[]
ifndef::openshift-origin,microshift[]
. Navigate to the link:https://access.redhat.com/downloads/content/290[{product-title} downloads page] on the Red Hat Customer Portal.
. Select the appropriate version from the *Version* drop-down list.
. Click *Download Now* next to the *OpenShift v{product-version} Windows Client* entry and save the file.
endif::[]
ifdef::microshift[]
. Navigate to the link:https://access.redhat.com/downloads/content/290[{ocp} downloads page] on the Red Hat Customer Portal.
. Select the appropriate version from the *Version* drop-down list.
. Click *Download Now* next to the *OpenShift v{product-version} Windows Client* entry and save the file.
endif::[]
. Unzip the archive with a ZIP program.
. Move the `oc` binary to a directory that is on your `PATH`.
+
To check your `PATH`, open the command prompt and execute the following command:
+
[source,terminal]
----
C:\> path
----
.Verification
* After you install the OpenShift CLI, it is available using the `oc` command:
+
[source,terminal]
----
C:\> oc <command>
----
[discrete]
== Installing the OpenShift CLI on macOS
You can install the OpenShift CLI (`oc`) binary on macOS by using the following procedure.
ifdef::microshift[]
[NOTE]
====
{product-title} version numbering matches {OCP} version numbering. Use the `oc` binary that matches your {microshift-short} version and has the appropriate RHEL compatibility.
====
endif::microshift[]
.Procedure
ifdef::openshift-origin[]
. Navigate to link:https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/[https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/] and choose the folder for your operating system and architecture.
. Download `oc.tar.gz`.
endif::[]
ifndef::openshift-origin,microshift[]
. Navigate to the link:https://access.redhat.com/downloads/content/290[{product-title} downloads page] on the Red Hat Customer Portal.
. Select the appropriate version from the *Version* drop-down list.
. Click *Download Now* next to the *OpenShift v{product-version} macOS Client* entry and save the file.
+
[NOTE]
====
For macOS arm64, choose the *OpenShift v{product-version} macOS arm64 Client* entry.
====
endif::[]
ifdef::microshift[]
. Navigate to the link:https://access.redhat.com/downloads/content/290[{ocp} downloads page] on the Red Hat Customer Portal.
. Select the appropriate version from the *Version* drop-down list.
. Click *Download Now* next to the *OpenShift v{product-version} macOS Client* entry and save the file.
endif::[]
. Unpack and unzip the archive.
. Move the `oc` binary to a directory on your PATH.
+
To check your `PATH`, open a terminal and execute the following command:
+
[source,terminal]
----
$ echo $PATH
----
.Verification
* Verify your installation by using an `oc` command:
+
[source,terminal]
----
$ oc <command>
----
ifeval::["{context}" == "mirroring-ocp-image-repository"]
:!restricted:
endif::[]