# Linux server or Raspberry Pi (no Docker)

The installer sets the hub up as a system service on a 64-bit Linux with systemd: Debian, Ubuntu,
Raspberry Pi OS (64-bit) and most others.

```sh
curl -fsSL https://raw.githubusercontent.com/OpenKedai/openkedai/main/deploy/install.sh | sudo sh
```

It:

- downloads Node.js 22 (from nodejs.org) and OpenKedai (from the project's GitHub releases),
  checking both against their published checksums;
- installs them in `/opt/openkedai`, with your data in `/var/lib/openkedai` and settings in
  `/etc/openkedai/openkedai.env`;
- creates an `openkedai` system user and the `openkedai` service, which starts on boot;
- prints the back office's address and the setup code.

Then open the address in a browser and choose **Set up a new shop**.

## Everyday commands

```sh
sudo systemctl status openkedai          # running?
journalctl -u openkedai -f               # the log
journalctl -u openkedai | grep "Setup code"
sudo nano /etc/openkedai/openkedai.env   # settings, then:
sudo systemctl restart openkedai
```

## Updating

Run the installer again. Your data and settings stay; the previous version is kept in
`/opt/openkedai/releases/`. To install a particular version:

```sh
curl -fsSL https://raw.githubusercontent.com/OpenKedai/openkedai/main/deploy/install.sh | sudo OPENKEDAI_VERSION=0.9.0 sh
```

To go back to the previous version: point `/opt/openkedai/app` at the other folder in
`/opt/openkedai/releases/` (`sudo ln -sfn /opt/openkedai/releases/<older> /opt/openkedai/app`) and
restart. An update that changed a shop's database kept a copy of it first, in
`/var/lib/openkedai/backups/pre-migration/`.

## Raspberry Pi

- Use **Raspberry Pi OS (64-bit)** on a Pi 4 or 5. A 32-bit system isn't supported.
- SD cards wear out and fail. Turn on [copies to S3-compatible storage](https://docs.openkedai.com/self-hosting/backups/), or keep the
  data on a USB SSD.
- At a shop, give the Pi a fixed address in the router: see [On the shop's network](https://docs.openkedai.com/self-hosting/lan-hub/).

## Uninstalling

```sh
sudo systemctl disable --now openkedai
sudo rm -rf /opt/openkedai /etc/systemd/system/openkedai.service /etc/openkedai
sudo userdel openkedai
```

That leaves your data in `/var/lib/openkedai`; delete it too once you're sure you have a copy.
