# Installation

> Install Stackable Operator for Apache Hive with MinIO and PostgreSQL using stackablectl or Helm. Follow the guide for easy setup and configuration.

On this page you install the Stackable operator for Apache Hive and all required dependencies. For the installation of the dependencies and operators you can use Helm or `stackablectl`.

The `stackablectl` command line tool is the recommended way to interact with operators and dependencies. Follow the [installation steps](https://docs.stackable.tech/management/stable/stackablectl/installation/index.md) for your platform if you choose to work with `stackablectl`.

## Dependencies

First you need to install MinIO and PostgreSQL instances for the Hive metastore. PostgreSQL is required as a database for Hive’s metadata, and MinIO is used as a data store, which the Hive metastore also needs access to.

There are two ways to install the dependencies:

1.  Using [stackablectl](https://docs.stackable.tech/management/stable/stackablectl/index.md)

2.  Using Helm


> **Warning:** The dependency installations in this guide are only intended for testing and not suitable for production!

### stackablectl

`stackablectl` was designed to install Stackable components, but its [Stacks](https://docs.stackable.tech/management/stable/stackablectl/commands/stack/index.md) feature can also be used to install arbitrary Helm Charts. You can install MinIO and PostgreSQL using the Stacks feature as follows, but a simpler method via Helm is shown [below](https://docs.stackable.tech/home/stable/hive/getting_started/installation/index.md).

```bash
stackablectl \
--stack-file stackablectl-hive-postgres-minio-stack.yaml \
--release-file release.yaml \
stack install hive-minio-postgres
```

Create a file called `minio-stack.yaml`:

```yaml
---
releaseName: minio
name: minio
repo:
  name: minio
  url: https://charts.min.io/
version: 5.4.0
options:
  rootUser: root
  rootPassword: rootroot
  mode: standalone
  users:
    - accessKey: hive
      secretKey: hivehive
      policy: readwrite
  buckets:
    - name: hive
      policy: public
  resources:
    requests:
      memory: 2Gi
  service:
    type: NodePort
    nodePort: null
  consoleService:
    type: NodePort
    nodePort: null
```

As well as `postgres-stack.yaml`:

```yaml
---
releaseName: postgresql
name: postgresql
repo:
  name: bitnami
  url: https://charts.bitnami.com/bitnami/
version: 16.5.0
options:
  global:
    security:
      allowInsecureImages: true
  image:
    repository: bitnamilegacy/postgresql
  volumePermissions:
    enabled: false
    image:
      repository: bitnamilegacy/os-shell
    securityContext:
      runAsUser: auto
  metrics:
    image:
      repository: bitnamilegacy/postgres-exporter
  primary:
    extendedConfiguration: |
      password_encryption=md5
  auth:
    username: hive
    password: hive
    database: hive
```

And then reference both files in another file called `stackablectl-hive-postgres-minio-stack.yaml`:

```yaml
---
stacks:
  hive-minio-postgres:
    stackableRelease: hive-getting-started
    description: Stack for Hive getting started guide
    stackableOperators:
      - commons
      - listener
      - secret
      - hive
    labels:
      - minio
      - postgresql
    manifests:
      - helmChart: minio-stack.yaml
      - helmChart: postgres-stack.yaml
```

Also create a `release.yaml` file:

```yaml
---
releases:
  hive-getting-started:
    releaseDate: 2023-03-14
    description: Demo / Test release for Hive getting started guide
    products:
      commons:
        operatorVersion: 26.7.0
      hive:
        operatorVersion: 26.7.0
      listener:
        operatorVersion: 26.7.0
      secret:
        operatorVersion: 26.7.0
```

The release definition already references the required operators for this Getting Started guide.

Now call `stackablectl` and reference those two files:

```bash
stackablectl \
--stack-file stackablectl-hive-postgres-minio-stack.yaml \
--release-file release.yaml \
stack install hive-minio-postgres
```

This installs MinIO and PostgreSQL as defined in the Stacks, as well as the operators. You can now skip the [Stackable Operators](https://docs.stackable.tech/home/stable/hive/getting_started/installation/index.md) step that follows next.

> **Tip:** Consult the [Quickstart](https://docs.stackable.tech/management/stable/stackablectl/quickstart/index.md) to learn more about how to use `stackablectl`.

### Helm

In order to install the MinIO and PostgreSQL dependencies via Helm, you have to deploy two charts.

#### Minio

```bash
helm install minio \
  --version 5.4.0 \
  --namespace default \
  --set mode=standalone \
  --set replicas=1 \
  --set persistence.enabled=false \
  --set "buckets[0].name=hive,buckets[0].policy=none" \
  --set "users[0].accessKey=hive,users[0].secretKey=hivehive,users[0].policy=readwrite" \
  --set resources.requests.memory=1Gi \
  --set service.type=NodePort,service.nodePort=null \
  --set consoleService.type=NodePort,consoleService.nodePort=null \
  --repo https://charts.min.io/ minio
```

#### PostgresSQL

```bash
helm install postgresql oci://registry-1.docker.io/bitnamicharts/postgresql \
  --version 16.5.0 \
  --namespace default \
  --set image.repository=bitnamilegacy/postgresql \
  --set volumePermissions.image.repository=bitnamilegacy/os-shell \
  --set metrics.image.repository=bitnamilegacy/postgres-exporter \
  --set global.security.allowInsecureImages=true \
  --set auth.username=hive \
  --set auth.password=hive \
  --set auth.database=hive \
  --set primary.extendedConfiguration="password_encryption=md5" \
  --wait
```

After the dependencies are deployed, you can start to install the operators.

## Stackable Operators

There are 2 ways to run Stackable Operators:

1.  Using [stackablectl](https://docs.stackable.tech/management/stable/stackablectl/index.md)

2.  Using Helm


### stackablectl

Run the following command to install all operators necessary for Apache Hive:

```bash
stackablectl operator install \
  commons=26.7.0 \
  secret=26.7.0 \
  listener=26.7.0 \
  hive=26.7.0
```

The tool prints

```
Installed commons=26.7.0 operator
Installed secret=26.7.0 operator
Installed listener=26.7.0 operator
Installed hive=26.7.0 operator
```

### Helm

Run the following commands Helm to install the operators via Helm

> **Note:** `helm repo` subcommands are not supported for OCI registries. The operators are installed directly, without adding the Helm Chart repository first.

Install the Stackable operators:

```bash
helm install --wait commons-operator oci://oci.stackable.tech/sdp-charts/commons-operator --version 26.7.0
helm install --wait secret-operator oci://oci.stackable.tech/sdp-charts/secret-operator --version 26.7.0
helm install --wait listener-operator oci://oci.stackable.tech/sdp-charts/listener-operator --version 26.7.0
helm install --wait hive-operator oci://oci.stackable.tech/sdp-charts/hive-operator --version 26.7.0
```

Helm deploys the operators in a Kubernetes Deployment. Each operator installs and maintains its own CRDs at startup (see [CustomResourceDefinition (CRD) maintenance](https://docs.stackable.tech/home/stable/concepts/maintenance/crds/index.md)).

## What’s next

[Set up an Apache Hive cluster](https://docs.stackable.tech/home/stable/hive/getting_started/first_steps/index.md)
