# Offline Install

> install pigsty without Internet access?
---

Pigsty [**install**](/docs/install) from Internet upstream by default, while some environments are isolated from the Internet.
To address this issue, Pigsty supports offline installation from [**offline packages**](#offline-package).


### Step 1
        Download the pigsty offline package, put it to `/tmp/pkg.tgz`

### Step 2
        Download the pigsty source package, extract it (assume `~/pigsty`)

### Step 3
        `cd ~/pigsty; ./bootstrap`, it will extract the pkg and use the local repo

### Step 4
        `vi ~/pigsty.yml`, overwrite [`node_repo_modules`](/docs/node/param#node_repo_modules) to `local` to use the local repo

### Step 5
        Run `./install.yml` as usual. it will install everything from the local repo.



------

## What is offline package?

Offline package packs all the required RPM/DEB packages and their dependencies;
it is essentially a snapshot tarball of local APT / YUM repo, taken after a normal [installation](/docs/install/start).

You can find these packages from the [GitHub release page](https://github.com/pgsty/pigsty/releases/latest), for example:

```
d6e9d6fa73620460ceb373a0c2f41ebe  pigsty-v3.7.0.tgz
987529769d85a3a01776caefefa93ecb  pigsty-pkg-v3.7.0.d12.aarch64.tgz
2d8272493784ae35abeac84568950623  pigsty-pkg-v3.7.0.d12.x86_64.tgz
090cc2531dcc25db3302f35cb3076dfa  pigsty-pkg-v3.7.0.d13.x86_64.tgz
ddc54a9c4a585da323c60736b8560f55  pigsty-pkg-v3.7.0.el10.aarch64.tgz
d376e75c490e8f326ea0f0fbb4a8fd9b  pigsty-pkg-v3.7.0.el10.x86_64.tgz
8c2deeba1e1d09ef3d46d77a99494e71  pigsty-pkg-v3.7.0.el8.aarch64.tgz
9795e059bd884b9d1b2208011abe43cd  pigsty-pkg-v3.7.0.el8.x86_64.tgz
08b860155d6764ae817ed25f2fcf9e5b  pigsty-pkg-v3.7.0.el9.aarch64.tgz
1ac430768e488a449d350ce245975baa  pigsty-pkg-v3.7.0.el9.x86_64.tgz
e033aaf23690755848db255904ab3bcd  pigsty-pkg-v3.7.0.u22.aarch64.tgz
cc022ea89181d89d271a9aaabca04165  pigsty-pkg-v3.7.0.u22.x86_64.tgz
0e978598796db3ce96caebd76c76e960  pigsty-pkg-v3.7.0.u24.aarch64.tgz
48223898ace8812cc4ea79cf3178476a  pigsty-pkg-v3.7.0.u24.x86_64.tgz
```

We usually release offline packages for the following [linux distro](/docs/prepare/linux), with the latest OS minor version.

| EL Distribution |                        Code                         |                          Arch                          |                                            OS Code                                            |                                                              Package                                                              |
|:----------------|:---------------------------------------------------:|:------------------------------------------------------:|:---------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------:|
| RockyLinux 9.6  | <span class="font-bold text-sky-700">EL9</span> | <span class="font-bold text-sky-600">x86_64</span> |  [`el9.x86_64`](https://github.com/pgsty/pigsty/blob/v3.7.0/roles/node_id/vars/el9.x86_64.yml)  |  [`pigsty-pkg-v3.7.0.el9.x86_64.tgz`](https://github.com/pgsty/pigsty/releases/download/v3.7.0/pigsty-pkg-v3.7.0.el9.x86_64.tgz)  |
| Ubuntu 24.04.2  | <span class="font-bold text-sky-700">U24</span> | <span class="font-bold text-sky-600">x86_64</span> |  [`u24.x86_64`](https://github.com/pgsty/pigsty/blob/v3.7.0/roles/node_id/vars/u24.x86_64.yml)  |  [`pigsty-pkg-v3.7.0.u24.x86_64.tgz`](https://github.com/pgsty/pigsty/releases/download/v3.7.0/pigsty-pkg-v3.7.0.u24.x86_64.tgz)  |
| Debian 12.11    | <span class="font-bold text-sky-700">D12</span> | <span class="font-bold text-sky-600">x86_64</span> |  [`d12.x86_64`](https://github.com/pgsty/pigsty/blob/v3.7.0/roles/node_id/vars/d12.x86_64.yml)  |  [`pigsty-pkg-v3.7.0.d12.x86_64.tgz`](https://github.com/pgsty/pigsty/releases/download/v3.7.0/pigsty-pkg-v3.7.0.d12.x86_64.tgz)  |
| RockyLinux 9.6  | <span class="font-bold text-sky-700">EL9</span> | <span class="font-bold text-sky-600">x86_64</span> | [`el9.aarch64`](https://github.com/pgsty/pigsty/blob/v3.7.0/roles/node_id/vars/el9.aarch64.yml) | [`pigsty-pkg-v3.7.0.el9.aarch64.tgz`](https://github.com/pgsty/pigsty/releases/download/v3.7.0/pigsty-pkg-v3.7.0.el9.aarch64.tgz) |
| Ubuntu 24.04.2  | <span class="font-bold text-sky-700">U24</span> | <span class="font-bold text-sky-600">x86_64</span> | [`u24.aarch64`](https://github.com/pgsty/pigsty/blob/v3.7.0/roles/node_id/vars/u24.aarch64.yml) | [`pigsty-pkg-v3.7.0.u24.aarch64.tgz`](https://github.com/pgsty/pigsty/releases/download/v3.7.0/pigsty-pkg-v3.7.0.u24.aarch64.tgz) |
| Debian 12.11    | <span class="font-bold text-sky-700">D12</span> | <span class="font-bold text-sky-600">x86_64</span> | [`d12.aarch64`](https://github.com/pgsty/pigsty/blob/v3.7.0/roles/node_id/vars/d12.aarch64.yml) | [`pigsty-pkg-v3.7.0.d12.aarch64.tgz`](https://github.com/pgsty/pigsty/releases/download/v3.7.0/pigsty-pkg-v3.7.0.d12.aarch64.tgz) |

https://github.com/pgsty/pigsty/releases/download/v3.7.0/pigsty-pkg-v3.7.0.el9.x86_64.tgz

**Offline Package is made for specific Linux OS Major.Minor Version**

Using offline package on lower minor version may have a chance of success, but it is not guaranteed.


------

## Using Offline Package {#use-offline-package}

Place the offline package at `/tmp/pkg.tgz`, navigate to the `~/pigsty` directory and execute `./bootstrap` to extract and use the offline package.
Pigsty will extract it to `/www/pigsty`, configure the system repository list to enable this repository, and install `ansible` from it.

Since Pigsty v3.6, most configuration templates no longer build local software repositories by default, but install packages directly from Internet upstream.
A few configuration templates such as `rich` and `full` still retain the old behavior — building local repositories first before using them.

If you want to use the extracted and configured offline package in your own configuration, please modify the following settings:

- [`repo_enabled`](/docs/infra/param#repo_enabled): Set this to `true` to build local software repo (explicitly disabled in most templates)
- [`node_repo_modules`](/docs/node/param#node_repo_modules): Set this to `local` to install from local software repo for all nodes in the env
  - In most templates, this parameter is now explicitly configured as: `node,infra,pgsql`, which installs software packages directly from upstream repos.
  - Setting it to `local` will use the local repo alone, which is fastest and more reliable if applicable.
  - If you want to use both local and upstream repositories, you can set it to `local,node,infra,pgsql`



--------

## Pros and Cons

If you are using the exact same OS minor version above, using offline packages is advised.

**Advantages of using offline package**

- Official offline packages are tested.
- The easiest way to deliver on Internet isolated environment.
- Speed up the installation process by pre-download all packages in one-pass.
- The snapshot is ensured working without worrying about upstream dependency breakage.


**Disadvantages of using offline package**

- If OS minor version not match, OS rpm/deb packages may break
- It may not contain the latest updates and OS security patches.



------

## Bootstrap

The `bootstrap` script will automatically detect `/tmp/pkg.tgz` and extract it to `/www/pigsty` by default.
It will also set up the os package manager repo file and install `ansible` and other utils.

**Where are my repo files?**

Bootstrap will **wipe-out** existing repo by default to ensure only the required repos are installed.

You can find them in `/etc/yum.repos.d/backup` (EL) or `/etc/apt/backup` (debian / ubuntu)


**If you want to keep your existing repo**

You can use the `-k|--keep` parameter to keep the existing repo files intact:

```bash
./bootstrap -k # or --keep
```



------

## Make offline package

If your OS choice is not in the default offline package offering list,
you can make your own offline package with the built-in [**`cache.yml`**](https://github.com/pgsty/pigsty/blob/v3.7.0/cache.yml) playbook.


### Step 1
        Find a node running exact same OS version with the Internet access

### Step 2
        Run standard [online installation procedure](/docs/install) (use the `rich` template: `configure -c rich`)

### Step 3
        `cd ~/pigsty; ./cache.yml`: make and fetch the offline package to `dist/${version}/`

### Step 4
        Copy the offline package to the environment without Internet access (ftp, scp, usb,...)



**Behavior Change in v3.6**

Since Pigsty v3.6, most configuration templates install packages directly from Internet upstream, rather than downloading to the admin node first to build a local repository and then installing from it.
You can restore the previous default behavior by adjusting parameters, which is useful if you need to build your own offline packages:

- [`repo_enabled`](/docs/infra/param#repo_enabled): set to `true` to build local software repo
- [`node_repo_modules`](/docs/node/param#node_repo_modules): set to `local` to install from local repo

Some configuration templates, such as `rich` and `full`, still retain the old behavior — building local repositories first before using them, so no adjustment is needed.


We offer [paid service](/docs/service) to make offline packages for precise Linux major.minor versions. (`$30`)



------

## Hybrid Approach

There's a hybrid approach to using the offline package and do online install upon it.
This could be useful if your OS repo is a local Intranet repo.

Let's say you are using RockyLinux 9.5, but the official offline package is made for RockyLinux 9.6.

You can use the `el9` offline packages, and run the `make repo-build` before the `./install.yml`,
to force Pigsty to perform a repo build task (`infra.repo`).

If you want to use the latest version or resolve any dependency conflict, you can remove these rpm/deb and run `make repo-build`,
pigsty will re-download them from the upstream repo.
