// Module included in the following assemblies:
//
// * storage/persistent_storage/persistent_storage_local/persistent-storage-using-lvms.adoc

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

[role="_abstract"]
You can install {lvms} by using the OpenShift CLI (`oc`) to dynamically provision local storage on clusters with limited resources.

[NOTE]
====
The default namespace for the {lvms} Operator is `openshift-lvm-storage`.
====

.Prerequisites
* You have installed the OpenShift CLI (`oc`).
* You have logged in to {product-title} as a user with `cluster-admin` and Operator installation permissions.

.Procedure
. Create a YAML file with the configuration for creating a namespace:
+
.Example YAML configuration for creating a namespace
[source,yaml]
----
apiVersion: v1
kind: Namespace
metadata:
  labels:
    openshift.io/cluster-monitoring: "true"
    pod-security.kubernetes.io/enforce: privileged
    pod-security.kubernetes.io/audit: privileged
    pod-security.kubernetes.io/warn: privileged
  name: openshift-lvm-storage
----

. Create the namespace by running the following command:
+
[source,terminal]
----
$ oc create -f <file_name>
---- 

. Create an `OperatorGroup` CR YAML file:
+
.Example `OperatorGroup` CR
[source,yaml]
----
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: openshift-storage-operatorgroup
  namespace: openshift-lvm-storage
spec:
  targetNamespaces:
  - openshift-storage
----

. Create the `OperatorGroup` CR by running the following command:
+
[source,terminal]
----
$ oc create -f <file_name> 
----

. Create a `Subscription` CR YAML file:
+
.Example `Subscription` CR
[source,yaml]
----
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: lvms
  namespace: openshift-lvm-storage
spec:
  installPlanApproval: Automatic
  name: lvms-operator
  source: redhat-operators
  sourceNamespace: openshift-marketplace
----

. Create the `Subscription` CR by running the following command:
+
[source,terminal]
----
$ oc create -f <file_name> 
----

.Verification

. To verify that {lvms} is installed, run the following command:
+
[source,terminal]
----
$ oc get csv -n openshift-lvm-storage -o custom-columns=Name:.metadata.name,Phase:.status.phase
----
+
.Example output
[source,terminal]
----
Name                         Phase
4.13.0-202301261535          Succeeded
----
