// Module included in the following assemblies:
//
// * support/support-log-gather-operator-install.adoc

:_mod-docs-content-type: PROCEDURE
[id="support-log-gather-install-cli_{context}"]
= Installing {support-log-gather} by using the CLI

[role="_abstract"]
To enable automated log collection for support cases, you can install {support-log-gather} from the command-line interface (CLI).

:FeatureName: Support Log Gather
include::snippets/technology-preview.adoc[]

.Prerequisites

* You have access to the cluster with `cluster-admin` privileges.

.Procedure

. Create a new project named `must-gather-operator` by running the following command:
+
[source,terminal]
----
$ oc new-project must-gather-operator
----

. Create an `OperatorGroup` object:

.. Create a YAML file, for example, `operatorGroup.yaml`, that defines the `OperatorGroup` object:
+
[source,yaml]
----
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: must-gather-operator
  namespace: must-gather-operator
spec: {}
----

.. Create the `OperatorGroup` object by running the following command:
+
[source,terminal]
----
$ oc create -f operatorGroup.yaml
----

. Create a `Subscription` object:

.. Create a YAML file, for example, `subscription.yaml`, that defines the `Subscription` object:
+
[source,yaml]
----
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: support-log-gather-operator
  namespace: must-gather-operator
spec:
  channel: tech-preview
  name: support-log-gather-operator
  source: redhat-operators
  sourceNamespace: openshift-marketplace
  installPlanApproval: Automatic
----

.. Create the `Subscription` object by running the following command:
+
[source,terminal]
----
$ oc create -f subscription.yaml
----

.Verification

. Verify the status of the pods in the Operator namespace by running the following command.
+
[source,terminal]
----
$ oc get pods
----
+
.Example output
[source,terminal]
----
NAME                                                              READY   STATUS      RESTARTS   AGE
must-gather-operator-657fc74d64-2gg2w                             1/1     Running     0          13m
----
+
The status of all the pods must be `Running`.

. Verify that the subscription is created by running the following command:
+
[source,terminal]
----
$ oc get subscription -n must-gather-operator
----
+
.Example output
[source,terminal]
----
NAME                          PACKAGE                       SOURCE            CHANNEL
support-log-gather-operator   support-log-gather-operator   redhat-operators  tech-preview
----

. Verify that the Operator is installed by running the following command:
+
[source,terminal]
----
$ oc get csv -n must-gather-operator
----
+
.Example output
[source,terminal]
----
NAME                                  DISPLAY                VERSION   REPLACES   PHASE
support-log-gather-operator.v4.22.0   support log gather     4.22.0               Succeeded
----