// Module included in the following assemblies:
//
// * installing/disconnected_install/installing-mirroring-disconnected.adoc
// * updating/updating_a_cluster/updating_disconnected_cluster/mirroring-image-repository.adoc

ifeval::["{context}" == "installing-mirroring-disconnected"]
:oc-mirror:
endif::[]

ifeval::["{context}" == "about-installing-oc-mirror-v2"]
:oc-mirror-v2:
endif::[]

:_mod-docs-content-type: PROCEDURE
[id="installation-oc-mirror-installing-plugin_{context}"]
= Installing the oc-mirror OpenShift CLI plugin

[role="_abstract"]
You can install the oc-mirror OpenShift CLI plugin to manage image sets in disconnected environments.

.Prerequisites

* You have installed the OpenShift CLI (`oc`). If you are mirroring image sets in a fully disconnected environment, ensure the following:

** You have installed the oc-mirror plugin on the host that has internet access.

** The host in the disconnected environment has access to the target mirror registry.

* You have set the `umask` parameter to `0022` on the operating system that uses oc-mirror.

* You have installed the correct binary for the {op-system-base} version that you are using.


.Procedure

. Download the oc-mirror CLI plugin:

.. Navigate to the link:https://console.redhat.com/openshift/downloads[Downloads] page of the {hybrid-console}.

.. In the *OpenShift disconnected installation tools* section, select the *OS type* and *Architecture type* of the *OpenShift Client (oc) mirror plugin* from the dropdown menus.

.. Click *Download* to save the file.

. Extract the archive by running the following command:
+
[source,terminal]
----
$ tar xvzf oc-mirror.tar.gz
----

. If necessary, update the plugin file to be executable by running the following command:
+
[source,terminal]
----
$ chmod +x oc-mirror
----
+
[NOTE]
====
Do not rename the `oc-mirror` file.
====

. Install the oc-mirror CLI plugin by placing the file in your `PATH`, for example `/usr/local/bin`, by running the following command:
+
[source,terminal]
----
$ sudo mv oc-mirror /usr/local/bin/.
----

.Verification

ifdef::oc-mirror[]
* Verify that the oc-mirror plugin v1 is successfully installed by running the following command:
+
[source,terminal]
----
$ oc mirror help --v1
----
endif::[]

ifdef::oc-mirror-v2[]
* Verify that the oc-mirror plugin v2 is successfully installed by running the following command:
+
[source,terminal]
----
$ oc mirror --v2 --help
----
endif::[]

ifeval::["{context}" == "about-installing-oc-mirror-v2"]
:!oc-mirror-v2:
endif::[]

ifeval::["{context}" == "installing-mirroring-disconnected"]
:!oc-mirror:
endif::[]