> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lekalao.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> From nothing to a first account, on a Linux server.

This guide assumes Debian or Ubuntu, an application in `/var/www/lekalao` and a system user named `lekalao`. Adjust the paths to your own server.

<Steps>
  <Step title="Get the code">
    ```bash theme={null}
    sudo -u lekalao git clone <your-repository> /var/www/lekalao
    cd /var/www/lekalao
    ```
  </Step>

  <Step title="Install the dependencies">
    ```bash theme={null}
    composer install --no-dev --optimize-autoloader
    npm ci
    npm run build
    ```
  </Step>

  <Step title="Create the database">
    ```bash theme={null}
    sudo -u postgres createuser --pwprompt lekalao
    sudo -u postgres createdb --owner=lekalao lekalao
    ```
  </Step>

  <Step title="Write the .env">
    ```bash theme={null}
    cp .env.example .env
    php artisan key:generate
    ```

    Then, at the very least:

    ```dotenv .env theme={null}
    APP_NAME=Lekalao
    APP_ENV=production
    APP_DEBUG=false
    APP_URL=https://lekalao.example.com
    APP_LOCALE=en

    DB_CONNECTION=pgsql
    DB_HOST=127.0.0.1
    DB_PORT=5432
    DB_DATABASE=lekalao
    DB_USERNAME=lekalao
    DB_PASSWORD=…

    QUEUE_CONNECTION=redis
    CACHE_STORE=redis
    SESSION_DRIVER=redis
    REDIS_HOST=127.0.0.1

    MAIL_MAILER=smtp
    MAIL_HOST=smtp.example.com
    MAIL_PORT=587
    MAIL_USERNAME=…
    MAIL_PASSWORD=…
    MAIL_FROM_ADDRESS=lekalao@example.com
    MAIL_FROM_NAME=Lekalao
    ```

    The `MAIL_*` settings only carry Lekalao's own e-mails (invitations, passwords) until a default provider is configured in the interface. Every option is in [Configuration](/self-hosting/configuration).

    <Warning>
      Back up `APP_KEY`. It encrypts the providers' credentials, the webhook secrets and the two-factor secrets. Losing it makes them unreadable.
    </Warning>
  </Step>

  <Step title="Prepare the database and the files">
    ```bash theme={null}
    php artisan migrate --force
    php artisan storage:link
    php artisan config:cache
    php artisan route:cache
    php artisan view:cache
    ```
  </Step>

  <Step title="Wire up the web server">
    ```nginx /etc/nginx/sites-available/lekalao theme={null}
    server {
        listen 443 ssl http2;
        server_name lekalao.example.com;
        root /var/www/lekalao/public;

        ssl_certificate     /etc/letsencrypt/live/lekalao.example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/lekalao.example.com/privkey.pem;

        client_max_body_size 25M;
        index index.php;

        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }

        location ~ \.php$ {
            fastcgi_pass unix:/run/php/php8.4-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
            include fastcgi_params;
        }

        location ~ /\.(?!well-known) {
            deny all;
        }
    }
    ```

    `client_max_body_size` has to let imports (20 MB) and media through.
  </Step>

  <Step title="Start the processes">
    Horizon and the cron line: see [Processes](/self-hosting/processes).
  </Step>

  <Step title="Create the first account">
    Open `https://lekalao.example.com/register`. Only the first account can
    register; it becomes the **platform administrator** and the owner of the
    first team. Everyone else is invited from **Settings → Team**.
  </Step>

  <Step title="Check it">
    ```bash theme={null}
    php artisan lekalao:diagnose
    ```

    Then follow the [quickstart](/guide/quickstart): sending provider, domain, postal address, first list.
  </Step>
</Steps>

## Demonstration data

To look around without risking anything, on a test installation only:

```bash theme={null}
php artisan db:seed --class=DemoDataSeeder
```
