1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-12-23 18:23:27 +01:00
ntfy/docs/install.md

238 lines
8.1 KiB
Markdown
Raw Normal View History

2021-12-18 04:38:29 +01:00
# Installing ntfy
The `ntfy` CLI allows you to [publish messages](publish.md), [subscribe to topics](subscribe/cli.md) as well as to
self-host your own ntfy server. It's all pretty straight forward. Just install the binary, package or Docker image,
2021-12-05 21:57:37 +01:00
configure it and run it. Just like any other software. No fuzz.
!!! info
The following steps are only required if you want to **self-host your own ntfy server or you want to use the ntfy CLI**.
2021-12-18 04:38:29 +01:00
If you just want to [send messages using ntfy.sh](publish.md), you don't need to install anything. You can just use
`curl`.
2021-12-02 05:08:12 +01:00
## General steps
The ntfy server comes as a statically linked binary and is shipped as tarball, deb/rpm packages and as a Docker image.
We support amd64, armv7 and arm64.
1. Install ntfy using one of the methods described below
2021-12-20 00:32:16 +01:00
2. Then (optionally) edit `/etc/ntfy/server.yml` for the server (see [configuration](config.md) or [sample server.yml](https://github.com/binwiederhier/ntfy/blob/main/server/server.yml))
3. Or (optionally) create/edit `~/.config/ntfy/client.yml` (or `/etc/ntfy/client.yml`, see [sample client.yml](https://github.com/binwiederhier/ntfy/blob/main/client/client.yml))
2021-12-18 04:38:29 +01:00
To run the ntfy server, then just run `ntfy serve` (or `systemctl start ntfy` when using the deb/rpm).
To send messages, use `ntfy publish`. To subscribe to topics, use `ntfy subscribe` (see [subscribing via CLI][subscribe/cli.md]
for details).
2021-12-02 05:08:12 +01:00
## Binaries and packages
Please check out the [releases page](https://github.com/binwiederhier/ntfy/releases) for binaries and
deb/rpm packages.
2021-12-04 02:38:21 +01:00
=== "x86_64/amd64"
```bash
2022-05-08 02:03:05 +02:00
wget https://github.com/binwiederhier/ntfy/releases/download/v1.22.0/ntfy_1.22.0_linux_x86_64.tar.gz
tar zxvf ntfy_1.22.0_linux_x86_64.tar.gz
sudo cp -a ntfy_1.22.0_linux_x86_64/ntfy /usr/bin/ntfy
sudo mkdir /etc/ntfy && sudo cp ntfy_1.22.0_linux_x86_64/{client,server}/*.yml /etc/ntfy
2022-03-17 02:40:56 +01:00
sudo ntfy serve
2021-12-04 02:38:21 +01:00
```
2021-12-02 05:08:12 +01:00
2022-04-25 03:53:08 +02:00
=== "armv6"
```bash
2022-05-08 02:03:05 +02:00
wget https://github.com/binwiederhier/ntfy/releases/download/v1.22.0/ntfy_1.22.0_linux_armv6.tar.gz
tar zxvf ntfy_1.22.0_linux_armv6.tar.gz
sudo cp -a ntfy_1.22.0_linux_armv6/ntfy /usr/bin/ntfy
sudo mkdir /etc/ntfy && sudo cp ntfy_1.22.0_linux_armv6/{client,server}/*.yml /etc/ntfy
2022-04-25 03:53:08 +02:00
sudo ntfy serve
```
2021-12-04 02:38:21 +01:00
=== "armv7/armhf"
```bash
2022-05-08 02:03:05 +02:00
wget https://github.com/binwiederhier/ntfy/releases/download/v1.22.0/ntfy_1.22.0_linux_armv7.tar.gz
tar zxvf ntfy_1.22.0_linux_armv7.tar.gz
sudo cp -a ntfy_1.22.0_linux_armv7/ntfy /usr/bin/ntfy
sudo mkdir /etc/ntfy && sudo cp ntfy_1.22.0_linux_armv7/{client,server}/*.yml /etc/ntfy
2022-03-17 02:40:56 +01:00
sudo ntfy serve
2021-12-04 02:38:21 +01:00
```
2021-12-02 05:08:12 +01:00
2021-12-04 02:38:21 +01:00
=== "arm64"
```bash
2022-05-08 02:03:05 +02:00
wget https://github.com/binwiederhier/ntfy/releases/download/v1.22.0/ntfy_1.22.0_linux_arm64.tar.gz
tar zxvf ntfy_1.22.0_linux_arm64.tar.gz
sudo cp -a ntfy_1.22.0_linux_arm64/ntfy /usr/bin/ntfy
sudo mkdir /etc/ntfy && sudo cp ntfy_1.22.0_linux_arm64/{client,server}/*.yml /etc/ntfy
2022-03-17 02:40:56 +01:00
sudo ntfy serve
2021-12-04 02:38:21 +01:00
```
2021-12-02 05:08:12 +01:00
## Debian/Ubuntu repository
Installation via Debian repository:
2021-12-04 02:38:21 +01:00
=== "x86_64/amd64"
```bash
curl -sSL https://archive.heckel.io/apt/pubkey.txt | sudo apt-key add -
sudo apt install apt-transport-https
sudo sh -c "echo 'deb [arch=amd64] https://archive.heckel.io/apt debian main' \
> /etc/apt/sources.list.d/archive.heckel.io.list"
sudo apt update
sudo apt install ntfy
sudo systemctl enable ntfy
sudo systemctl start ntfy
```
=== "armv7/armhf"
```bash
curl -sSL https://archive.heckel.io/apt/pubkey.txt | sudo apt-key add -
sudo apt install apt-transport-https
sudo sh -c "echo 'deb [arch=armhf] https://archive.heckel.io/apt debian main' \
> /etc/apt/sources.list.d/archive.heckel.io.list"
sudo apt update
sudo apt install ntfy
sudo systemctl enable ntfy
sudo systemctl start ntfy
```
=== "arm64"
```bash
curl -sSL https://archive.heckel.io/apt/pubkey.txt | sudo apt-key add -
sudo apt install apt-transport-https
sudo sh -c "echo 'deb [arch=arm64] https://archive.heckel.io/apt debian main' \
> /etc/apt/sources.list.d/archive.heckel.io.list"
sudo apt update
sudo apt install ntfy
sudo systemctl enable ntfy
sudo systemctl start ntfy
```
2021-12-02 05:08:12 +01:00
Manually installing the .deb file:
2021-12-04 02:38:21 +01:00
=== "x86_64/amd64"
```bash
2022-05-08 02:03:05 +02:00
wget https://github.com/binwiederhier/ntfy/releases/download/v1.22.0/ntfy_1.22.0_linux_amd64.deb
2021-12-04 02:38:21 +01:00
sudo dpkg -i ntfy_*.deb
sudo systemctl enable ntfy
sudo systemctl start ntfy
```
2022-04-25 03:53:08 +02:00
=== "armv6"
```bash
2022-05-08 02:03:05 +02:00
wget https://github.com/binwiederhier/ntfy/releases/download/v1.22.0/ntfy_1.22.0_linux_armv6.deb
2022-04-25 03:53:08 +02:00
sudo dpkg -i ntfy_*.deb
sudo systemctl enable ntfy
sudo systemctl start ntfy
```
2021-12-04 02:38:21 +01:00
=== "armv7/armhf"
```bash
2022-05-08 02:03:05 +02:00
wget https://github.com/binwiederhier/ntfy/releases/download/v1.22.0/ntfy_1.22.0_linux_armv7.deb
2021-12-04 02:38:21 +01:00
sudo dpkg -i ntfy_*.deb
sudo systemctl enable ntfy
sudo systemctl start ntfy
```
=== "arm64"
```bash
2022-05-08 02:03:05 +02:00
wget https://github.com/binwiederhier/ntfy/releases/download/v1.22.0/ntfy_1.22.0_linux_arm64.deb
2021-12-04 02:38:21 +01:00
sudo dpkg -i ntfy_*.deb
sudo systemctl enable ntfy
sudo systemctl start ntfy
```
2021-12-02 05:08:12 +01:00
## Fedora/RHEL/CentOS
2021-12-04 02:38:21 +01:00
=== "x86_64/amd64"
```bash
2022-05-08 02:03:05 +02:00
sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.22.0/ntfy_1.22.0_linux_amd64.rpm
2021-12-04 02:38:21 +01:00
sudo systemctl enable ntfy
sudo systemctl start ntfy
```
2022-04-25 03:53:08 +02:00
=== "armv6"
```bash
2022-05-08 02:03:05 +02:00
sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.22.0/ntfy_1.22.0_linux_armv6.rpm
2022-04-25 03:53:08 +02:00
sudo systemctl enable ntfy
sudo systemctl start ntfy
```
2021-12-04 02:38:21 +01:00
=== "armv7/armhf"
```bash
2022-05-08 02:03:05 +02:00
sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.22.0/ntfy_1.22.0_linux_armv7.rpm
2021-12-04 02:38:21 +01:00
sudo systemctl enable ntfy
sudo systemctl start ntfy
```
=== "arm64"
```bash
2022-05-08 02:03:05 +02:00
sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.22.0/ntfy_1.22.0_linux_arm64.rpm
2021-12-04 02:38:21 +01:00
sudo systemctl enable ntfy
sudo systemctl start ntfy
```
2021-12-02 05:08:12 +01:00
## Arch Linux
ntfy can be installed using an [AUR package](https://aur.archlinux.org/packages/ntfysh-bin/). You can use an [AUR helper](https://wiki.archlinux.org/title/AUR_helpers) like `paru`, `yay` or others to download, build and install ntfy and keep it up to date.
```
paru -S ntfysh-bin
```
Alternatively, run the following commands to install ntfy manually:
```
curl https://aur.archlinux.org/cgit/aur.git/snapshot/ntfysh-bin.tar.gz | tar xzv
cd ntfysh-bin
makepkg -si
```
2021-12-02 05:08:12 +01:00
## Docker
2022-04-25 04:25:34 +02:00
The [ntfy image](https://hub.docker.com/r/binwiederhier/ntfy) is available for amd64, armv6, armv7 and arm64. It should
be pretty straight forward to use.
2021-12-04 02:38:21 +01:00
The server exposes its web UI and the API on port 80, so you need to expose that in Docker. To use the persistent
2021-12-17 15:32:59 +01:00
[message cache](config.md#message-cache), you also need to map a volume to `/var/cache/ntfy`. To change other settings,
2021-12-19 04:02:36 +01:00
you should map `/etc/ntfy`, so you can edit `/etc/ntfy/server.yml`.
2021-12-02 05:08:12 +01:00
Basic usage (no cache or additional config):
```
2021-12-17 15:32:59 +01:00
docker run -p 80:80 -it binwiederhier/ntfy serve
2021-12-02 05:08:12 +01:00
```
With persistent cache (configured as command line arguments):
```bash
docker run \
-v /var/cache/ntfy:/var/cache/ntfy \
-p 80:80 \
-it \
binwiederhier/ntfy \
2021-12-17 15:32:59 +01:00
--cache-file /var/cache/ntfy/cache.db \
serve
2021-12-02 05:08:12 +01:00
```
2021-12-19 04:02:36 +01:00
With other config options (configured via `/etc/ntfy/server.yml`, see [configuration](config.md) for details):
2021-12-02 05:08:12 +01:00
```bash
docker run \
-v /etc/ntfy:/etc/ntfy \
-p 80:80 \
-it \
2021-12-17 15:32:59 +01:00
binwiederhier/ntfy \
serve
2021-12-02 05:08:12 +01:00
```
Using docker-compose:
2022-04-01 00:16:56 +02:00
```yaml
version: "2.1"
services:
ntfy:
image: binwiederhier/ntfy
container_name: ntfy
command:
- serve
volumes:
- /var/cache/ntfy:/var/cache/ntfy
- /etc/ntfy:/etc/ntfy
ports:
- 80:80
restart: unless-stopped
```
Alternatively, you may wish to build a customized Docker image that can be run with fewer command-line arguments and without delivering the configuration file separately.
```
FROM binwiederhier/ntfy
COPY server.yml /etc/ntfy/server.yml
ENTRYPOINT ["ntfy", "serve"]
```
This image can be pushed to a container registry and shipped independently. All that's needed when running it is mapping ntfy's port to a host port.