# Offline Installation

TiOPS now have basic support of installing and deploying TiDB clusters in an offline environment (where no internet access is available).

The basic procedures are as below.

## Prepare offline installation bundle

First install TiOPS on a system with proper internet access, then use the `offline.py` script to prepare the bundle.

```
$ tiops-offline-bundler download --dir <output_dir> --tidb-version 3.0.6
```

All necessary packages and binaries will be downloaded into `<output_dir>`.

Run the script multiple times with different version numbers can prepare the bundle for multiple versions.

And then copy the directory to the console server in offline environment. Assume it is named as `tiops-offline-packages`.

## Use local packages when deploying TiDB cluster

When `deploy` and `upgrade` of TiDB cluster with `tiops`, an optional argument `--local-pkg` can be used to specify the locaion of offline packages.

```
$ tiops tidb cluster upgrade -n <cluster_name> --tidb-version 3.0.6 --local-pkg path/to/tiops-offline-packages
```

The packages in `tiops-offline-packages` will be copied to the user's home directory, so if you want to deploy a new TiDB cluster with the same verion, or upgrade other cluster to this version, `--local-pkg` is no longer needed.
