# OAK4 Offline and Production Setup

Use this guide when the OAK4 does not have direct internet access and you need a repeatable offline or production-line workflow.

Before you begin:

 * install [`oakctl`](https://docs.luxonis.com/software-v3/oak-apps/oakctl.md) on the host PC.
 * make sure your device has Luxonis OS version 1.37.0 or higher. Follow [this
   guide](https://docs.luxonis.com/software-v3/sw-stack/luxonis-os.md) to update if your device is on an older version.

## Power the camera

| Powering method | Connection |
| --- | --- |
| USB for both power and data. The camera needs at least 15W to boot, and 30W is recommended for full power. Use a PD-rated USB-C
connection; USB-A will not work in this setup. | |
| PoE+ for power and USB only for data. In this setup, USB-C and USB-A are both suitable. |  |

For more information, see [Power the
camera](https://docs.luxonis.com/hardware/platform/deploy/oak4-deployment-guide/oak4-getting-started.md).

## OS update

First download the OTA file to the host from [Luxonis OS](https://docs.luxonis.com/software-v3/sw-stack/luxonis-os.md). If a fixed
target version is already present on the host, you can use that file for the OS update instead.

Copy the OTA file onto the device, then run the update on the device:

```bash
oakctl adb root
oakctl adb push ./full_update_luxonis_ext4-<version>.zip /data/
oakctl adb shell
agentconfd update /data/full_update_luxonis_ext4-<version>.zip
# then reboot the camera by reconnecting the power
```

For more compatibility notes, see [Luxonis OS](https://docs.luxonis.com/software-v3/sw-stack/luxonis-os.md).

## Network settings

Choose how you want to prepare the setup command that sets the password, SSH state, and IP configuration.

#### Build the command manually

Use this path if you want to assemble the setup command yourself instead of generating it in the browser. Put the device into
setup mode as described in [Local Setup](https://docs.luxonis.com/hardware/platform/deploy/oak4-deployment-guide/oak4-advanced.md)

```bash
oakctl start-setup
```

then run `oakctl device setup apply` on the host PC with the flags you need.

Enable SSH and keep DHCP:

```bash
oakctl device setup apply -p <password> --dont-check-internet
```

Enable SSH and set a static IP:

```bash
oakctl device setup apply -p <password> \
  --static-ip 192.168.10.101,255.255.255.0,192.168.10.1 \
  --dont-check-internet
```

Disable SSH and set a static IP:

```bash
oakctl device setup apply -p <password> \
  --no-ssh \
  --static-ip 192.168.10.101,255.255.255.0,192.168.10.1 \
  --dont-check-internet
```

Add `--dns 10.12.102.2` if you need to override DNS. If multiple devices are available, add `-d <serial-or-ip>` to target the
correct unit. If each device needs a unique static IP, adjust only the `--static-ip` value between runs.

#### Generate command in web GUI

Use this path if you want one generated command that includes the new password, SSH enabled or disabled, and IP settings:

 1. Put the device into setup mode with `oakctl start-setup`
 2. Open [setup.luxonis.com](https://setup.luxonis.com).
 3. Open `Advanced setup using CLI`.
 4. Fill in the values you want for: * new password
     * SSH enabled or disabled
     * DHCP or static IP settings
 5. Copy the generated terminal command.
 6. Run the generated terminal command on the host PC while the device is still in setup mode.

This is the easiest way to keep setup values consistent across multiple devices. If each device needs a unique static IP,
regenerate the command for each unit or adjust only the IP-related values between runs.

For the full local setup walkthrough, additional command-line options, changing networking afterward, and SSH or ADB access
details, see [OAK4 Advanced](https://docs.luxonis.com/hardware/platform/deploy/oak4-deployment-guide/oak4-advanced.md).

## App update / installation

Prepare the built `*.oakapp` package in advance (follow [oakctl app building
guide](https://docs.luxonis.com/software-v3/oak-apps/oakctl.md) if you need to build your app). Then copy the package to the
provisioning PC and install it locally:

```bash
oakctl app install ./dist/my-app.oakapp
```

If an app with the same identifier is already installed, `oakctl app install` updates it by default. By default, a newly installed
app is enabled and running, so it will start automatically when the camera boots. Use `--enable=false` if you do not want that
behavior.

## Production workflow for many devices

For a repeatable rollout across many devices, prepare one approved artifact set and apply the same flow to each unit before it
goes on the line:

 * one target OS OTA file, for example `full_update_luxonis_ext4-<version>.zip`
 * one approved app package, for example `my-app.oakapp`
 * the password or local setup values you want on every device
 * a network plan: DHCP or a unique static IP per device

When multiple devices are connected at the same time, perform the OS update over ADB on the USB-connected unit, then use `-d` for
the later `oakctl` commands such as app installation:

```bash
oakctl app install -d <serial-or-ip> ./dist/my-app.oakapp
```

A practical per-device flow is:

 * power the device and discover it with `oakctl list`
 * if needed, generate a local setup command with [setup.luxonis.com](https://setup.luxonis.com) to set the password, SSH mode,
   and IP settings consistently
 * update the device to the approved OS version over ADB
 * install the prebuilt `*.oakapp` package
 * apply the intended network configuration
 * verify the expected OS version, app, and IP address before deployment

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
