# Elastic mirror (pkg.shecan.ir)

> Mirror of the Elastic package repositories on artifacts.elastic.co (packages/<n>.x apt and yum: Elasticsearch, Kibana, Logstash, Beats, Elastic Agent) and the signing key GPG-KEY-elasticsearch. artifacts.elastic.co refuses Iranian addresses (403).

- Upstream: artifacts.elastic.co
- Mirror URL: <https://mirror-elastic.pkg.shecan.ir/>
- Clients: apt, dnf, yum
- Service status: <https://pkg.shecan.ir/status.json> (key `elastic`; up/down, refreshed every minute)
- Guide (Persian, HTML): <https://pkg.shecan.ir/mirrors/elastic/>
- JSON: <https://pkg.shecan.ir/api/v1/mirrors/elastic.json>

## Limitations

- apt and dnf still verify the official Elastic signature. For version 8 replace 9.x with 8.x in the paths.
- Only the apt/yum repositories (packages/<n>.x) and the key are served; tar.gz/zip downloads (artifacts.elastic.co/downloads) and Docker images (docker.elastic.co) are not.

## Setup

Every block below is the exact text of the Persian guide. Unless marked otherwise it is run against the live mirror in a disposable container on every catalog change; "checked by hand" blocks cannot run in a container. Change a machine only with its owner's permission: back up existing configuration first, merge into existing files instead of overwriting them, and keep the "Undo" step at hand.

### apt: persistent (user- or system-wide configuration)

Run, Ubuntu or Debian (linux)

```sh
sudo install -d /etc/apt/keyrings
sudo curl -fsSLo /etc/apt/keyrings/elastic.asc https://mirror-elastic.pkg.shecan.ir/GPG-KEY-elasticsearch
echo "deb [signed-by=/etc/apt/keyrings/elastic.asc] https://mirror-elastic.pkg.shecan.ir/packages/9.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-9.x.list
sudo apt update
```

Undo / restore the default, Ubuntu or Debian (linux)

```sh
sudo rm -f /etc/apt/sources.list.d/elastic-9.x.list /etc/apt/keyrings/elastic.asc
sudo apt update
```

Run, Ubuntu or Debian (linux) (checked by hand)

```sh
sudo apt install -y elasticsearch
```

### dnf, yum: persistent (user- or system-wide configuration)

Configuration file (linux): `/etc/yum.repos.d/elastic.repo`

```ini
[elastic-9.x]
name=Elastic repository for 9.x packages
baseurl=https://mirror-elastic.pkg.shecan.ir/packages/9.x/yum
gpgcheck=1
gpgkey=https://mirror-elastic.pkg.shecan.ir/GPG-KEY-elasticsearch
enabled=1
type=rpm-md
```

Undo / restore the default (linux)

```sh
sudo rm -f /etc/yum.repos.d/elastic.repo
sudo dnf clean all
```

### dnf: persistent (user- or system-wide configuration)

Run (linux) (checked by hand)

```sh
sudo dnf install -y elasticsearch
```
