---
metadata:
  - name: generator
    content: Diplodoc Platform v5.63.0
alternate:
  - en/cookbook/basic-setup
  - ru/cookbook/basic-setup
  - href: en/cookbook/basic-setup.md
    type: text/markdown
    title: Markdown version
csp:
  - script-src:
      - https://mc.yandex.ru
    img-src:
      - https://mc.yandex.ru
    connect-src:
      - https://mc.yandex.ru
      - wss://mc.yandex.ru
    child-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-ancestors:
      - 'blob:'
      - https://mc.yandex.ru
canonical: en/cookbook/basic-setup.html
vcsPath: en/cookbook/basic-setup.md
---
# Basic installation on a VM

To get your DataLens instance up and running, follow the steps below.

## How to download the distribution archive

The distribution is issued to the organization. You can look up the `org_id` in [Cloud Center](https://center.yandex.cloud/).

{% note tip %}

For more information about organizations and how to create one, see [this Yandex Identity Hub guide](https://yandex.cloud/en/organization/).

{% endnote %}

Once you get a distribution for your organization, you can proceed with the download.

1. Click the [download link](https://datalens.ru/download).

1. Download the latest distribution version.

1. Read the license agreement and click **Continue**.


1. Copy the link you get.

1. On the target VM, run the following command by substituting the link:

    ```shell
    curl -L https://clck.ru/<...> -o datalens-enterprise.tar
    ```

1. Create a directory and unpack the archive into it:

    ```shell
    mkdir -p ./datalens-enterprise
    tar -xvf datalens-enterprise.tar --directory ./datalens-enterprise
    ```

1. Navigate to the directory you created. You will use it to complete the next steps.

    ```shell
    cd ./datalens-enterprise
    ```

## Running the distribution

1. Make sure you are in the distribution folder, `./datalens-enterprise`.

1. Run the installation command using the `datalens-course.local` domain.

    Your main installation management tool is the `./init.sh` script. For a basic installation on a clean VM, provide it the following keys:

    * `--k3s-install`: Commands the script to install the local lightweight K3s Kubernetes distribution.

    * `--ingress-domain <domain>`: Specifies the domain name for access to DataLens, e.g., `datalens-course.local`. You can also use automatic DNS configuration using `nip`: to do this, enter the IP address of your machine and add `.nip.io`, e.g., `192.168.10.2.nip.io`.

    * `--ingress-tls` and `--ingress-tls-gen`: Enable HTTPS and automatically generate a self-signed SSL certificate for the specified domain.

    ```shell
    # Replace <domain> with your domain. For test purposes, datalens-course.local or the IP address of the VM + .nip.io will do.
    # You need to run the command from the distribution folder, ./datalens-enterprise

    ./init.sh \
    --k3s-install \
    --ingress-domain datalens-course.local \
    --ingress-tls \
    --ingress-tls-gen
    ```

    This process will take a few minutes. The script will install K3s, push Docker images into it, and deploy all DataLens components.

1. Wait for the installation to complete. At the end, you will see a message about a successful release deployment.

1. If you are using a `.local` domain, add the `<VM IP address> datalens-course.local` line to your local `/etc/hosts` file so that the browser can find the server.

1. Then open the interface at `https://datalens-course.local`. Accept the risk, as you are using a self-signed certificate, and log in with the `admin` username and the obtained password.

To change installation options, e.g., to add the ability to download `--files`, you do not need to download the distribution again: simply run the installation command one more time. This time, you do not need to provide `--k3s-install` since the K3s cluster has already been created.

## Updating a distribution

To update, simply unpack the new version over the old one and initialize again. You can leave the initialization string unchanged, but add the `--k3s-image-load` parameter. You do not need to provide `--k3s-install` when reinitializing since the K3s cluster is already installed.

## Managing administrator access

On first installation, the system will automatically generate a complex password for the `admin` user. To get it, run this command:

```shell
./init.sh --get-admin-password
```

Save the password. If you lose it, you can reset it and generate a new one.

## Managing keys and secrets

DataLens uses the following types of keys:

RSA keys for the authentication service

:   The private key is used to sign user tokens, and the public key, to verify them. The keys are generated automatically on first installation. If required, you can regenerate them using the `--auth-rsa-gen` flag.

`CONTROL_API_CRYPTO_KEY`

:   The key is used to encrypt sensitive data (passwords or tokens) in connection fields. It is generated and saved automatically. If this key is lost, DataLens will not be able to decrypt existing connection credentials. In which case you need to reset the encryption key and re-enter all passwords.

You do not need to manage these keys manually during a basic installation, but make sure you know what they are used for.

## Additional features

You need to enable some features in DataLens separately to ensure the basic installation uses minimal resources.

To enable additional features (`ChartEditor` or file connections), follow the instructions in the `README.md` file and append the initialization string with the `--editor` and `--files` flags. Result:

```shell
./init.sh --k3s-install --ingress-domain <domain> --ingress-tls --ingress-tls-gen --editor --files
```

## Mirroring Docker images

If the VM does not have internet access, but you have an internal Docker Registry (e.g., Harbor, Nexus, Yandex Container Registry), first upload the images from the distribution there using this command:

```shell
# docker-config.json: File with registry access details
# registry.my-company.tech: Registry address
./init.sh \
--docker-image-load \
--docker-image-push \
--docker-registry registry.my-company.tech \
--docker-config ./help/docker-config.example.json
```

When installing on the target system, specify this `registry` so that Kubernetes downloads images from it, rather than from local storage.

## Summary

You have deployed and signed in to a DataLens On-premises instance. You have learned how to use the `init.sh` script to quickly set and manage the administrator password.
