2019-03-11 20:59:48 -04:00
// Module included in the following assemblies:
//
2023-01-26 14:32:34 -05:00
// * installing/installing_alibaba/installing-alibaba-network-customizations.adoc
// * installing/installing_alibaba/installing-alibaba-vpc.adoc
2019-10-02 11:30:49 -04:00
// * cli_reference/openshift_cli/getting-started.adoc
2019-12-10 14:21:26 -05:00
// * installing/installing_aws/installing-aws-user-infra.adoc
2019-10-03 13:05:34 -04:00
// * installing/installing_aws/installing-aws-customizations.adoc
// * installing/installing_aws/installing-aws-default.adoc
2021-08-17 09:56:43 -04:00
// * installing/installing_aws/installing-aws-china.adoc
2020-09-17 11:58:34 -04:00
// * installing/installing_aws/installing-aws-government-region.adoc
2021-12-07 15:09:41 -05:00
// * installing/installing_aws/installing-aws-secret-region.adoc
2019-10-03 13:05:34 -04:00
// * installing/installing_aws/installing-aws-network-customizations.adoc
2019-11-07 13:56:52 -05:00
// * installing/installing_aws/installing-aws-private.adoc
2019-11-08 15:26:26 -05:00
// * installing/installing_aws/installing-aws-vpc.adoc
2021-04-23 10:26:08 -04:00
// * installing/installing_aws/installing-restricted-networks-aws-installer-provisioned.adoc
2022-09-06 14:46:38 +03:00
// * installing/installing_aws/installing-aws-outposts-remote-workers.adocs
2019-10-03 13:05:34 -04:00
// * installing/installing_azure/installing-azure-customizations.adoc
// * installing/installing_azure/installing-azure-default.adoc
2020-09-24 14:32:22 -04:00
// * installing/installing_azure/installing-azure-government-region.adoc
2019-11-22 08:24:58 -05:00
// * installing/installing_azure/installing-azure-private.adoc
2019-11-15 08:50:08 -05:00
// * installing/installing_azure/installing-azure-vnet.adoc
2020-01-30 14:13:19 -05:00
// * installing/installing_azure/installing-azure-user-infra.adoc
2021-11-18 18:32:59 -05:00
// * installing/installing_azure_stack_hub/installing-azure-stack-hub-default.adoc
2021-08-10 15:32:16 -04:00
// * installing/installing_azure_stack_hub/installing-azure-stack-hub-user-infra.adoc
2019-10-03 13:05:34 -04:00
// * installing/installing_bare_metal/installing-bare-metal.adoc
// * installing/installing_gcp/installing-gcp-customizations.adoc
2019-11-07 13:56:52 -05:00
// * installing/installing_gcp/installing-gcp-private.adoc
2019-10-03 13:05:34 -04:00
// * installing/installing_gcp/installing-gcp-default.adoc
2019-11-18 12:35:43 -05:00
// * installing/installing_gcp/installing-gcp-vpc.adoc
2019-12-10 14:21:26 -05:00
// * installing/installing_gcp/installing-gcp-user-infra.adoc
2021-05-11 09:13:26 -04:00
// * installing/installing_gcp/installing-restricted-networks-gcp-installer-provisioned.adoc
2021-12-10 09:18:27 -05:00
// * installing/installing_ibm_cloud_public/installing-ibm-cloud-customizations.adoc
// * installing/installing_ibm_cloud_public/installing-ibm-cloud-network-customizations.adoc
2022-09-13 17:38:35 -04:00
// * installing/installing_ibm_cloud_public/installing-ibm-cloud-vpc.adoc
2022-09-19 16:02:07 -04:00
// * installing/installing_ibm_cloud_public/installing-ibm-cloud-private.adoc
2019-12-10 14:21:26 -05:00
// * installing/install_config/installing-restricted-networks-preparations.adoc
2019-10-03 13:05:34 -04:00
// * installing/installing_vsphere/installing-vsphere.adoc
2020-05-29 09:31:13 -04:00
// * installing/installing_vsphere/installing-vsphere-installer-provisioned.adoc
// * installing/installing_vsphere/installing-vsphere-installer-provisioned-customizations.adoc
2021-02-19 16:45:06 -05:00
// * installing/installing_vsphere/installing-vsphere-installer-provisioned-network-customizations.adoc
2020-07-21 13:59:45 -04:00
// * installing/installing_vsphere/installing-restricted-networks-installer-provisioned-vsphere.adoc
2019-11-28 12:41:35 +01:00
// * installing/installing_ibm_z/installing-ibm-z.adoc
2019-11-07 11:00:17 -05:00
// * openshift_images/samples-operator-alt-registry.adoc
2023-01-31 15:42:58 -05:00
// * updating/updating-restricted-network-cluster/mirroring-image-repository.adoc
2023-02-02 17:01:58 -05:00
// * microshift_cli_ref/microshift-oc-cli-install.adoc
2023-07-21 11:33:49 -04:00
// * updating/updating_a_cluster/updating_disconnected_cluster/mirroring-image-repository.adoc
2023-01-05 11:04:48 -05:00
// * installing/installing-nutanix-installer-provisioned.adoc
// * installing/installing-restricted-networks-nutanix-installer-provisioned.adoc
2022-09-28 11:47:19 +10:00
// * 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
2019-07-15 19:47:25 -04:00
// AMQ docs link to this; do not change anchor
2019-03-11 20:59:48 -04:00
2023-01-31 15:42:58 -05:00
ifeval::["{context}" == "mirroring-ocp-image-repository"]
2020-05-08 22:49:34 +05:30
:restricted:
endif::[]
2022-02-04 15:22:10 +00:00
:_content-type: PROCEDURE
2019-05-13 08:55:00 +10:00
[id="cli-installing-cli_{context}"]
2021-02-04 08:45:01 -07:00
= Installing the OpenShift CLI by downloading the binary
2019-03-11 20:59:48 -04:00
2021-03-24 11:55:35 -04:00
You can install the OpenShift CLI (`oc`) to interact with {product-title} from a
2020-04-21 13:53:42 -04:00
command-line interface. You can install `oc` on Linux, Windows, or macOS.
2019-03-11 20:59:48 -04:00
2019-10-03 13:05:34 -04:00
[IMPORTANT]
====
2023-02-02 17:01:58 -05:00
If you installed an earlier version of `oc`, you cannot use it to complete all of the commands in {product-title} {product-version}. Download and install the new version of `oc`.
2020-05-08 22:49:34 +05:30
ifdef::restricted[]
2023-06-27 12:58:52 -04:00
If you are updating a cluster in a disconnected environment, install the `oc` version that you plan to update to.
2020-05-08 22:49:34 +05:30
endif::restricted[]
2019-10-03 13:05:34 -04:00
====
2021-05-17 09:29:49 +01:00
[discrete]
2021-02-04 08:45:01 -07:00
== Installing the OpenShift CLI on Linux
2020-04-21 13:53:42 -04:00
You can install the OpenShift CLI (`oc`) binary on Linux by using the following procedure.
2019-03-11 20:59:48 -04:00
.Procedure
2020-04-21 13:53:42 -04:00
2020-03-28 12:02:37 +01:00
ifdef::openshift-origin[]
2023-02-02 17:01:58 -05:00
. 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.
2020-04-21 13:53:42 -04:00
. Download `oc.tar.gz`.
2020-03-28 12:02:37 +01:00
endif::[]
2023-02-02 17:01:58 -05:00
ifndef::openshift-origin,microshift[]
2021-08-03 14:07:34 -04:00
. Navigate to the link:https://access.redhat.com/downloads/content/290[{product-title} downloads page] on the Red Hat Customer Portal.
2023-02-02 17:01:58 -05:00
. 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.
2021-08-03 14:07:34 -04:00
. Click *Download Now* next to the *OpenShift v{product-version} Linux Client* entry and save the file.
2020-03-28 12:02:37 +01:00
endif::[]
2020-04-21 13:53:42 -04:00
. Unpack the archive:
2019-10-03 13:05:34 -04:00
+
2020-08-05 10:46:55 -04:00
[source,terminal]
2020-04-21 13:53:42 -04:00
----
2023-03-01 07:43:42 +05:30
$ tar xvf <file>
2020-04-21 13:53:42 -04:00
----
. Place the `oc` binary in a directory that is on your `PATH`.
+
To check your `PATH`, execute the following command:
+
2020-08-05 10:46:55 -04:00
[source,terminal]
2020-04-21 13:53:42 -04:00
----
$ echo $PATH
----
2021-08-03 14:07:34 -04:00
After you install the OpenShift CLI, it is available using the `oc` command:
2020-04-21 13:53:42 -04:00
2020-08-05 10:46:55 -04:00
[source,terminal]
2020-04-21 13:53:42 -04:00
----
$ oc <command>
----
2021-05-17 09:29:49 +01:00
[discrete]
2021-02-04 08:45:01 -07:00
== Installing the OpenShift CLI on Windows
2020-04-21 13:53:42 -04:00
You can install the OpenShift CLI (`oc`) binary on Windows by using the following procedure.
.Procedure
ifdef::openshift-origin[]
2023-02-02 17:01:58 -05:00
. 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.
2020-04-21 13:53:42 -04:00
. Download `oc.zip`.
endif::[]
2023-02-02 17:01:58 -05:00
ifndef::openshift-origin,microshift[]
2021-08-03 14:07:34 -04:00
. Navigate to the link:https://access.redhat.com/downloads/content/290[{product-title} downloads page] on the Red Hat Customer Portal.
2023-02-02 17:01:58 -05:00
. 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.
2021-08-03 14:07:34 -04:00
. Click *Download Now* next to the *OpenShift v{product-version} Windows Client* entry and save the file.
2020-04-21 13:53:42 -04:00
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:
+
2020-08-05 10:46:55 -04:00
[source,terminal]
2020-04-21 13:53:42 -04:00
----
C:\> path
----
2021-08-03 14:07:34 -04:00
After you install the OpenShift CLI, it is available using the `oc` command:
2020-04-21 13:53:42 -04:00
2020-08-05 10:46:55 -04:00
[source,terminal]
2020-04-21 13:53:42 -04:00
----
C:\> oc <command>
----
2021-05-17 09:29:49 +01:00
[discrete]
2021-02-04 08:45:01 -07:00
== Installing the OpenShift CLI on macOS
2020-04-21 13:53:42 -04:00
You can install the OpenShift CLI (`oc`) binary on macOS by using the following procedure.
.Procedure
ifdef::openshift-origin[]
2023-02-02 17:01:58 -05:00
. 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.
2020-04-21 13:53:42 -04:00
. Download `oc.tar.gz`.
endif::[]
2023-02-02 17:01:58 -05:00
ifndef::openshift-origin,microshift[]
2021-08-03 14:07:34 -04:00
. Navigate to the link:https://access.redhat.com/downloads/content/290[{product-title} downloads page] on the Red Hat Customer Portal.
2023-02-02 17:01:58 -05:00
. Select the appropriate version from the *Version* drop-down list.
2022-11-16 14:25:22 -05:00
. 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.
====
2020-04-21 13:53:42 -04:00
endif::[]
2023-02-02 17:01:58 -05:00
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::[]
2020-04-21 13:53:42 -04:00
. 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:
+
2020-08-05 10:46:55 -04:00
[source,terminal]
2020-04-21 13:53:42 -04:00
----
$ echo $PATH
----
2019-03-11 20:59:48 -04:00
2021-08-03 14:07:34 -04:00
After you install the OpenShift CLI, it is available using the `oc` command:
2019-03-11 20:59:48 -04:00
2020-08-05 10:46:55 -04:00
[source,terminal]
2019-03-11 20:59:48 -04:00
----
$ oc <command>
----
2020-05-08 22:49:34 +05:30
2023-01-31 15:42:58 -05:00
ifeval::["{context}" == "mirroring-ocp-image-repository"]
2020-05-08 22:49:34 +05:30
:!restricted:
endif::[]